Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2018-01-12 08:45:00 +0000
committerPauline Deville2018-01-25 13:29:39 +0000
commit82b6a28cdd95db60879d018c5e58817b3943e895 (patch)
treeb4dac3aac4a0f108c4e44fc5eaa411532668acf7 /plugins/uml/tools
parent809440ddd208d865616b58cb218b40622794625c (diff)
downloadorg.eclipse.papyrus-82b6a28cdd95db60879d018c5e58817b3943e895.tar.gz
org.eclipse.papyrus-82b6a28cdd95db60879d018c5e58817b3943e895.tar.xz
org.eclipse.papyrus-82b6a28cdd95db60879d018c5e58817b3943e895.zip
Bug 529707 - [Profile] No way to select which ProfileApplicationDelegate
we want to use * Add a Preference Page to select the Profile application delegate to use * Move the External Profile application delegate preference page as sub preference page to the Profile application delegate page Change-Id: I83dfd62742420c158174152c01ed037c83993a95 Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins/uml/tools')
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/plugin.xml15
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/pom.xml4
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/IProfileApplicationDelegate.java28
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferenceInitializer.java47
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferencePage.java61
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegateRegistry.java31
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/Messages.java1
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/messages.properties1
9 files changed, 181 insertions, 9 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
index 9b15de17449..80918764752 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
@@ -28,7 +28,7 @@ Require-Bundle: org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=
org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.uml.tools.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/plugin.xml b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/plugin.xml
index 827731a7a6a..f4dd9672650 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/plugin.xml
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/plugin.xml
@@ -123,4 +123,19 @@
tabLabel="Flat">
</tabDeclaration>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.uml.tools.helper.ProfileApplicationDelegatePreferencePage"
+ id="org.eclipse.papyrus.uml.tools.profileApplicationDelegate"
+ name="Profile Application">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.uml.tools.helper.ProfileApplicationDelegatePreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/pom.xml b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/pom.xml
index f60c2c4f7b3..245fe585650 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/pom.xml
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/pom.xml
@@ -8,7 +8,7 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.tools</artifactId>
- <version>3.0.2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<description>This plugin contributes a set of common tools for UML</description>
-</project> \ No newline at end of file
+</project>
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/IProfileApplicationDelegate.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/IProfileApplicationDelegate.java
index 7f45aeedcb5..e398a9d6ccb 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/IProfileApplicationDelegate.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/IProfileApplicationDelegate.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 Christian W. Damus and others.
+ * Copyright (c) 2014, 2018 Christian W. Damus and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Christian W. Damus - Initial API and implementation
+ * Pauline DEVILLE - Bug 529707
*
*****************************************************************************/
@@ -115,6 +116,19 @@ public interface IProfileApplicationDelegate {
*/
EList<EObject> reapplyProfile(Package package_, Profile profile, IProgressMonitor monitor);
+ /**
+ * Get the preference constant
+ * @since 4.0
+ */
+ String getPreferenceConstant();
+
+ /**
+ * Get the preference label
+ * @since 4.0
+ */
+ String getPreferenceLabel();
+
+
//
// Nested types
//
@@ -156,5 +170,17 @@ public interface IProfileApplicationDelegate {
public EList<EObject> reapplyProfile(Package package_, Profile profile, IProgressMonitor monitor) {
return package_.applyProfile(profile);
}
+
+ public String getPreferenceConstant() {
+ return getPrefCons();
+ }
+
+ public String getPreferenceLabel() {
+ return "Default reapply tool"; //$NON-NLS-1$
+ }
+
+ private static String getPrefCons() {
+ return "default_delegate"; //$NON-NLS-1$
+ }
}
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferenceInitializer.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferenceInitializer.java
new file mode 100644
index 00000000000..374dd33c425
--- /dev/null
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferenceInitializer.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.tools.helper;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.tools.Activator;
+
+/**
+ * @since 4.0
+ *
+ */
+public class ProfileApplicationDelegatePreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public static final String PROFILE_APPLICATION_DELEGATE_PREFERENCE = "profile_application_delegate"; //$NON-NLS-1$
+
+ public static final String PREFERENCE_CONSTANT_FOR_DEFAULT = "externalized_profile_application_delegate"; //$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ *
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ store.setDefault(PROFILE_APPLICATION_DELEGATE_PREFERENCE, PREFERENCE_CONSTANT_FOR_DEFAULT);
+ }
+
+ /**
+ * Get the preference store
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferencePage.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferencePage.java
new file mode 100644
index 00000000000..af5e3b8a291
--- /dev/null
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegatePreferencePage.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.tools.helper;
+
+import java.util.List;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.papyrus.uml.tools.Activator;
+import org.eclipse.papyrus.uml.tools.messages.Messages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @since 4.0
+ */
+public class ProfileApplicationDelegatePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ private RadioGroupFieldEditor radioGroupFieldEditor;
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ *
+ * @param workbench
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ *
+ */
+ @Override
+ protected void createFieldEditors() {
+ List<IProfileApplicationDelegate> delegates = ProfileApplicationDelegateRegistry.INSTANCE.delegates;
+ String[][] array = new String[delegates.size()][2];
+
+ int i = 0;
+ for (IProfileApplicationDelegate delegate : delegates) {
+ array[i][0] = delegate.getPreferenceLabel();
+ array[i][1] = delegate.getPreferenceConstant();
+ i++;
+ }
+
+ radioGroupFieldEditor = new RadioGroupFieldEditor(ProfileApplicationDelegatePreferenceInitializer.PROFILE_APPLICATION_DELEGATE_PREFERENCE, Messages.ProfileApplicationDelegatePreferencePage_selectProfileApplicationTool, 1, array, getFieldEditorParent());
+ addField(radioGroupFieldEditor);
+ }
+}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegateRegistry.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegateRegistry.java
index 79e22945a25..683607814f9 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegateRegistry.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/ProfileApplicationDelegateRegistry.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Christian W. Damus - Initial API and implementation
+ * Pauline DEVILLE - Bug 529707
*
*****************************************************************************/
@@ -23,6 +24,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.plugin.RegistryReader;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.uml.tools.Activator;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
@@ -44,7 +46,10 @@ public class ProfileApplicationDelegateRegistry {
public static final ProfileApplicationDelegateRegistry INSTANCE = new ProfileApplicationDelegateRegistry();
- private final List<IProfileApplicationDelegate> delegates = new java.util.ArrayList<IProfileApplicationDelegate>(2);
+ /**
+ * @since 4.0
+ */
+ public final List<IProfileApplicationDelegate> delegates = new java.util.ArrayList<IProfileApplicationDelegate>(3);
private boolean needPrune;
@@ -88,8 +93,12 @@ public class ProfileApplicationDelegateRegistry {
for (IProfileApplicationDelegate next : delegates) {
if (next.appliesTo(package_)) {
- result = next;
- break;
+ final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ String preference = prefStore.getString(ProfileApplicationDelegatePreferenceInitializer.PROFILE_APPLICATION_DELEGATE_PREFERENCE);
+ if (preference.equals(next.getPreferenceConstant())) {
+ result = next;
+ break;
+ }
}
}
}
@@ -105,8 +114,12 @@ public class ProfileApplicationDelegateRegistry {
for (IProfileApplicationDelegate next : delegates) {
if (next.appliesTo(profileApplication)) {
- result = next;
- break;
+ final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ String preference = prefStore.getString(ProfileApplicationDelegatePreferenceInitializer.PROFILE_APPLICATION_DELEGATE_PREFERENCE);
+ if (preference.equals(next.getPreferenceConstant())) {
+ result = next;
+ break;
+ }
}
}
}
@@ -245,6 +258,14 @@ public class ProfileApplicationDelegateRegistry {
public EList<EObject> reapplyProfile(Package package_, Profile profile, IProgressMonitor monitor) {
return getInstance().reapplyProfile(package_, profile, monitor);
}
+
+ public String getPreferenceConstant() {
+ return getInstance().getPreferenceConstant();
+ }
+
+ public String getPreferenceLabel() {
+ return getInstance().getPreferenceLabel();
+ }
}
}
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/Messages.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/Messages.java
index 6d1305f342d..b431813437b 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/Messages.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/Messages.java
@@ -20,6 +20,7 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.tools.messages.messages"; //$NON-NLS-1$
public static String FlatTabUMLLabelProvider_QualifyNameButtonTooltip;
+ public static String ProfileApplicationDelegatePreferencePage_selectProfileApplicationTool;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/messages.properties b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/messages.properties
index de8344786b4..4d18165a064 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/messages.properties
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/messages/messages.properties
@@ -1 +1,2 @@
FlatTabUMLLabelProvider_QualifyNameButtonTooltip=Display Qualified Name
+ProfileApplicationDelegatePreferencePage_selectProfileApplicationTool=Select the profile application tool you want to use:

Back to the top