diff options
author | Camille Letavernier | 2014-02-14 16:19:36 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-02-14 16:19:36 +0000 |
commit | 5bb05b541e861d97ab1af8f160f8d855f6d13948 (patch) | |
tree | fbc17aabc9b414dac639589992e18d1341c46ec4 /plugins/sysml/diagram | |
parent | 245a00be5fd7c64a917f921d7359adabe5844523 (diff) | |
download | org.eclipse.papyrus-5bb05b541e861d97ab1af8f160f8d855f6d13948.tar.gz org.eclipse.papyrus-5bb05b541e861d97ab1af8f160f8d855f6d13948.tar.xz org.eclipse.papyrus-5bb05b541e861d97ab1af8f160f8d855f6d13948.zip |
417396: [CSS] The CSS Engine shall support label visibility & mask
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417396
- Restore Compartments preference pages
- Remove all mask-label related preference pages
Conflicts:
plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
Diffstat (limited to 'plugins/sysml/diagram')
29 files changed, 590 insertions, 2321 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF index 26098b3fcb4..aec0d8c1a2a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF @@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.2",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.2",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.2"
Export-Package: org.eclipse.papyrus.sysml.diagram.blockdefinition,
org.eclipse.papyrus.sysml.diagram.blockdefinition.command,
org.eclipse.papyrus.sysml.diagram.blockdefinition.dnd.helper,
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/BlockDefinitionDiagramPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/BlockDefinitionDiagramPreferenceInitializer.java index 1c86bd0d472..7a7b1d39ad5 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/BlockDefinitionDiagramPreferenceInitializer.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/BlockDefinitionDiagramPreferenceInitializer.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * CEA LIST - Initial API and implementation * *****************************************************************************/ @@ -30,31 +30,21 @@ public class BlockDefinitionDiagramPreferenceInitializer extends AbstractPrefere org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences.ModelPreferencePage.initDefaults(store); org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences.PackagePreferencePage.initDefaults(store); org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences.InstanceSpecificationPreferencePage.initDefaults(store); - org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences.ConstraintPreferencePage.initDefaults(store); org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences.CommentPreferencePage.initDefaults(store); ActorPreferencePage.initDefaults(store); BlockPreferencePage.initDefaults(store); - ConstraintPreferencePage.initDefaults(store); ConstraintBlockPreferencePage.initDefaults(store); - ConstraintPropertyPreferencePage.initDefaults(store); DataTypePreferencePage.initDefaults(store); DimensionPreferencePage.initDefaults(store); EnumerationPreferencePage.initDefaults(store); EnumerationLiteralPreferencePage.initDefaults(store); FlowPortPreferencePage.initDefaults(store); - FlowPropertyPreferencePage.initDefaults(store); FlowSpecificationPreferencePage.initDefaults(store); InterfacePreferencePage.initDefaults(store); - OperationPreferencePage.initDefaults(store); - PartPreferencePage.initDefaults(store); PortPreferencePage.initDefaults(store); PrimitiveTypePreferencePage.initDefaults(store); - PropertyPreferencePage.initDefaults(store); - ReceptionPreferencePage.initDefaults(store); - ReferencePreferencePage.initDefaults(store); SignalPreferencePage.initDefaults(store); UnitPreferencePage.initDefaults(store); - ValuePreferencePage.initDefaults(store); ValueTypePreferencePage.initDefaults(store); AssociationPreferencePage.initDefaults(store); DependencyPreferencePage.initDefaults(store); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPreferencePage.java deleted file mode 100644 index 1e4f53f6052..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPreferencePage.java +++ /dev/null @@ -1,200 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_SPECIFICATION; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class ConstraintPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ConstraintPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_SPECIFICATION); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnName, bttnSpecification; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnSpecification = createCheckButton(group, "Specification", DISP_SPECIFICATION); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnSpecification.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnSpecification.setSelection((propertyValue & DISP_SPECIFICATION) == DISP_SPECIFICATION); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPropertyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPropertyPreferencePage.java deleted file mode 100644 index 10c96ade1a4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ConstraintPropertyPreferencePage.java +++ /dev/null @@ -1,244 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class ConstraintPropertyPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTPROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ConstraintPropertyPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTPROPERTY_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTPROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnUndefined_Type.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortPreferencePage.java index fcfa4699e3c..22cb9380ebd 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortPreferencePage.java @@ -26,8 +26,7 @@ public class FlowPortPreferencePage extends AbstractPreferencePage { /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - // FlowPortAsBorderItemPreferencePage.initDefaults(store); - // FlowPortAsCompartmentItemPreferencePage.initDefaults(store); + FlowPortAsBorderItemPreferencePage.initDefaults(store); } @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPropertyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPropertyPreferencePage.java deleted file mode 100644 index 998c9866543..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPropertyPreferencePage.java +++ /dev/null @@ -1,254 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class FlowPropertyPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public FlowPropertyPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPROPERTY_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_DIRECTION | DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnDirection, bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnDirection = createCheckButton(group, "Direction", DISP_DIRECTION); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnDirection.setLayoutData(data); - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnDirection, 85); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE); - // bttnType.setLayoutData(data); - // - // bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnDirection, 85); - // data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE); - // bttnUndefined_Type.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnType, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnDirection, 85); - // data.top = new FormAttachment(bttnType, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnDirection.setSelection((propertyValue & DISP_DIRECTION) == DISP_DIRECTION); - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/OperationPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/OperationPreferencePage.java deleted file mode 100644 index 1cde0ff3220..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/OperationPreferencePage.java +++ /dev/null @@ -1,254 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class OperationPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_OPERATION_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public OperationPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_OPERATION_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_PARAM_DIRECTION | DISP_PARAM_NAME | DISP_PARAM_TYPE); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnName, bttnType, bttnModifiers, bttnParam_Direction, bttnParam_Name, bttnParam_Type, bttnParam_Multiplicity, bttnParam_DefaultValue, bttnParam_Modifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_OPERATION_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnType, 85); - // data.top = new FormAttachment(0, 0); - // bttnModifiers.setLayoutData(data); - // - // bttnParam_Direction = createCheckButton(group, "Param_Direction", DISP_PARAM_DIRECTION); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnParam_Direction.setLayoutData(data); - // - // bttnParam_Name = createCheckButton(group, "Param_Name", DISP_PARAM_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnParam_Name.setLayoutData(data); - // - // bttnParam_Type = createCheckButton(group, "Param_Type", DISP_PARAM_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnParam_Type.setLayoutData(data); - // - // bttnParam_Multiplicity = createCheckButton(group, "Param_Multiplicity", DISP_PARAM_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnType, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnParam_Multiplicity.setLayoutData(data); - // - // bttnParam_DefaultValue = createCheckButton(group, "Param_DefaultValue", DISP_PARAM_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnParam_Direction, ITabbedPropertyConstants.HSPACE); - // bttnParam_DefaultValue.setLayoutData(data); - // - // bttnParam_Modifiers = createCheckButton(group, "Param_Modifiers", DISP_PARAM_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnParam_Direction, ITabbedPropertyConstants.HSPACE); - // bttnParam_Modifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - // bttnParam_Direction.setSelection((propertyValue & DISP_PARAM_DIRECTION) == DISP_PARAM_DIRECTION); - // bttnParam_Name.setSelection((propertyValue & DISP_PARAM_NAME) == DISP_PARAM_NAME); - // bttnParam_Type.setSelection((propertyValue & DISP_PARAM_TYPE) == DISP_PARAM_TYPE); - // bttnParam_Multiplicity.setSelection((propertyValue & DISP_PARAM_MULTIPLICITY) == DISP_PARAM_MULTIPLICITY); - // bttnParam_DefaultValue.setSelection((propertyValue & DISP_PARAM_DEFAULTVALUE) == DISP_PARAM_DEFAULTVALUE); - // bttnParam_Modifiers.setSelection((propertyValue & DISP_PARAM_MODIFIERS) == DISP_PARAM_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PartPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PartPreferencePage.java deleted file mode 100644 index 86a8dbb6149..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PartPreferencePage.java +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class PartPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_PART_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public PartPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_PART_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_PART_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortPreferencePage.java index ebbb0bf96d8..e931f4f727e 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortPreferencePage.java @@ -26,8 +26,7 @@ public class PortPreferencePage extends AbstractPreferencePage { /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - // PortAsBorderItemPreferencePage.initDefaults(store); - // PortAsCompartmentItemPreferencePage.initDefaults(store); + PortAsBorderItemPreferencePage.initDefaults(store); } @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PropertyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PropertyPreferencePage.java deleted file mode 100644 index 791aa3bd04f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PropertyPreferencePage.java +++ /dev/null @@ -1,261 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class PropertyPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public PropertyPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - - PreferenceConverter.setDefault(store, PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255)); - PreferenceConverter.setDefault(store, PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(177, 207, 229)); - - // Set the default for the gradient - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.GRADIENT_POLICY), false); - GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(new org.eclipse.swt.graphics.RGB(255, 255, 255), new org.eclipse.swt.graphics.RGB(177, 207, 229), 0, 0); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue()); - - // custom code - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_UNDEFINED_TYPE); - - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnUndefined_Type.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReceptionPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReceptionPreferencePage.java deleted file mode 100644 index 36eab0c16e4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReceptionPreferencePage.java +++ /dev/null @@ -1,198 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class ReceptionPreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_RECEPTION_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ReceptionPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_RECEPTION_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_SIGNAL); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnName, bttnSignal; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_RECEPTION_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnSignal = createCheckButton(group, "Signal", DISP_SIGNAL); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnSignal.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnSignal.setSelection((propertyValue & DISP_SIGNAL) == DISP_SIGNAL); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReferencePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReferencePreferencePage.java deleted file mode 100644 index 0d6a43e0691..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ReferencePreferencePage.java +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class ReferencePreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_REFERENCE_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ReferencePreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_REFERENCE_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_REFERENCE_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/UnitPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/UnitPreferencePage.java index dedb1f740f4..5222afd3991 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/UnitPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/UnitPreferencePage.java @@ -16,14 +16,7 @@ package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; public class UnitPreferencePage extends BlockDefinitionDiagramNodePreferencePage { @@ -42,164 +35,7 @@ public class UnitPreferencePage extends BlockDefinitionDiagramNodePreferencePage // Start of user code custom default initializations store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 100); store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 60); - - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_DIMENSION); // End of user code - - } - - - /** buttons to select the display mask of the label */ - protected Button bttnName, bttnDimension; - - public static String prefLabelKey = prefKey + "-" + SysMLGraphicalTypes.LABEL_SYSML_UNIT_NAME_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnDimension = createCheckButton(group, "Dimension", DISP_DIMENSION); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnDimension.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnDimension.setSelection((propertyValue & DISP_DIMENSION) == DISP_DIMENSION); - } - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ValuePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ValuePreferencePage.java deleted file mode 100644 index 5c592149ae6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/ValuePreferencePage.java +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class ValuePreferencePage extends BlockDefinitionDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_VALUE_AS_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ValuePreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_VALUE_AS_LABEL_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_DEFAULTVALUE); - // End of user code - } - - /** buttons to select the display mask of the label */ - protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers; - - public static String prefLabelKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_VALUE_AS_LABEL_ID; //$NON-NLS-1$ - - private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE); - - /** current property display style */ - private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey); - - /** - * Creates a button with the {@link SWT#CHECK} style. - * - * @param parent - * the parent of the button - * @param label - * the label of the button - * @param mask - * the value controlled by the button - * @return the button created - */ - protected Button createCheckButton(Composite parent, String label, int mask) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.addSelectionListener(new AppearenceSelectionListener(mask)); - return button; - } - - /** - * Creates the group and check boxes to choose the kind of display - * - * @param parent - * the parent composite that holds the group - */ - protected void createLabelPreferencesButtons(Composite parent) { - // create group that host the buttons - // Group group = new Group(parent, SWT.SHADOW_NONE); - // group.setText("Label Display"); - // group.setLayout(new FormLayout()); - // - // FormData data; - // - // bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(0, 0); - // bttnVisibility.setLayoutData(data); - // - // bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(0, 0); - // bttnDerive.setLayoutData(data); - // - // bttnName = createCheckButton(group, "Name", DISP_NAME); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(0, 0); - // bttnName.setLayoutData(data); - // - // bttnType = createCheckButton(group, "Type", DISP_TYPE); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(0, 0); - // bttnType.setLayoutData(data); - // - // bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(0, 0); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnMultiplicity.setLayoutData(data); - // - // bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY); - // data = new FormData(); - // data.left = new FormAttachment(bttnVisibility, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefault_Multiplicity.setLayoutData(data); - // - // bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE); - // data = new FormData(); - // data.left = new FormAttachment(bttnDerive, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnDefaultValue.setLayoutData(data); - // - // bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS); - // data = new FormData(); - // data.left = new FormAttachment(bttnName, 85); - // data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE); - // bttnModifiers.setLayoutData(data); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // adds the label preferences check boxes - createLabelPreferencesButtons(parent); - - refreshButtons(); - } - - /** - * Load the default preferences of the fields contained in this page - */ - protected void loadDefaultPreferences() { - propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey); - refreshButtons(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - loadDefaultPreferences(); - super.performDefaults(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - storePreferences(); - return super.performOk(); - } - - /** - * Refresh the buttons that manages the display. - */ - protected void refreshButtons() { - - // bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY); - // bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE); - // bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME); - // bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE); - // bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY); - // bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY); - // bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE); - // bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS); - - } - - /** - * Stores the values of the fields contained in this page into the preference store. - */ - @Override - protected void storePreferences() { - super.storePreferences(); - IPreferenceStore store = getPreferenceStore(); - // checks the stored value and the actual one, so does not refresh diagram if it is not - // needed - if(propertyValue != store.getInt(labelDisplayPreferenceKey)) { - store.setValue(labelDisplayPreferenceKey, propertyValue); - } - } - - /** - * Listeners for the check buttons that select the display. - */ - private class AppearenceSelectionListener implements SelectionListener { - - /** The constant which refers the element to display or not. */ - final private int style; - - /** - * Default Constructor. - * - * @param style - */ - public AppearenceSelectionListener(int style) { - this.style = style; - } - - /** - * {@inheritDoc} - */ - public void widgetDefaultSelected(SelectionEvent e) { - - } - - /** - * {@inheritDoc} - */ - public void widgetSelected(SelectionEvent e) { - // add or remove the flag to the display property value (invert the current value) - propertyValue = propertyValue ^ style; - // refresh buttons to show current values - refreshButtons(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortAsBorderItemPreferencePage.java new file mode 100644 index 00000000000..a7f8d598004 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/FlowPortAsBorderItemPreferencePage.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; + +public class FlowPortAsBorderItemPreferencePage extends BlockDefinitionDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public FlowPortAsBorderItemPreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortAsBorderItemPreferencePage.java new file mode 100644 index 00000000000..a11ac22f8a5 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/preferences/PortAsBorderItemPreferencePage.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.blockdefinition.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +public class PortAsBorderItemPreferencePage extends BlockDefinitionDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public PortAsBorderItemPreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.css/theme/sysml.css b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.css/theme/sysml.css index 4fb8aadc085..7e6d5c00018 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.css/theme/sysml.css +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.css/theme/sysml.css @@ -22,6 +22,10 @@ InternalBlockDiagram Compartment{ showTitle: true;
}
+Compartment[kind=structure]{
+ showTitle: false;
+}
+
Package > Compartment[kind=packagedelements],
Model > Compartment[kind=packagedelements]{
visible: true;
@@ -62,13 +66,8 @@ InternalBlockDiagram Property > Compartment[kind=structure]{ visible: true;
}
-ParametricDiagram Property > Compartment[kind=structure]{
- visible: true;
-}
-
+ParametricDiagram Property > Compartment[kind=structure],
ParametricDiagram [appliedStereotypes~="Block"] > Compartment[kind=structure]{
visible: true;
- showTitle: false;
}
-
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF index 7b8ed889eb8..b1391bfdcac 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.2",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.2",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.2"
Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock,
org.eclipse.papyrus.sysml.diagram.internalblock.compatibility,
org.eclipse.papyrus.sysml.diagram.internalblock.dnd.helper,
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java index 52f8cae7b61..36f363ca8a1 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * CEA LIST - Initial API and implementation * *****************************************************************************/ @@ -26,7 +26,8 @@ public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - /* CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store); */ + CustomBlockPropertyCompositePreferencePage.initDefaults(store); + /*CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store);*/ } @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java new file mode 100644 index 00000000000..147f49b4eb9 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java @@ -0,0 +1,104 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.internalblock.preferences; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; +import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +/** + * Preference page for Part and References. + */ +public class CustomBlockPropertyCompositePreferencePage extends InternalBlockDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ + + /** The compartments default visibility for preferences */ + public static final Map<String, Boolean> compartmentDefaultVisibilityMap; + + /** The compartment titles default visibility for preferences */ + public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; + + /** Static attribute initialization */ + static { + compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + // Start of user code custom static initializations + compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$ + // End of user code + + Collections.unmodifiableMap(compartmentDefaultVisibilityMap); + Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); + } + + /** Constructor */ + public CustomBlockPropertyCompositePreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + // Start of user code custom default initializations + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100); + // End of user code + + // Initialize default visibility for compartments in preference page. + for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); + store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); + } + + // Initialize default title visibility for compartments in preference page. + for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); + store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentNamesList() { + for(String name : compartmentDefaultVisibilityMap.keySet()) { + this.compartmentNamesList.add(name); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentTitlesList() { + for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + this.compartmentTitlesList.add(name); + } + } +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java new file mode 100644 index 00000000000..9bd2356b71c --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.internalblock.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; +import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +/** + * Preference page for Part and References. + */ +@Deprecated +public class CustomNestedBlockPropertyCompositePreferencePage extends InternalBlockDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public CustomNestedBlockPropertyCompositePreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + // Start of user code custom default initializations + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 160); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 80); + // End of user code + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java index 2772b01fdd4..b89e34abe8e 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java @@ -36,6 +36,8 @@ public class CustomPreferenceInitializer extends InternalBlockDiagramPreferenceI IPreferenceStore store = getPreferenceStore();
+ PortAsBorderItemPreferencePage.initDefaults(store);
+ FlowPortAsBorderItemPreferencePage.initDefaults(store);
BlockPropertyCompositePreferencePage.initDefaults(store);
// Initialize default positions for labels.
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/FlowPortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/FlowPortAsBorderItemPreferencePage.java new file mode 100644 index 00000000000..0446c67fd01 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/FlowPortAsBorderItemPreferencePage.java @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.internalblock.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; +import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes; + +/** + * FlowPort preference page. + */ +public class FlowPortAsBorderItemPreferencePage extends InternalBlockDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public FlowPortAsBorderItemPreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); + } +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/PortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/PortAsBorderItemPreferencePage.java new file mode 100644 index 00000000000..d3d446ba4f9 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/PortAsBorderItemPreferencePage.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.internalblock.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; +import org.eclipse.uml2.uml.Port; + +/** + * {@link Port} preference page. + */ +public class PortAsBorderItemPreferencePage extends InternalBlockDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public PortAsBorderItemPreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java index 29b106f91ba..b544b1e664a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java @@ -26,7 +26,8 @@ public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - /* CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store); */ + CustomBlockPropertyCompositePreferencePage.initDefaults(store); + /*CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store);*/ } @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java new file mode 100644 index 00000000000..f47329a8d25 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * R�gis CHEVREL: chevrel.regis <at> gmail.com + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.parametric.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +/** + * {@link Port} preference page. + */ +public class ConstraintParameterAsBorderItemPreferencePage extends ParametricDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$ + + /** Constructor */ + public ConstraintParameterAsBorderItemPreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.ELEMENTICON), 0); + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java new file mode 100644 index 00000000000..4fd862e09a4 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java @@ -0,0 +1,105 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * R�gis CHEVREL: chevrel.regis <at> gmail.com + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.parametric.preferences; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; +import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +/** + * Preference page for Part and References. + */ +public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ + + /** The compartments default visibility for preferences */ + public static final Map<String, Boolean> compartmentDefaultVisibilityMap; + + /** The compartment titles default visibility for preferences */ + public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; + + /** Static attribute initialization */ + static { + compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + // Start of user code custom static initializations + compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$ + // End of user code + + Collections.unmodifiableMap(compartmentDefaultVisibilityMap); + Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); + } + + /** Constructor */ + public CustomBlockPropertyCompositePreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + // Start of user code custom default initializations + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200); + store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100); + // End of user code + + // Initialize default visibility for compartments in preference page. + for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); + store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); + } + + // Initialize default title visibility for compartments in preference page. + for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); + store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentNamesList() { + for(String name : compartmentDefaultVisibilityMap.keySet()) { + this.compartmentNamesList.add(name); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentTitlesList() { + for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + this.compartmentTitlesList.add(name); + } + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java new file mode 100644 index 00000000000..eb59e954379 --- /dev/null +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * R�gis CHEVREL: chevrel.regis <at> gmail.com + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.parametric.preferences; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; +import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; +import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; + +/** + * Preference page for Part and References. + */ +public class CustomConstraintPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage { + + /** Constant key to access preferences */ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ + + public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ + + /** The compartments default visibility for preferences */ + public static final Map<String, Boolean> compartmentDefaultVisibilityMap; + + /** The compartment titles default visibility for preferences */ + public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; + + /** Static attribute initialization */ + static { + compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + + // Start of user code custom static initializations + compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$ + // End of user code + + Collections.unmodifiableMap(compartmentDefaultVisibilityMap); + Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); + } + + /** Constructor */ + public CustomConstraintPropertyCompositePreferencePage() { + super(); + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ + } + + /** Default preferences initializer */ + public static void initDefaults(IPreferenceStore store) { + // Start of user code custom default initializations + // End of user code + + // Initialize default visibility for compartments in preference page. + for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); + store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); + } + + // Initialize default title visibility for compartments in preference page. + for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); + store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentNamesList() { + for(String name : compartmentDefaultVisibilityMap.keySet()) { + this.compartmentNamesList.add(name); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void initializeCompartmentTitlesList() { + for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + this.compartmentTitlesList.add(name); + } + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java index af0d1527e89..0bda174013c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java @@ -35,7 +35,9 @@ public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInit IPreferenceStore store = getPreferenceStore(); + ConstraintParameterAsBorderItemPreferencePage.initDefaults(store); BlockPropertyCompositePreferencePage.initDefaults(store); + CustomConstraintPropertyCompositePreferencePage.initDefaults(store); // Initialize default positions for labels. initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, 0, -10); |