Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java258
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java226
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java464
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java228
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java4
5 files changed, 6 insertions, 1174 deletions
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
index 86c1fafb1f2..f47329a8d25 100644
--- 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
@@ -13,36 +13,10 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
-
-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.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
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.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
/**
* {@link Port} preference page.
@@ -54,21 +28,6 @@ public class ConstraintParameterAsBorderItemPreferencePage extends ParametricDia
public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$
- /** The labels default visibility for preferences */
- public static final Map<String, Boolean> labelDefaultVisibilityMap;
-
- /** Static attribute initialization */
- static {
- labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
- labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
- labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
-
- // Start of user code custom static initializations
- // End of user code
-
- Collections.unmodifiableMap(labelDefaultVisibilityMap);
- }
-
/** Constructor */
public ConstraintParameterAsBorderItemPreferencePage() {
super();
@@ -77,226 +36,9 @@ public class ConstraintParameterAsBorderItemPreferencePage extends ParametricDia
/** Default preferences initializer */
public static void initDefaults(IPreferenceStore store) {
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_UNDEFINED_TYPE);
-
store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20);
store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20);
store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.ELEMENTICON), 0);
-
- // Initialize default visibility for labels in preference page.
- for(String labelName : labelDefaultVisibilityMap.keySet()) {
- String showLabelKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, labelName, PreferencesConstantsHelper.LABEL_VISIBILITY);
- store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeLabelsList() {
- for(String name : labelDefaultVisibilityMap.keySet()) {
- this.labelsList.add(name);
- }
- }
-
- /** buttons to select the display mask of the label */
- protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
-
- 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.
- */
- 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.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
index 23d565ce9b8..4fd862e09a4 100644
--- 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
@@ -13,37 +13,15 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
-
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.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
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;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
/**
* Preference page for Part and References.
@@ -53,7 +31,7 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra
/** 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$
+ 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;
@@ -64,7 +42,7 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra
/** Static attribute initialization */
static {
compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
- compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+ compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
@@ -89,7 +67,6 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra
// Start of user code custom default initializations
store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200);
store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100);
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE);
// End of user code
// Initialize default visibility for compartments in preference page.
@@ -125,203 +102,4 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra
}
}
- /** buttons to select the display mask of the label */
- protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
-
- 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.
- */
- 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.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java
deleted file mode 100644
index 28ac1db9788..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*****************************************************************************
- * 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 static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
-
-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.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
-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.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * {@link Connector} preference page.
- */
-public class CustomConnectorPreferencePage extends ParametricDiagramLinkPreferencePage {
-
- /** Constant key to access preferences */
- public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID; //$NON-NLS-1$
-
- /** The labels default visibility for preferences */
- public static final Map<String, Boolean> labelDefaultVisibilityMap;
-
- /** Static attribute initialization */
- static {
- labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
- labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
- labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
- labelDefaultVisibilityMap.put("SourceMultiplicity", Boolean.TRUE); //$NON-NLS-1$
- labelDefaultVisibilityMap.put("TargetMultiplicity", Boolean.TRUE); //$NON-NLS-1$
-
- // Start of user code custom static initializations
- // End of user code
-
- Collections.unmodifiableMap(labelDefaultVisibilityMap);
- }
-
- /** Constructor */
- public CustomConnectorPreferencePage() {
- super();
- setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID); //$NON-NLS-1$
- }
-
- /** Default preferences initializer */
- public static void initDefaults(IPreferenceStore store) {
- // Start of user code custom default initializations
-
- // Label default masks initialization
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(labelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE);
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(sourceMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_MULTIPLICITY);
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(targetMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_MULTIPLICITY);
-
- // End of user code
-
- // Initialize default visibility for labels in preference page.
- for(String labelName : labelDefaultVisibilityMap.keySet()) {
- String showLabelKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, labelName, PreferencesConstantsHelper.LABEL_VISIBILITY);
- store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeLabelsList() {
- for(String name : labelDefaultVisibilityMap.keySet()) {
- this.labelsList.add(name);
- }
- }
-
- // Label display mask management in preference page
-
- /** buttons to select the display mask of the label */
- protected Button bttnName, bttnType, bttnUndefined_Type;
-
- /** buttons to select the display mask of the source labels */
- protected Button bttnSourceMultMultiplicity, bttnSourceMultDefault_Multiplicity;
-
- /** buttons to select the display mask of the target labels */
- protected Button bttnTargetMultMultiplicity, bttnTargetMultDefault_Multiplicity;
-
- /** Preference keys */
- public static String labelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID; //$NON-NLS-1$
-
- public static String sourceMultLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID; //$NON-NLS-1$
-
- public static String targetMultLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID; //$NON-NLS-1$
-
- private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(labelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
-
- private String sourceMultLabelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(sourceMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
-
- private String targetMultLabelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(targetMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
-
- /** Current property display styles for labels */
- private int labelDisplayValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
-
- private int sourceMultDisplayValue = getPreferenceStore().getInt(sourceMultLabelDisplayPreferenceKey);
-
- private int targetMultDisplayValue = getPreferenceStore().getInt(targetMultLabelDisplayPreferenceKey);
-
- /**
- * 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 = createLabelCheckButton(group, "Name", DISP_NAME);
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 0);
- bttnName.setLayoutData(data);
-
- bttnType = createLabelCheckButton(group, "Type", DISP_TYPE);
- data = new FormData();
- data.left = new FormAttachment(bttnName, 85);
- data.top = new FormAttachment(0, 0);
- bttnType.setLayoutData(data);
-
- bttnUndefined_Type = createLabelCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
- data = new FormData();
- data.left = new FormAttachment(bttnType, 85);
- data.top = new FormAttachment(0, 0);
- bttnUndefined_Type.setLayoutData(data);
- }
-
- /**
- * Creates the group and check boxes to choose the kind of display
- *
- * @param parent
- * the parent composite that holds the group
- */
- protected void createSourceMultLabelPreferencesButtons(Composite parent) {
- // create group that host the buttons
- Group group = new Group(parent, SWT.SHADOW_NONE);
- group.setText("Source Multiplicity Label Display");
- group.setLayout(new FormLayout());
-
- FormData data;
-
- bttnSourceMultMultiplicity = createSourceMultCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 0);
- bttnSourceMultMultiplicity.setLayoutData(data);
-
- bttnSourceMultDefault_Multiplicity = createSourceMultCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
- data = new FormData();
- data.left = new FormAttachment(bttnSourceMultMultiplicity, 85);
- data.top = new FormAttachment(0, 0);
- bttnSourceMultDefault_Multiplicity.setLayoutData(data);
- }
-
- /**
- * Creates the group and check boxes to choose the kind of display
- *
- * @param parent
- * the parent composite that holds the group
- */
- protected void createTargetMultLabelPreferencesButtons(Composite parent) {
- // create group that host the buttons
- Group group = new Group(parent, SWT.SHADOW_NONE);
- group.setText("Target Multiplicity Label Display");
- group.setLayout(new FormLayout());
-
- FormData data;
-
- bttnTargetMultMultiplicity = createTargetMultCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 0);
- bttnTargetMultMultiplicity.setLayoutData(data);
-
- bttnTargetMultDefault_Multiplicity = createTargetMultCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
- data = new FormData();
- data.left = new FormAttachment(bttnTargetMultMultiplicity, 85);
- data.top = new FormAttachment(0, 0);
- bttnTargetMultDefault_Multiplicity.setLayoutData(data);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createPageContents(Composite parent) {
- super.createPageContents(parent);
-
- // adds the label preferences check boxes
- createLabelPreferencesButtons(parent);
- createSourceMultLabelPreferencesButtons(parent);
- createTargetMultLabelPreferencesButtons(parent);
-
- refreshButtons();
- }
-
- /**
- * Load the default preferences of the fields contained in this page
- */
- protected void loadDefaultPreferences() {
- labelDisplayValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
- sourceMultDisplayValue = getPreferenceStore().getDefaultInt(sourceMultLabelDisplayPreferenceKey);
- targetMultDisplayValue = getPreferenceStore().getDefaultInt(targetMultLabelDisplayPreferenceKey);
-
- 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() {
-
- // Label refresh buttons
- bttnName.setSelection((labelDisplayValue & DISP_NAME) == DISP_NAME);
- bttnType.setSelection((labelDisplayValue & DISP_TYPE) == DISP_TYPE);
- bttnUndefined_Type.setSelection((labelDisplayValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
-
- // Source Label Buttons
- bttnSourceMultMultiplicity.setSelection((sourceMultDisplayValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
- bttnSourceMultDefault_Multiplicity.setSelection((sourceMultDisplayValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
-
- // Target Label Buttons
- bttnTargetMultMultiplicity.setSelection((targetMultDisplayValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
- bttnTargetMultDefault_Multiplicity.setSelection((targetMultDisplayValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
-
- }
-
- /**
- * Stores the values of the fields contained in this page into the preference store.
- */
- 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(labelDisplayValue != store.getInt(labelDisplayPreferenceKey)) {
- store.setValue(labelDisplayPreferenceKey, labelDisplayValue);
- }
- if(sourceMultDisplayValue != store.getInt(sourceMultLabelDisplayPreferenceKey)) {
- store.setValue(sourceMultLabelDisplayPreferenceKey, sourceMultDisplayValue);
- }
- if(targetMultDisplayValue != store.getInt(targetMultLabelDisplayPreferenceKey)) {
- store.setValue(targetMultLabelDisplayPreferenceKey, targetMultDisplayValue);
- }
- }
-
- /**
- * 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 createLabelCheckButton(Composite parent, String label, int mask) {
- Button button = new Button(parent, SWT.CHECK);
- button.setText(label);
- button.addSelectionListener(new LabelAppearenceSelectionListener(mask));
- return button;
- }
-
- /**
- * 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 createSourceMultCheckButton(Composite parent, String label, int mask) {
- Button button = new Button(parent, SWT.CHECK);
- button.setText(label);
- button.addSelectionListener(new SourceMultAppearenceSelectionListener(mask));
- return button;
- }
-
- /**
- * 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 createTargetMultCheckButton(Composite parent, String label, int mask) {
- Button button = new Button(parent, SWT.CHECK);
- button.setText(label);
- button.addSelectionListener(new TargetMultAppearenceSelectionListener(mask));
- return button;
- }
-
- /**
- * Listeners for the check buttons that select the label display.
- */
- private class LabelAppearenceSelectionListener implements SelectionListener {
-
- /** The constant which refers the element to display or not. */
- final private int style;
-
- /**
- * Default Constructor.
- *
- * @param style
- */
- public LabelAppearenceSelectionListener(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)
- labelDisplayValue = labelDisplayValue ^ style;
-
- // refresh buttons to show current values
- refreshButtons();
- }
- }
-
- /**
- * Listeners for the check buttons that select the source multiplicity display.
- */
- private class SourceMultAppearenceSelectionListener implements SelectionListener {
-
- /** The constant which refers the element to display or not. */
- final private int style;
-
- /**
- * Default Constructor.
- *
- * @param style
- */
- public SourceMultAppearenceSelectionListener(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)
- sourceMultDisplayValue = sourceMultDisplayValue ^ style;
-
- // refresh buttons to show current values
- refreshButtons();
- }
- }
-
- /**
- * Listeners for the check buttons that select the target multiplicity display.
- */
- private class TargetMultAppearenceSelectionListener implements SelectionListener {
-
- /** The constant which refers the element to display or not. */
- final private int style;
-
- /**
- * Default Constructor.
- *
- * @param style
- */
- public TargetMultAppearenceSelectionListener(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)
- targetMultDisplayValue = targetMultDisplayValue ^ style;
-
- // refresh buttons to show current values
- refreshButtons();
- }
- }
-
-}
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
index b36f08b06d2..eb59e954379 100644
--- 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
@@ -13,37 +13,15 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
-import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
-
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.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
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;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
/**
* Preference page for Part and References.
@@ -53,7 +31,7 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD
/** 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$
+ 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;
@@ -64,7 +42,7 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD
/** Static attribute initialization */
static {
compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
- compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+ compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
@@ -87,9 +65,6 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD
/** 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);
- store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE);
// End of user code
// Initialize default visibility for compartments in preference page.
@@ -125,203 +100,4 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD
}
}
- /** buttons to select the display mask of the label */
- protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
-
- 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.
- */
- 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.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 dd338fee814..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
@@ -24,6 +24,7 @@ import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
*/
public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInitializer {
+ @Override
protected IPreferenceStore getPreferenceStore() {
return Activator.getInstance().getPreferenceStore();
}
@@ -37,7 +38,6 @@ public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInit
ConstraintParameterAsBorderItemPreferencePage.initDefaults(store);
BlockPropertyCompositePreferencePage.initDefaults(store);
CustomConstraintPropertyCompositePreferencePage.initDefaults(store);
- CustomConnectorPreferencePage.initDefaults(store);
// Initialize default positions for labels.
initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, 0, -10);
@@ -55,7 +55,7 @@ public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInit
/**
* Initialize default position of a link label in preferences.
- *
+ *
* @param parentGraphicalType
* the graphical type of the view owning the label
* @param graphicalType

Back to the top