Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-11-23 10:52:23 +0000
committercletavernie2012-11-23 10:52:23 +0000
commit6424abf6e7e922c90a56eec84fd3f9b2de9dfae5 (patch)
tree8d3239a03710422cba8493b4dbe9ee2bb9aeda71 /plugins/infra/gmfdiag
parentc7ed19562dfcf443385c0213765c98ffc841409f (diff)
downloadorg.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.gz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.xz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.zip
391945: [Refactoring] Part 2: Refactoring on Kepler (0.10)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391945
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java91
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java9
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gifbin0 -> 115 bytes
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java39
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java34
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java107
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java)14
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java)26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java24
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java163
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java25
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java124
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java11
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java76
30 files changed, 302 insertions, 544 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
index b25dcb33b63..5a0a230e0a7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
index 2e0d58204e0..51bfcd51a23 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
@@ -165,7 +165,7 @@ public abstract class AbstractStyleHandler extends AbstractHandler {
try {
resource.save(new HashMap<Object, Object>());
- (new CSSRefreshHandler()).execute(null);
+ (new CSSRefreshHandler()).execute(null); //FIXME: NPE on ExecutionEvent
} catch (IOException ex) {
Activator.log.error(ex);
MessageDialog.open(MessageDialog.ERROR, parentShell, "Style error", "An unexpected error occured while trying to save the Stylesheet", SWT.NONE);
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
index 2d417155736..05df777f2a3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.properties.creation,
org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding,
org.eclipse.papyrus.infra.gmfdiag.css.properties.provider
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
index 7bb1e6fbfa8..0bb5486c9ff 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
@@ -14,14 +14,12 @@ package org.eclipse.papyrus.infra.gmfdiag.css.engine;
import java.io.IOException;
import java.net.URL;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.SemanticElementHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
@@ -108,11 +106,7 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
public void handleChange(ChangeEvent event) {
resetCache();
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams(); //FIXME: Should be contextual. We should only refresh the editor(s) containing this Diagram
}
@Override
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
index 0a11f06bb5b..ffbc16063f6 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS;
import org.eclipse.e4.ui.css.core.dom.parsers.CSSParser;
import org.eclipse.e4.ui.css.core.dom.parsers.CSSParserFactory;
@@ -32,8 +31,7 @@ import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter;
import org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine;
import org.eclipse.e4.ui.css.core.impl.sac.CSSConditionFactoryImpl;
import org.eclipse.e4.ui.css.core.impl.sac.CSSSelectorFactoryImpl;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.BooleanConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.ColorToGMFConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.IntegerConverter;
@@ -355,11 +353,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams(); //TODO: Contextual refresh
}
});
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
index 61026e56ede..ef64e7768c7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
@@ -11,97 +11,16 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.helper;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.Activator;
/**
* A Helper for retrieving Views and Semantic elements from a
* compatible object.
*
* @author Camille Letavernier
+ *
+ * @deprecated moved to org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper
*/
-public class SemanticElementHelper {
-
- /**
- * Returns the semantic element attached to the given notation element
- *
- * The result element can also be a Diagram
- *
- * @param notationElement
- * @return
- */
- public static EObject findSemanticElement(EObject notationElement) {
- if(notationElement == null) {
- return null;
- }
- if(notationElement instanceof Diagram) {
- return notationElement;
- }
- if(notationElement instanceof View) {
- View view = (View)notationElement;
- EObject semanticElement = view.getElement();
- if(semanticElement != null) {
- return semanticElement;
- }
- //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
- //e.g. : Links in UML
- return view;
- }
-
- EObject currentElement = notationElement.eContainer();
-
- do {
- if(currentElement instanceof View) {
- return findSemanticElement(currentElement);
- }
- currentElement = currentElement.eContainer();
- } while(currentElement != null);
-
- Activator.log.warn("Cannot find a valid source for " + notationElement);
- return notationElement;
- }
-
- /**
- * Retrieves the primary view associated to the argument.
- *
- * For example, for a compartment, this method will return the top-most
- * view associated to the same semantic element.
- *
- * @param notationElement
- * @return
- */
- public static View findPrimaryView(EObject notationElement) {
- return findTopView(notationElement);
- }
-
- /**
- * Finds the top-most View associated to the same semantic
- * element as the argument.
- *
- * @param notationElement
- * @return
- */
- public static View findTopView(EObject notationElement) {
- EObject semanticElement = findSemanticElement(notationElement);
-
- if(semanticElement == notationElement) {
- return (View)notationElement;
- }
-
- EObject lastNotationElement = notationElement;
- while(notationElement != null) {
- notationElement = notationElement.eContainer();
- if(findSemanticElement(notationElement) != semanticElement) {
- return (View)lastNotationElement;
- }
-
- if(notationElement != null) {
- lastNotationElement = notationElement;
- }
- }
-
- return (View)lastNotationElement;
- }
+@Deprecated
+public class SemanticElementHelper extends org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper {
+ //Deprecated
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
index db2f453f4e7..84b17145b6e 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
@@ -13,12 +13,11 @@ package org.eclipse.papyrus.infra.gmfdiag.css.preferences;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
import org.eclipse.papyrus.infra.gmfdiag.css.theme.Theme;
@@ -74,11 +73,7 @@ public class ThemePreferencesPage extends FieldEditorPreferencePage implements I
boolean result = super.performOk();
if(needsRefresh) {
WorkspaceCSSEngine.instance.reset();
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams();
}
return result;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif
new file mode 100644
index 00000000000..a2017d01c82
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif
Binary files differ
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index 08ebb6b22a6..e164ecd4648 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -108,7 +108,7 @@
point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
<labelProvider
priority="40"
- provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramFilteredLabelProvider">
+ provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.NotationFilteredLabelProvider">
</labelProvider>
</extension>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
index 9c3d282ca61..6e556b0b22b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
@@ -54,6 +54,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.uml.tools.model.UmlUtils;
import org.eclipse.swt.widgets.Display;
@@ -81,12 +82,17 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
+ ServicesRegistry registry;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException ex) {
+ throw new ExecutionException("Cannot retrieve the ServicesRegistry", ex);
+ }
+
EObject container = null;
// if editor is open and active
- if(getMultiDiagramEditor() != null) {
- container = getSelectedElement();
- }
- runAsTransaction(container);
+ container = getSelectedElement();
+ runAsTransaction(container, registry);
return null;
}
@@ -98,13 +104,13 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
* The uml element to which the diagram should be attached, if possible.
* @throws ExecutionException
*/
- protected void runAsTransaction(EObject container) throws ExecutionException {
+ protected void runAsTransaction(EObject container, ServicesRegistry registry) throws ExecutionException {
ModelSet modelSet;
try {
- modelSet = EditorUtils.getServiceRegistry().getService(ModelSet.class);
+ modelSet = registry.getService(ModelSet.class);
} catch (ServiceException e) {
- throw new ExecutionException("Can't get diResourceSet", e);
+ throw new ExecutionException("Can't get ModelSet", e);
}
runAsTransaction(modelSet, container, null);
@@ -343,22 +349,17 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
}
/**
- * Get the ServiceRegistry of the main editor.
- *
- * @return
- */
- protected ServicesRegistry getServiceRegistry() {
- return EditorUtils.getServiceRegistry();
- }
-
- /**
* Get the ISashWindowsContentProvider from the main editor.
*
* @return
*/
- protected ISashWindowsContentProvider getISashWindowsContentProvider() {
- return EditorUtils.getISashWindowsContentProvider();
-
+ protected ISashWindowsContentProvider getISashWindowsContentProvider(ServicesRegistry registry) {
+ try {
+ return registry.getService(ISashWindowsContentProvider.class);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
index 75098981f31..e1fceec6dcb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
@@ -14,10 +14,9 @@ package org.eclipse.papyrus.infra.gmfdiag.common.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.ui.IEditorPart;
@@ -32,17 +31,16 @@ import org.eclipse.ui.IEditorPart;
public class RefreshHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
- IMultiDiagramEditor multiDiagramEditor = EditorUtils.getMultiDiagramEditor();
- if(multiDiagramEditor != null) {
- IEditorPart activeEditor = multiDiagramEditor.getActiveEditor();
- if(activeEditor instanceof DiagramEditor) {
- DiagramEditor diagramEditor = (DiagramEditor)activeEditor;
- DiagramEditPart topEditPart = diagramEditor.getDiagramEditPart();
- if(topEditPart != null) {
- DiagramHelper.refresh(topEditPart, true);
- }
- }
+ IEditorPart activeEditor;
+ try {
+ activeEditor = ServiceUtilsForHandlers.getInstance().getNestedActiveIEditorPart(event);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
}
+
+ DiagramHelper.refresh(activeEditor);
+
return null;
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
index 470f3f05b26..b5208b6cf2c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
@@ -15,6 +15,10 @@ import java.util.List;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.ui.IEditorPart;
public class DiagramHelper {
@@ -39,4 +43,34 @@ public class DiagramHelper {
}
}
}
+
+ /**
+ * Refreshes all diagrams in this IEditorPart (Including nested editors when necessary)
+ *
+ * @param editorPart
+ */
+ //FIXME: The current implementation only refreshes the active editor diagram
+ public static void refresh(IEditorPart editorPart) {
+ if(editorPart instanceof IMultiDiagramEditor) {
+ editorPart = ((IMultiDiagramEditor)editorPart).getActiveEditor();
+ }
+
+ if(editorPart instanceof DiagramEditor) {
+ DiagramEditor diagramEditor = (DiagramEditor)editorPart;
+ DiagramEditPart topEditPart = diagramEditor.getDiagramEditPart();
+ if(topEditPart != null) {
+ DiagramHelper.refresh(topEditPart, true);
+ }
+ }
+ }
+
+ /**
+ * Refreshes all opened diagrams
+ */
+ //FIXME: The current implementation only refreshes the active diagrams
+ public static void refreshDiagrams() {
+ for(IMultiDiagramEditor activeMultiEditor : EditorUtils.getMultiDiagramEditors()) {
+ refresh(activeMultiEditor);
+ }
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java
new file mode 100644
index 00000000000..541207e1eed
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.helper;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.Activator;
+
+/**
+ * A Helper for retrieving Views and Semantic elements from a
+ * compatible object.
+ *
+ * @author Camille Letavernier
+ */
+public class SemanticElementHelper {
+
+ /**
+ * Returns the semantic element attached to the given notation element
+ *
+ * The result element can also be a Diagram
+ *
+ * @param notationElement
+ * @return
+ */
+ public static EObject findSemanticElement(EObject notationElement) {
+ if(notationElement == null) {
+ return null;
+ }
+ if(notationElement instanceof Diagram) {
+ return notationElement;
+ }
+ if(notationElement instanceof View) {
+ View view = (View)notationElement;
+ EObject semanticElement = view.getElement();
+ if(semanticElement != null) {
+ return semanticElement;
+ }
+ //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
+ //e.g. : Links in UML
+ return view;
+ }
+
+ EObject currentElement = notationElement.eContainer();
+
+ do {
+ if(currentElement instanceof View) {
+ return findSemanticElement(currentElement);
+ }
+ currentElement = currentElement.eContainer();
+ } while(currentElement != null);
+
+ Activator.log.warn("Cannot find a valid source for " + notationElement);
+ return notationElement;
+ }
+
+ /**
+ * Retrieves the primary view associated to the argument.
+ *
+ * For example, for a compartment, this method will return the top-most
+ * view associated to the same semantic element.
+ *
+ * @param notationElement
+ * @return
+ */
+ public static View findPrimaryView(EObject notationElement) {
+ return findTopView(notationElement);
+ }
+
+ /**
+ * Finds the top-most View associated to the same semantic
+ * element as the argument.
+ *
+ * @param notationElement
+ * @return
+ */
+ public static View findTopView(EObject notationElement) {
+ EObject semanticElement = findSemanticElement(notationElement);
+
+ if(semanticElement == notationElement) {
+ return (View)notationElement;
+ }
+
+ EObject lastNotationElement = notationElement;
+ while(notationElement != null) {
+ notationElement = notationElement.eContainer();
+ if(findSemanticElement(notationElement) != semanticElement) {
+ return (View)lastNotationElement;
+ }
+
+ if(notationElement != null) {
+ lastNotationElement = notationElement;
+ }
+ }
+
+ return (View)lastNotationElement;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java
index cd18f08304e..8a4b214fab6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java
@@ -13,17 +13,18 @@ package org.eclipse.papyrus.infra.gmfdiag.common.providers;
import java.util.Iterator;
-import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
/**
- * A FilteredLabelProvider for GMF Diagrams
+ * A FilteredLabelProvider for GMF Notation model
*
* @author Camille Letavernier
*/
-public class DiagramFilteredLabelProvider extends DiagramLabelProvider implements IFilteredLabelProvider {
+public class NotationFilteredLabelProvider extends NotationLabelProvider implements IFilteredLabelProvider {
public boolean accept(IStructuredSelection selection) {
@@ -47,8 +48,9 @@ public class DiagramFilteredLabelProvider extends DiagramLabelProvider implement
return accept((IStructuredSelection)element);
}
- //The element is a Diagram or can be adapted to a Diagram
- return EMFHelper.getEObject(element) instanceof Diagram;
+ //Accept elements from the Notation metamodel
+ EObject eObject = EMFHelper.getEObject(element);
+ return eObject != null && eObject.eClass().getEPackage() == NotationPackage.eINSTANCE;
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java
index 8ff4331d960..18e3c9f2c76 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java
@@ -12,18 +12,28 @@
package org.eclipse.papyrus.infra.gmfdiag.common.providers;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.tools.Activator;
import org.eclipse.swt.graphics.Image;
/**
- * A Label Provider for GMF Diagrams
+ * A Label Provider for GMF Notation model
*/
-public class DiagramLabelProvider extends EMFLabelProvider {
+public class NotationLabelProvider extends EMFLabelProvider {
+
+ /** icon for a compartment */
+ public static final String ICON_COMPARTMENT = "/icons/none_comp_vis.gif"; //$NON-NLS-1$
@Override
protected Image getImage(EObject element) {
@@ -40,6 +50,11 @@ public class DiagramLabelProvider extends EMFLabelProvider {
return registry.getEditorIcon(element);
}
+ // if the element is a compartment
+ if(element instanceof BasicCompartment || element instanceof DecorationNode) {
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, ICON_COMPARTMENT);
+ }
+
return super.getImage(element);
}
@@ -60,6 +75,13 @@ public class DiagramLabelProvider extends EMFLabelProvider {
return ((Diagram)element).getName();
}
+ if(element instanceof View) { // maybe it is a view of a compartment
+ EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View)element);
+ if(dummyEP instanceof ResizableCompartmentEditPart) {
+ return ((ResizableCompartmentEditPart)dummyEP).getCompartmentName();
+ }
+ }
+
return super.getText(element);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
index 7aadf41c8e4..91831f43665 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
@@ -79,5 +79,16 @@ public abstract class TransactionalDropStrategy extends AbstractDropStrategy {
return EMFHelper.resolveEditingDomain(targetEditPart);
}
- public abstract Command doGetCommand(Request request, EditPart targetEditPart);
+ /**
+ * The command to be executed when the strategy is applied.
+ * Should return null if the strategy cannot handle the request.
+ *
+ * @param request
+ * The drop request
+ * @param targetEditPart
+ * The target edit part
+ * @return
+ * A command, or null if the strategy cannot handle the request
+ */
+ protected abstract Command doGetCommand(Request request, EditPart targetEditPart);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
index 7fad33192f0..a9608b11f8f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
@@ -16,13 +16,12 @@ import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionExcep
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
/** Return the path to the icon of the corresponding diagram */
public class GetDiagramIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<Diagram, String> {
public String evaluate(final Diagram context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
index e22dd5a4f27..6b8b5f39213 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
index 7146d55c730..f47912f0b5d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
@@ -8,6 +8,6 @@ bin.includes = META-INF/,\
about.html,\
icons/
output..=bin/
-src.includes = about.html.
+src.includes = about.html
source..=src/
bin..=bin/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
index e900603edc5..4f62d238078 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
@@ -12,6 +12,7 @@
*/
package org.eclipse.papyrus.infra.gmfdiag.navigation;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.papyrus.infra.gmfdiag.navigation.preference.NavigationPreferenceInitializer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -27,6 +28,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -43,6 +46,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
NavigationPreferenceInitializer preferenceInitializer = new NavigationPreferenceInitializer();
preferenceInitializer.initializeDefaultPreferences();
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
index 1d8e7bde33b..3f06d81d76b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
@@ -29,8 +29,11 @@ import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.extension.commands.ICreationCondition;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.widgets.toolbox.dialog.InformationDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
@@ -64,12 +67,19 @@ public abstract class CreateDiagramWithNavigationHandler extends AbstractHandler
public Object execute(ExecutionEvent event) throws ExecutionException {
NavigableElement navElement = getNavigableElementWhereToCreateDiagram();
+ ServicesRegistry registry;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
if(navElement == null) {
InformationDialog dialog = new InformationDialog(Display.getCurrent().getActiveShell(), "Impossible diagram creation", "It is not possible to create this diagram on the selected element.", null, null, SWT.OK, MessageDialog.WARNING, new String[]{ IDialogConstants.OK_LABEL });
dialog.open();
} else {
- createDiagram(navElement);
+ createDiagram(navElement, registry);
}
return null;
}
@@ -98,8 +108,14 @@ public abstract class CreateDiagramWithNavigationHandler extends AbstractHandler
return null;
}
- private void createDiagram(NavigableElement navElement) {
- ModelSet modelSet = EditorUtils.getDiResourceSet();
+ private void createDiagram(NavigableElement navElement, ServicesRegistry registry) {
+ ModelSet modelSet;
+ try {
+ modelSet = ServiceUtils.getInstance().getModelSet(registry);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
if(navElement != null && modelSet != null) {
try {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java
deleted file mode 100644
index 417190b7159..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 AtoS
- * 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:
- * Anass RADOUANI (AtoS)
- *******************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.navigation.utils;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * This class Provide a dialog filled with a list of reachable diagrams
- *
- * @author aradouan
- *
- */
-public class MultiDiagramDialog extends Dialog {
-
- private List<Diagram> diagrams;
-
- private Composite dialogComposite;
-
- protected int selectedDiagram;
-
- private Table table;
-
- private TableViewer list;
-
- public int getSelectedDiagram() {
- return selectedDiagram;
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.MultiDiagramDialog_0);
- }
-
- public MultiDiagramDialog(Shell parentShell, List<Diagram> diagrams) {
- super(parentShell);
- this.diagrams = diagrams;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- dialogComposite = (Composite)super.createDialogArea(parent);
- parent.setLayout(new GridLayout());
- dialogComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- createDialogComposite();
- createDialogContents(dialogComposite);
- hookListeners();
- loadData();
- defaultSelection();
-
- return dialogComposite;
- }
-
- private void createDialogContents(Composite parent) {
- dialogComposite.setLayout(new GridLayout(1, false));
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.HORIZONTAL));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
-
- Label lblDiagrams = new Label(composite, SWT.NONE);
- lblDiagrams.setText(Messages.MultiDiagramDialog_1);
-
- Composite composite_1 = new Composite(parent, SWT.NONE);
- composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite_1.setLayout(new GridLayout(1, false));
-
- list = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
- list.setUseHashlookup(true);
- table = list.getTable();
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- list.setLabelProvider(new MoDiscoLabelProvider());
- list.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof List) {
- return ((List)inputElement).toArray();
- } else {
- return new Object[]{ inputElement };
- }
- }
- });
- }
-
- private void createDialogComposite() {
- GridData dialogLayoutData = new GridData(GridData.FILL_BOTH);
- dialogComposite.setLayoutData(dialogLayoutData);
-
- }
-
- private void hookListeners() {
- table.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- MultiDiagramDialog.this.selectedDiagram = table.getSelectionIndex();
- }
-
- });
- }
-
- private void loadData() {
- list.setInput(diagrams);
- }
-
- private void defaultSelection() {
- boolean found = false;
- IPageMngr pageMngr;
- try {
- pageMngr = EditorUtils.getServiceRegistry().getService(IPageMngr.class);
-
- for(Diagram diagram : diagrams) {
- if(pageMngr.isOpen(diagram)) {
- table.select(diagrams.indexOf(diagram));
- found = true;
- break;
- }
- }
- } catch (ServiceException e) {
- e.printStackTrace();
- }
-
- if(!found) {
- table.select(0);
- }
- }
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
index 5438af5fce8..8bd9ca901a4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
@@ -8,7 +8,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.outline,
org.eclipse.papyrus.infra.gmfdiag.outline.internal;x-internal:=true,
org.eclipse.papyrus.infra.gmfdiag.outline.overview
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
index 7a4248cb36b..437e8de24d1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
@@ -24,7 +24,6 @@ import org.eclipse.emf.edit.provider.IViewerNotification;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
@@ -32,7 +31,11 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.papyrus.commands.ICreationCommandRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.gmfdiag.outline.internal.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -60,6 +63,8 @@ public class DiagramNavigator extends Composite {
*/
ICreationCommandRegistry creationCommandRegistry;
+ private final ServicesRegistry registry;
+
/**
* This content provider filters the event from graphical object to only refresh when it's
* needed.
@@ -109,8 +114,9 @@ public class DiagramNavigator extends Composite {
* @param pageSite
* the site
*/
- public DiagramNavigator(Composite parent, IPageSite pageSite) {
+ public DiagramNavigator(Composite parent, IPageSite pageSite, ServicesRegistry registry) {
super(parent, SWT.BORDER);
+ this.registry = registry;
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
@@ -149,15 +155,16 @@ public class DiagramNavigator extends Composite {
* Set the tree providers for the outline
*/
protected void initProviders() {
- AdapterFactoryContentProvider adapterContentProvider = new NavigatorAdapterFactoryContentProvider(
- getAdapterFactory());
+ AdapterFactoryContentProvider adapterContentProvider = new NavigatorAdapterFactoryContentProvider(getAdapterFactory());
adapterContentProvider.inputChanged(viewer, null, null);
viewer.setContentProvider(new DiagramOrientedContentProvider(adapterContentProvider));
- ILabelProvider labelProvider = new DiagramOrientedLabelProvider(new AdapterFactoryLabelProvider(
- getAdapterFactory()));
- ILabelProvider fullLabelProvider = new DecoratingLabelProvider(labelProvider, Activator.getDefault()
- .getWorkbench().getDecoratorManager().getLabelDecorator());
- viewer.setLabelProvider(fullLabelProvider);
+ try {
+ ILabelProvider labelProvider = ServiceUtils.getInstance().getService(LabelProviderService.class, registry).getLabelProvider();
+ ILabelProvider fullLabelProvider = new DecoratingLabelProvider(labelProvider, Activator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator());
+ viewer.setLabelProvider(fullLabelProvider);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java
deleted file mode 100644
index 28a25a4433f..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/***********************************************************************
- * Copyright (c) 2008, 2009 Anyware Technologies, Obeo
- *
- * 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:
- * David Sciamma (Anyware Technologies) - initial API and implementation
- *
- **********************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.outline;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Compute the label of the elements contained by the current diagram.
- *
- * @author <a href="mailto:david.sciamma@anyware-tech.com">David Sciamma</a>
- * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques Lescot</a>
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public class DiagramOrientedLabelProvider implements ILabelProvider {
-
- private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider;
-
- /** Registry to store editor factories */
- private IPageIconsRegistry editorRegistry;
-
- public DiagramOrientedLabelProvider(AdapterFactoryLabelProvider adapterFactoryLabelProvider) {
- this.myAdapterFactoryLabelProvider = adapterFactoryLabelProvider;
- }
-
- /**
- * {@inheritDoc}
- */
- public Image getImage(Object element) {
- if(element instanceof Diagram) {
- return getEditorRegistry().getEditorIcon(element);
- }
-
- return myAdapterFactoryLabelProvider.getImage(element);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getText(Object element) {
- if(element instanceof Diagram) {
- Diagram diagram = (Diagram)element;
- return myAdapterFactoryLabelProvider.getText(diagram.getElement());
- }
-
- return myAdapterFactoryLabelProvider.getText(element);
- }
-
- /**
- * {@inheritDoc}
- */
- public void addListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.addListener(listener);
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
- myAdapterFactoryLabelProvider.dispose();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isLabelProperty(Object element, String property) {
- return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.removeListener(listener);
- }
-
- /**
- * Get the EditorRegistry used to create editor instances. This default implementation return
- * the singleton eINSTANCE. This method can be subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- * @throws ServiceException
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should implements this
- * method in order to return the registry associated to the extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- * @throws ServiceException
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each request.
- return new PageIconsRegistry();
- }
- }
-
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
index 1519fff317b..ef0c70d9bb0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
@@ -222,7 +222,7 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
}
private DiagramNavigator createNavigator(Composite parent, IPageSite pageSite) {
- return new DiagramNavigator(parent, pageSite);
+ return new DiagramNavigator(parent, pageSite, multiEditor.getServicesRegistry());
}
@Override
@@ -281,7 +281,11 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
refreshSelection();
// Refresh outline contents content with the new selection
- refresh();
+ try {
+ refresh(); //When outline breaks, the selectionChangeEvent is borken too. It may prevent the others views from receiving it...
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -290,7 +294,7 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
private void refreshSelection() {
if(multiEditor.getActiveEditor() != null) {
- GraphicalViewer viewer = (GraphicalViewer)multiEditor.getActiveEditor().getAdapter(GraphicalViewer.class);
+ GraphicalViewer viewer = (GraphicalViewer)multiEditor.getAdapter(GraphicalViewer.class);
if(viewer == null) { // In case of an editor that is not GEF based.
root = null;
diagram = null;
@@ -324,7 +328,6 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
//FIXME: Sometimes, this method is called before #createControl(), which results in a NPE with sashComp
//Temporary fix : A non-null test has been added to avoid breaking the view
private void refresh() {
-
// Trash and re-Create Overview
if((overview != null) && !(overview.isDisposed())) {
overview.dispose();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
index 2c17ed1441e..65c0af373e8 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
@@ -47,7 +47,7 @@
</page>
<page
category="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusDiagramsPreferencePage"
+ class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage"
id="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusAllDiagramsPreferencePage"
name="Diagrams">
<enabledWhen>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
index cbbb7cf01fa..ae3cd45b5b1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom,
org.eclipse.papyrus.infra.gmfdiag.properties.extension,
org.eclipse.papyrus.infra.gmfdiag.properties.modelelement
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
index 49c6626c916..f85b81ae344 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
@@ -21,8 +21,12 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.GradientObservableValue;
-import org.eclipse.papyrus.infra.gmfdiag.properties.providers.GMFLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableList;
import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
@@ -84,7 +88,12 @@ public class GMFModelElement extends EMFModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
- return new GMFLabelProvider();
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, source).getLabelProvider();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return new LabelProvider();
+ }
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java
deleted file mode 100644
index f0334d597a4..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java
+++ /dev/null
@@ -1,76 +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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.providers;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An EMFObjectLabelProvider with support for GMF Diagram icons
- *
- * @author Camille Letavernier
- *
- */
-public class GMFLabelProvider extends EMFLabelProvider {
-
- protected IPageIconsRegistry editorRegistry;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(Object element) {
-
- if(element instanceof Diagram) {
- return getEditorRegistry().getEditorIcon(element);
- }
-
- return super.getImage(element);
- }
-
- /**
- * Get the EditorRegistry used to create editor instances. This default
- * implementation return the singleton eINSTANCE. This method can be
- * subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each
- // request.
- return new PageIconsRegistry();
- }
- }
-
-}

Back to the top