Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2017-10-09 15:03:05 +0000
committerBenoit Maggi2017-10-18 13:16:59 +0000
commit0faedf6e769fab5361c7fc70bd99af21b1d42ff0 (patch)
tree9f3992cd90c3c9c00ee301c2a7bc2109b42fbd8f /plugins/infra
parent0dd905ca77d973511f88e3c5624ae1581b2e87b8 (diff)
downloadorg.eclipse.papyrus-0faedf6e769fab5361c7fc70bd99af21b1d42ff0.tar.gz
org.eclipse.papyrus-0faedf6e769fab5361c7fc70bd99af21b1d42ff0.tar.xz
org.eclipse.papyrus-0faedf6e769fab5361c7fc70bd99af21b1d42ff0.zip
Bug 518313 - [ClassDiagram] Nested Element should be treated as
referenced - add a preferences to define 3 strategies for external: none, different container and different owner - default strategy remains the same - extract strings for future internationalization Change-Id: I9a23a8d62ca51a09a842972f3b9e4f2c1c6b95e4 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java10
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Messages.java10
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages.properties5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java12
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ExternalReferenceGroup.java80
8 files changed, 116 insertions, 9 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
index d4728ccebe9..65390b83014 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
@@ -147,6 +147,8 @@ public class PreferencesConstantsHelper {
public final static String RESTORE_LINK_ELEMENT_CONSTANT = "restoreLinkElement"; //$NON-NLS-1$
+ public final static String EXTERNAL_REFERENCE_STRATEGY_CONSTANT = "externalReferenceStrategy"; //$NON-NLS-1$
+
/**
* A preference of type COLOR FILL
*/
@@ -335,6 +337,11 @@ public class PreferencesConstantsHelper {
public static final int RESTORE_LINK_ELEMENT = INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE + 1;
/**
+ * A preference to indicate if the link element must be restore or not
+ */
+ public static final int EXTERNAL_REFERENCE_STRATEGY = RESTORE_LINK_ELEMENT + 1;
+
+ /**
* Get the preference constant used to store the preference of an element.
*
* @param elementName
@@ -451,6 +458,9 @@ public class PreferencesConstantsHelper {
case RESTORE_LINK_ELEMENT:
sb.append(RESTORE_LINK_ELEMENT_CONSTANT);
break;
+ case EXTERNAL_REFERENCE_STRATEGY:
+ sb.append(EXTERNAL_REFERENCE_STRATEGY_CONSTANT);
+ break;
default:
break;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
index 589e1300acb..9aa86db0796 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
@@ -3,10 +3,12 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.preferences,
org.eclipse.papyrus.infra.gmfdiag.preferences.initializer,
org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference;x-internal:=true,
org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.dialogs,
+ org.eclipse.papyrus.infra.gmfdiag.preferences.messages,
org.eclipse.papyrus.infra.gmfdiag.preferences.pages,
org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal;x-internal:=true,
org.eclipse.papyrus.infra.gmfdiag.preferences.ui,
org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram,
+ org.eclipse.papyrus.infra.gmfdiag.preferences.ui.dialog,
org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor,
org.eclipse.papyrus.infra.gmfdiag.preferences.utils
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="[1.7.0,2.0.0)",
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Messages.java
index cd0971c8a03..2f7d9c35163 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Messages.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Messages.java
@@ -83,6 +83,16 @@ public class Messages extends NLS {
public static String DimensionGroupName;
+ public static String ExternalReferenceGroup_ComboTitle;
+
+ public static String ExternalReferenceGroup_DifferentContainer;
+
+ public static String ExternalReferenceGroup_DifferentOwner;
+
+ public static String ExternalReferenceGroup_NoReferences;
+
+ public static String ExternalReferenceGroup_Title;
+
public static String NodeCompartmentGroup_Compartiments;
public static String RestoreElementGroup_RestoreElementLink;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
index 1567935efbd..c61970ba5fa 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
@@ -75,8 +75,6 @@ public class ColorFieldEditor extends FieldEditor {
@Override
protected void adjustForNumColumns(int numColumns) {
- // TODO Auto-generated method stub
-
}
@Override
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java
index 8aadc7e999a..2a8b78b7ce1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java
@@ -80,8 +80,6 @@ public class FontFieldEditor extends FieldEditor {
*/
@Override
protected void adjustForNumColumns(int numColumns) {
- // TODO Auto-generated method stub
-
}
/**
@@ -89,8 +87,6 @@ public class FontFieldEditor extends FieldEditor {
*/
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) {
- // TODO Auto-generated method stub
-
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages.properties
index 7e901ab06f9..9d8de5d0ceb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages.properties
@@ -32,6 +32,11 @@ GradientFieldEditor_Transparency=Transparency
GradientFieldEditor_Vertical=Vertical
DecorationGroup_Name=Decoration
DimensionGroupName=Dimension
+ExternalReferenceGroup_ComboTitle=Selected strategy
+ExternalReferenceGroup_DifferentContainer=Different container
+ExternalReferenceGroup_DifferentOwner=Different owner
+ExternalReferenceGroup_NoReferences=No external references
+ExternalReferenceGroup_Title=External references
NodeCompartmentGroup_Compartiments=Show/hide compartments
RestoreElementGroup_RestoreElementLink=Restore Link Element
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
index b5dd629c7b7..eddc3fa29e3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ExternalReferenceGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RestoreElementGroup;
@@ -79,9 +80,12 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
RulersAndGridGroup viewGroupComposite = new EditorRulersAndGridGroup(parent, getTitle(), this);
addPreferenceGroup(viewGroupComposite);
-
- final RestoreElementGroup restoreElementGroup = new RestoreElementGroup(parent, getTitle(), this);
+
+ final RestoreElementGroup restoreElementGroup = new RestoreElementGroup(contentGroup, getTitle(), this);
addPreferenceGroup(restoreElementGroup);
+
+ final ExternalReferenceGroup externalReferenceGroup = new ExternalReferenceGroup(contentGroup, getTitle(), this);
+ addPreferenceGroup(externalReferenceGroup);
}
@@ -91,7 +95,7 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
}
/**
- * use to init default preferences at the papyrus level
+ * use to init default preferences at the Papyrus level
*
* @param store
* the preference store
@@ -133,6 +137,8 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
// Restore Element Group
RestoreElementGroup.initDefaults(store);
+
+ ExternalReferenceGroup.initDefaults(store);
}
});
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ExternalReferenceGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ExternalReferenceGroup.java
new file mode 100755
index 00000000000..3c70abde86a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ExternalReferenceGroup.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * The Class ExternalReferenceGroup contains a combobox to select
+ * external reference strategy
+ */
+public class ExternalReferenceGroup extends AbstractGroup {
+
+ public static final String EXTERNAL_REFERENCE_NONE = "EXTERNAL_REFERENCE_NONE"; //$NON-NLS-1$
+ public static final String EXTERNAL_REFERENCE_CONTAINER = "EXTERNAL_REFERENCE_CONTAINER"; //$NON-NLS-1$
+ public static final String EXTERNAL_REFERENCE_OWNER = "EXTERNAL_REFERENCE_OWNER"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * @param key
+ * @param dialogPage
+ */
+ public ExternalReferenceGroup(final Composite parent, final String key, final DialogPage dialogPage) {
+ super(parent, key, dialogPage);
+ createContent(parent);
+ }
+
+ /**
+ * Create the content of the group.
+ *
+ * @param parent
+ */
+ private void createContent(final Composite parent) {
+ // Create a Group to hold the restore element fields
+ final Group group = new Group(parent, SWT.NONE);
+ group.setText(Messages.ExternalReferenceGroup_Title);
+
+ final GridLayout gridLayout = new GridLayout(1, false);
+ final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 1;
+
+ String papyrusEditorConstant = PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.EXTERNAL_REFERENCE_STRATEGY);
+ String[][] options = {{Messages.ExternalReferenceGroup_NoReferences, EXTERNAL_REFERENCE_NONE},
+ {Messages.ExternalReferenceGroup_DifferentContainer, EXTERNAL_REFERENCE_CONTAINER},
+ {Messages.ExternalReferenceGroup_DifferentOwner, EXTERNAL_REFERENCE_OWNER}};
+ final ComboFieldEditor restoreElement = new ComboFieldEditor(papyrusEditorConstant, Messages.ExternalReferenceGroup_ComboTitle, options, group);
+ addFieldEditor(restoreElement);
+ group.setLayoutData(gridData);
+ group.setLayout(gridLayout);
+ }
+
+
+ /**
+ * Initializes the default values of the group.
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.EXTERNAL_REFERENCE_STRATEGY), EXTERNAL_REFERENCE_CONTAINER);
+ }
+}

Back to the top