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
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')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java21
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java11
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java457
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java49
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java42
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java53
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java36
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java206
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java82
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java59
-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
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF1
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java13
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java69
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java34
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java11
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java9
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java17
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java11
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java21
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java34
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java40
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java14
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java4
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java14
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java2
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java3
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java116
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java20
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java24
80 files changed, 993 insertions, 1445 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
index 047e701810a..d14d4f739a8 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
@@ -10,8 +10,7 @@ Require-Bundle: org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
org.eclipse.gef;bundle-version="3.8.1",
org.eclipse.emf.ecore.xmi;bundle-version="2.8.0",
- org.eclipse.emf.workspace;bundle-version="1.5.1",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0"
+ org.eclipse.emf.workspace;bundle-version="1.5.1"
Export-Package: org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.infra.core.contentoutline,
org.eclipse.papyrus.infra.core.editor,
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
index 367ec8ab1f3..e1ef11dea66 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
@@ -363,7 +363,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
}
- if(EditingDomain.class == adapter) {
+ if(EditingDomain.class == adapter || TransactionalEditingDomain.class == adapter) {
return transactionalEditingDomain;
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
index 42929809a48..55c60fd9f62 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
@@ -97,7 +97,7 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
/**
* The serviceRegistry.
*/
-// private ServicesRegistry servicesRegistry;
+ // private ServicesRegistry servicesRegistry;
/**
* Associated editor. Needed by saveAs to synchronize editor input.
@@ -179,7 +179,7 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
*/
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
-// this.servicesRegistry = servicesRegistry;
+ // this.servicesRegistry = servicesRegistry;
// Retrieve required services.
resourceSet = servicesRegistry.getService(ModelSet.class);
@@ -222,27 +222,27 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
// Check if commandStack is null (meaning that transactionalEditingDomain
// is disposed
CommandStack commandStack = transactionalEditingDomain.getCommandStack();
- if( commandStack != null) {
+ if(commandStack != null) {
transactionalEditingDomain.getCommandStack().removeCommandStackListener(commandStackListener);
}
transactionalEditingDomain.removeResourceSetListener(resourceSetListener);
-// resourceSetListener = null;
+ // resourceSetListener = null;
}
-
+
// clean properties in order to help GC
inputChangedListeners.clear();
inputChangedListeners = null;
multiDiagramEditor = null;
-// servicesRegistry = null;
+ // servicesRegistry = null;
transactionalEditingDomain = null;
resourceSet = null;
lifeCycleEvent = null;
-
+
postSaveListeners.clear();
saveListeners.clear();
preSaveListeners.clear();
-
-
+
+
}
/**
@@ -474,8 +474,9 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
*/
public boolean isDirty() {
for(ISaveablePart part : this) {
- if(part.isDirty())
+ if(part.isDirty()) {
return true;
+ }
}
return false;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
index 44c43a293e4..fb4e543237a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
@@ -11,15 +11,18 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
-import static org.eclipse.papyrus.infra.core.Activator.log;
-
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+
/**
* Util class for display in Papyrus (label providers, etc...)
+ *
+ * @deprecated Use the LabelProviderService instead
*/
+@Deprecated
public class DisplayUtils {
/**
@@ -34,9 +37,9 @@ public class DisplayUtils {
return registry == null ? null : registry.getService(ILabelProvider.class);
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
- log.error(e);
+ Activator.log.error(e);
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
index 5ad815c0e37..f3ea7a7bcfd 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
@@ -15,14 +15,13 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
-import static org.eclipse.papyrus.infra.core.Activator.log;
-
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
@@ -59,70 +58,6 @@ import org.eclipse.ui.PlatformUI;
public class EditorUtils {
/**
- * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
- * editor, if possible, or null if not possible. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc. <br>
- * This method return null if there is no active editor, or if the editor is
- * not instance of IMultiDiagramEditor. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. Usage of this method is discouraged. Use {@link #getMultiDiagramEditorChecked()} instead.
- *
- *
- * @return Get the current {@link IMultiDiagramEditor} or null if not found.
- */
- public static IMultiDiagramEditor getMultiDiagramEditor() {
- // Lookup ServiceRegistry
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if(workbenchWindow == null) {
- return null;
- }
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if(page == null) {
- return null;
- }
- IEditorPart editor = page.getActiveEditor();
- if(editor instanceof IMultiDiagramEditor) {
- return (IMultiDiagramEditor)editor;
- } else {
- return null;
- }
- }
-
- /**
- * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
- * editor, if possible, or throw an exception if not possible. <br>
- * WARNING - This method throw an exception during the initialization of the
- * main editor. This method throws an exception if there is no active
- * editor, or if the editor is not instance of IMultiDiagramEditor. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- *
- *
- * @return Get the current {@link IMultiDiagramEditor} or null if not found.
- * @throws BackboneException
- * If it is not possible to get an instanceof {@link IMultiDiagramEditor}
- */
- public static IMultiDiagramEditor getMultiDiagramEditorChecked() throws BackboneException {
- IEditorPart editor;
- try {
- editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- } catch (NullPointerException e) {
- // Can't get the active editor
- throw new BackboneException("Can't get the current Eclipse Active Editor: There is no active editor at this time.");
- }
-
- if(editor instanceof IMultiDiagramEditor) {
- return (IMultiDiagramEditor)editor;
- } else {
- throw new BackboneException("Can't get an Active Editor instance of IMultiDiagramEditor. (actual type:" + editor.getClass().getName() + ")");
- }
- }
-
- /**
* Gets the opened multi-diagram editors.
*
* @return The opened {@link IMultiDiagramEditor} or null if an error
@@ -177,187 +112,72 @@ public class EditorUtils {
}
/**
- * Get the {@link ServicesRegistry}of the currently active eclipse editor. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc. <br>
- * This method return null if the ServicesRegistry can not be found. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. An alternative is to use {@link #getServiceRegistryChecked()} and
- * to catch the exception. <br>
- * It is preferable to retrieve the ServiceRegistry from elsewhere whenever
- * it is possible. <br>
- * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved
- * with methods from
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
- *
- * <br>
- * WARNING: This method can return null if there is no Active Editor. This
- * happen during the editor initialization, especially when there is no
- * other editor opened.
+ * Create an instance of IPageMngr acting on the provided resource. This
+ * instance is suitable to add, remove, close or open diagrams.
*
- * @return The {@link ServicesRegistry} or null if not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ * @param diResource
+ * @return The non transactional implementation of IPageMngr
*/
- @Deprecated
- static public ServicesRegistry getServiceRegistry() {
- // Lookup ServiceRegistry
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- return editor == null ? null : (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ public static IPageMngr getIPageMngr(Resource diResource) {
+ return DiSashModelMngr.createIPageMngr(diResource);
}
/**
- * Get the service registry of the currently active main editor. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc.
+ * Create an instance of IPageMngr acting on the provided resource. This
+ * instance is suitable to add, remove, close or open diagrams.
*
- * @return The {@link ServicesRegistry} or null if not found.
- * @throws ServiceException
- * If an error occurs.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ * @param diResource
+ * @param editingDomain
+ *
+ * @return The transactional implementation of IPageMngr
*/
- @Deprecated
- static public ServicesRegistry getServiceRegistryChecked() throws ServiceException {
- // Lookup ServiceRegistry
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- if(editor == null) {
- throw new ServiceException("Can't get ServiceRegistry");
- }
-
- return (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ public static IPageMngr getTransactionalIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
+ return TransactionalDiSashModelMngr.createIPageMngr(diResource, editingDomain);
}
- /**
- * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
- * possible. <br>
- * This method return null if the ServiceRegistry can not be found or if an
- * error occur. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. <br>
- *
- * @return the ISashWindowsContentProvider from the main editor or null if
- * not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
- */
- @Deprecated
- static public ISashWindowsContentProvider getISashWindowsContentProvider() {
- try {
- return getServiceRegistryChecked().getService(ISashWindowsContentProvider.class);
- } catch (ServiceException e) {
- // The contract says that we return null if not found
- return null;
- }
- }
+ ////////////////////////////////////////////
+ // The following methods are deprecated. They have been replaced by specific
+ // implementations of ServiceUtils (e.g. ServiceUtilsForHandlers, ServiceUtilsForEObject),
+ // which depend on a specific context (ExecutionEvent, EObject, ...) instead of
+ // the active editor
+ ////////////////////////////////////////////
/**
- * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
- * possible. <br>
- * This method return null if the ServiceRegistry can not be found or if an
- * error occur. <br>
+ * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
+ * editor, if possible, or null if not possible. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc. <br>
+ * This method return null if there is no active editor, or if the editor is
+ * not instance of IMultiDiagramEditor. <br>
* This method is designed to be used by ui actions that interact with the
* active editor. <br>
* This method should not be used during the editor initialization phase. <br>
* In any case, a check should be done on the returned value that can be
- * null.
+ * null. Usage of this method is discouraged. Use {@link #getMultiDiagramEditorChecked()} instead.
*
- * @return the ISashWindowsContentProvider from the main editor or null if
- * not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ *
+ * @return Get the current {@link IMultiDiagramEditor} or null if not found.
*/
- @Deprecated
- public static IPageMngr getIPageMngr() {
-
- try {
- return getServiceRegistryChecked().getService(IPageMngr.class);
- } catch (ServiceException e) {
- // The contract says that we return null if not found
+ public static IMultiDiagramEditor getMultiDiagramEditor() {
+ // Lookup ServiceRegistry
+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if(workbenchWindow == null) {
return null;
}
- }
-
- /**
- * Get the Eclipse ActiveEditor.
- *
- * @return The active {@link CoreMultiDiagramEditor} or null if not found.
- * @deprecated Use {@link EditorUtils#getMultiDiagramEditor()}
- */
- @Deprecated
- protected static IEditorPart getWorkbenchActiveEditor() {
- IMultiDiagramEditor editorPart = getMultiDiagramEditor();
- if(editorPart instanceof CoreMultiDiagramEditor) {
- return editorPart;
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ if(page == null) {
+ return null;
+ }
+ IEditorPart editor = page.getActiveEditor();
+ if(editor instanceof IMultiDiagramEditor) {
+ return (IMultiDiagramEditor)editor;
} else {
return null;
}
}
/**
- * Create an instance of IPageMngr acting on the provided resource. This
- * instance is suitable to add, remove, close or open diagrams.
- *
- * @param diResource
- * @return The non transactional implementation of IPageMngr
- */
- public static IPageMngr getIPageMngr(Resource diResource) {
- return DiSashModelMngr.createIPageMngr(diResource);
- }
-
- /**
- * Create an instance of IPageMngr acting on the provided resource. This
- * instance is suitable to add, remove, close or open diagrams.
- *
- * @param diResource
- * @param editingDomain
- *
- * @return The transactional implementation of IPageMngr
- */
- public static IPageMngr getTransactionalIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
- return TransactionalDiSashModelMngr.createIPageMngr(diResource, editingDomain);
- }
-
- /**
* Lookup the currently active Diagram from the Papyrus editor. Return the
* current Diagram or null if none is active. <br>
* WARNING - This method doesn't work during the initialization of the main
@@ -372,6 +192,7 @@ public class EditorUtils {
* Editors, GMF stuff should be moved in GMF projects. In many
* case, {@link #lookupActiveNestedIEditor()} can be used.
*/
+ // @Deprecated
// public static Diagram lookupEditorActiveDiagram() {
// DiagramEditor diagEditor = lookupActiveDiagramEditor();
// return diagEditor == null ? null : diagEditor.getDiagram();
@@ -392,6 +213,7 @@ public class EditorUtils {
* Editors, GMF stuff should be moved in GMF projects. In many
* case, {@link #lookupActiveNestedIEditor()} can be used.
*/
+ // @Deprecated
// public static DiagramEditor lookupActiveDiagramEditor() {
// // Get the active page within the sashcontainer
// IEditorPart activeEditor = lookupActiveNestedIEditor();
@@ -516,7 +338,7 @@ public class EditorUtils {
ServicesRegistry registry = getServiceRegistry();
return registry == null ? null : registry.getService(DiResourceSet.class);
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -563,7 +385,7 @@ public class EditorUtils {
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -633,7 +455,7 @@ public class EditorUtils {
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -657,4 +479,191 @@ public class EditorUtils {
return registry.getService(TransactionalEditingDomain.class);
}
+ /**
+ * Get the {@link ServicesRegistry}of the currently active eclipse editor. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc. <br>
+ * This method return null if the ServicesRegistry can not be found. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null. An alternative is to use {@link #getServiceRegistryChecked()} and
+ * to catch the exception. <br>
+ * It is preferable to retrieve the ServiceRegistry from elsewhere whenever
+ * it is possible. <br>
+ * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved
+ * with methods from
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
+ *
+ * <br>
+ * WARNING: This method can return null if there is no Active Editor. This
+ * happen during the editor initialization, especially when there is no
+ * other editor opened.
+ *
+ * @return The {@link ServicesRegistry} or null if not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ServicesRegistry getServiceRegistry() {
+ // Lookup ServiceRegistry
+ IMultiDiagramEditor editor = getMultiDiagramEditor();
+ return editor == null ? null : (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ }
+
+ /**
+ * Get the service registry of the currently active main editor. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc.
+ *
+ * @return The {@link ServicesRegistry} or null if not found.
+ * @throws ServiceException
+ * If an error occurs.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ServicesRegistry getServiceRegistryChecked() throws ServiceException {
+ // Lookup ServiceRegistry
+ IMultiDiagramEditor editor = getMultiDiagramEditor();
+ if(editor == null) {
+ throw new ServiceException("Can't get ServiceRegistry");
+ }
+
+ return (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ }
+
+ /**
+ * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
+ * possible. <br>
+ * This method return null if the ServiceRegistry can not be found or if an
+ * error occur. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null. <br>
+ *
+ * @return the ISashWindowsContentProvider from the main editor or null if
+ * not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ISashWindowsContentProvider getISashWindowsContentProvider() {
+
+ try {
+ return getServiceRegistryChecked().getService(ISashWindowsContentProvider.class);
+ } catch (ServiceException e) {
+ // The contract says that we return null if not found
+ return null;
+ }
+ }
+
+ /**
+ * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
+ * possible. <br>
+ * This method return null if the ServiceRegistry can not be found or if an
+ * error occur. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null.
+ *
+ * @return the ISashWindowsContentProvider from the main editor or null if
+ * not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ public static IPageMngr getIPageMngr() {
+
+ try {
+ return getServiceRegistryChecked().getService(IPageMngr.class);
+ } catch (ServiceException e) {
+ // The contract says that we return null if not found
+ return null;
+ }
+ }
+
+ /**
+ * Get the Eclipse ActiveEditor.
+ *
+ * @return The active {@link CoreMultiDiagramEditor} or null if not found.
+ * @deprecated Use {@link EditorUtils#getMultiDiagramEditor()}
+ */
+ @Deprecated
+ protected static IEditorPart getWorkbenchActiveEditor() {
+ IMultiDiagramEditor editorPart = getMultiDiagramEditor();
+ if(editorPart instanceof CoreMultiDiagramEditor) {
+ return editorPart;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
+ * editor, if possible, or throw an exception if not possible. <br>
+ * WARNING - This method throw an exception during the initialization of the
+ * main editor. This method throws an exception if there is no active
+ * editor, or if the editor is not instance of IMultiDiagramEditor. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ *
+ *
+ * @return Get the current {@link IMultiDiagramEditor} or null if not found.
+ * @throws BackboneException
+ * If it is not possible to get an instanceof {@link IMultiDiagramEditor}
+ */
+ public static IMultiDiagramEditor getMultiDiagramEditorChecked() throws BackboneException {
+ IEditorPart editor;
+ try {
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ } catch (NullPointerException e) {
+ // Can't get the active editor
+ throw new BackboneException("Can't get the current Eclipse Active Editor: There is no active editor at this time.");
+ }
+
+ if(editor instanceof IMultiDiagramEditor) {
+ return (IMultiDiagramEditor)editor;
+ } else {
+ throw new BackboneException("Can't get an Active Editor instance of IMultiDiagramEditor. (actual type:" + editor.getClass().getName() + ")");
+ }
+ }
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
index ed13e4a2bf1..be502649376 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
@@ -36,9 +36,15 @@ import org.eclipse.ui.PlatformUI;
*
* @author cedric dumoulin
*
+ * @deprecated 0.10: Use org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers instead
*/
+@Deprecated
public class ServiceUtilsForActionHandlers {
+ private ServiceUtilsForActionHandlers() {
+ //Singleton
+ }
+
private final static ServiceUtilsForActionHandlers instance = new ServiceUtilsForActionHandlers();
/**
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java
new file mode 100644
index 00000000000..c876d517f32
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * 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.core.utils;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * A ServiceUtils implementation for manipulating the Papyrus services from an IWorkbenchPage
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ServiceUtilsForWorkbenchPage extends AbstractServiceUtils<IWorkbenchPage> {
+
+ @Override
+ public ServicesRegistry getServiceRegistry(IWorkbenchPage from) throws ServiceException {
+ if(from instanceof IAdaptable) {
+ ServicesRegistry registry = (ServicesRegistry)((IAdaptable)from).getAdapter(ServicesRegistry.class);
+ if(registry != null) {
+ return registry;
+ }
+ }
+
+ throw new ServiceException("Cannot resolve the ServiceRegistry from the IWorkbenchPage");
+ }
+
+ public static ServiceUtilsForWorkbenchPage getInstance() {
+ return instance;
+ }
+
+ private static ServiceUtilsForWorkbenchPage instance = new ServiceUtilsForWorkbenchPage();
+
+ private ServiceUtilsForWorkbenchPage() {
+ //Singleton
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
index cd3a8848ef5..c46f9003133 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
@@ -5,7 +5,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
org.eclipse.core.commands;bundle-version="3.6.1",
org.eclipse.ui,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.common;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"
Export-Package: org.eclipse.papyrus.infra.emf.diagram.common,
org.eclipse.papyrus.infra.emf.diagram.common.handler
Bundle-Vendor: %providerName
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
index ccd6c04cbc2..13aa1f4e3ce 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.diagram.common;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -27,6 +28,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -42,6 +45,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
index 215a8de4887..ced77247413 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
@@ -22,7 +22,12 @@ import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
+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.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
/**
@@ -43,14 +48,25 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
* @return
* @throws ExecutionException
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+ final ServicesRegistry registry;
+
+ TransactionalEditingDomain editingDomain;
+
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
- TransactionalEditingDomain editingDomain = getEditingDomain();
RecordingCommand command = new RecordingCommand(editingDomain, "Create EMF Diagram") {
@Override
protected void doExecute() {
- addNewDiagram();
+ addNewDiagram(registry);
}
};
@@ -62,7 +78,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
/**
* Subclasses should implements this method.
*/
- protected abstract void addNewDiagram();
+ protected abstract void addNewDiagram(ServicesRegistry registry);
/**
* Add a new Diagram to the graphical model.
@@ -71,7 +87,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
* The diagram to add to graphical model. This will be the diagram provided to
* {@link IPluggableEditorFactory#createIPageModel(Object, org.eclipse.papyrus.infra.core.services.ServicesRegistry)}
*/
- protected void addNewDiagram(String name, String type, EObject diagram) {
+ protected void addNewDiagram(String name, String type, EObject diagram, ServicesRegistry registry) {
// TODO Create a special node inside the sash model (di) instead of introducing
// a dependence on notation.
@@ -91,15 +107,11 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
// Attach to sash in order to show it
// Add the diagram as a page to the current sash folder
- EditorUtils.getISashWindowsContentProvider().addPage(di2Diagram);
+ try {
+ registry.getService(ISashWindowsContentProvider.class).addPage(di2Diagram);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
- /**
- * Get the main editing doamin.
- *
- * @return
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return EditorUtils.getTransactionalEditingDomain();
- }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
index cdf12500169..4cfd540edf1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
@@ -16,7 +16,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.efacet.core;bundle-version="0.2.0",
org.eclipse.emf.facet.custom.core;bundle-version="0.2.0",
org.eclipse.emf.facet.custom.ui;bundle-version="0.2.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;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.emf.editor.part,
org.eclipse.papyrus.infra.emf.editor.providers
Bundle-Vendor: Eclipse Modeling Project
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
index 2699370af49..12280dfe151 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
@@ -1,12 +1,7 @@
package org.eclipse.papyrus.infra.emf.editor;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
-import org.eclipse.emf.facet.infra.browser.custom.core.CustomizationsCatalog;
import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -23,6 +18,8 @@ public class Activator extends AbstractUIPlugin {
private CustomizationManager fCustomizationManager;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -38,6 +35,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
@@ -65,28 +63,29 @@ public class Activator extends AbstractUIPlugin {
* @return the customization manager in charge to adapt element in modisco
*/
public CustomizationManager getCustomizationManager() {
- if(this.fCustomizationManager == null) {
- this.fCustomizationManager = new CustomizationManager();
- init(this.fCustomizationManager);
- }
- return this.fCustomizationManager;
+ return org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
+ // if(this.fCustomizationManager == null) {
+ // this.fCustomizationManager = new CustomizationManager();
+ // init(this.fCustomizationManager);
+ // }
+ // return this.fCustomizationManager;
}
- private void init(final CustomizationManager customizationManager) {
- customizationManager.setShowContainer(false);
- customizationManager.setShowDerivedLinks(false);
- customizationManager.setShowEmptyLinks(false);
-
- try {
- List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
- for(MetamodelView metamodelView : registryDefaultCustomizations) {
- customizationManager.registerCustomization(metamodelView);
- }
-
- customizationManager.loadCustomizations();
- } catch (Throwable e) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
- }
- }
+ // private void init(final CustomizationManager customizationManager) {
+ // customizationManager.setShowContainer(false);
+ // customizationManager.setShowDerivedLinks(false);
+ // customizationManager.setShowEmptyLinks(false);
+ //
+ // try {
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ // customizationManager.registerCustomization(metamodelView);
+ // }
+ //
+ // customizationManager.loadCustomizations();
+ // } catch (Throwable e) {
+ // Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ // }
+ // }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
index ac3b8b43ccc..cc4ef76ef56 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
@@ -15,7 +15,6 @@ import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory
import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
-import org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider;
import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
import org.eclipse.emf.transaction.TransactionalCommandStack;
import org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl;
@@ -24,13 +23,18 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.editor.Activator;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoDropAdapter;
import org.eclipse.papyrus.infra.emf.editor.providers.CustomizableContentProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
@@ -73,6 +77,11 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
*/
protected IPropertySheetPage iPropertySheetPage;
+ /**
+ * The services registry associated to this editor
+ */
+ protected ServicesRegistry registry;
+
@Override
public void createPages() {
// Creates the model from the editor input
@@ -91,6 +100,16 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
Composite parent = new Composite(gParent, SWT.NONE);
parent.setLayout(new PropertiesLayout());
+ // try {
+ // registry = new ServicesRegistry();
+ // registry.add(LabelProviderService.class, 1, new LabelProviderServiceImpl());
+ // registry.add(ServiceUtilsForResourceInitializerService.class, 1, new ServiceUtilsForResourceInitializerService());
+ // //registry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ // registry.startRegistry();
+ // } catch (ServiceException ex) {
+ // Activator.log.error(ex);
+ // }
+
// Only creates the other pages if there is something that can be edited
//
if(!getEditingDomain().getResourceSet().getResources().isEmpty()) {
@@ -249,7 +268,20 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
}
protected ILabelProvider createLabelProvider() {
- return new CustomizableModelLabelProvider(getCustomizationManager());
+ LabelProviderService service = new LabelProviderServiceImpl();
+ try {
+ service.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return new LabelProvider();
+ }
+ return service.getLabelProvider();
+ // try {
+ // return registry.getService(LabelProviderService.class).getLabelProvider();
+ // } catch (ServiceException ex) {
+ // Activator.log.error(ex);
+ // return new LabelProvider();
+ // }
}
public void commandStackChanged(EventObject event) {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
index e41d2e0ced8..5bb2bedeede 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
@@ -22,10 +22,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.util.emf.core,
com.ibm.icu;bundle-version="4.4.2",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0"
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400"
Export-Package: org.eclipse.papyrus.infra.emf,
org.eclipse.papyrus.infra.emf.commands,
org.eclipse.papyrus.infra.emf.databinding,
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
index cf05a5ea7c8..b03ffe1f2f2 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
@@ -21,12 +21,12 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
index c65b67a7b70..4b8190009c1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
@@ -15,7 +15,7 @@ import java.util.Iterator;
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 LabelProvider which only accepts EMF Objects (EObject, or objects which can be adapted to EObjects)
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
index 0186df0b430..1358287b040 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
@@ -37,11 +37,11 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
import org.eclipse.papyrus.infra.widgets.providers.PatternViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
index c3f8d98febc..5092eedd06d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
index b22afa83745..723454b1b4a 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
@@ -53,31 +53,11 @@ public class MoDiscoContentProvider extends CustomizableModelContentProvider {
@Override
public Object[] getChildren(final Object parentElement) {
- ArrayList<Object> result = new ArrayList<Object>();
-
- Object[] arrayObject = super.getChildren(parentElement);
- if(arrayObject != null) {
- for(int i = 0; i < arrayObject.length; i++) {
- result.add(arrayObject[i]);
- }
+ Object[] children = super.getChildren(parentElement);
+ if(children == null) {
+ return new Object[0];
}
- /**
- * Refactoring with bug 358732
- */
- //
- // if (parentElement instanceof IAdaptable) {
- // EObject eObject = (EObject)((IAdaptable)parentElement).getAdapter(EObject.class);
- // if(eObject !=null) {
- // List<Diagram> diagramList = findAllExistingDiagrams(eObject);
- // Iterator<Diagram> iterator = diagramList.iterator();
- // while (iterator.hasNext()) {
- // result.add(iterator.next());
- // }
- // }
- //
- // }
-
- return result.toArray();
+ return children;
}
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
deleted file mode 100644
index 8de88a60d54..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
+++ /dev/null
@@ -1,206 +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:
- * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Support for AdaptableContentProvider
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.emf.providers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.facet.infra.browser.uicore.internal.model.BigListItem;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-
-/**
- * This is a modisco content provider on which we can parameter the root element
- *
- * @deprecated Use SemanticUMLContentProvider instead
- */
-@Deprecated
-public class ModelContentProvider extends MoDiscoContentProvider implements IStaticContentProvider, IAdaptableContentProvider {
-
- /**
- * the root element of the tree explorer
- */
- protected EObject semanticRoot = null;
-
-
- /**
- * The StructuredViewer on which this content provider is applied
- */
- protected StructuredViewer viewer;
-
- public ModelContentProvider(EObject semanticRoot) {
- this.semanticRoot = semanticRoot;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object[] getElements() {
- return super.getElements(EditorUtils.getMultiDiagramEditor().getServicesRegistry());
- }
-
- @Override
- public EObject[] getRootElements(Object inputElement) {
- //if the semantic root is null, we use the default behavior
- if(semanticRoot == null) {
- return super.getRootElements(inputElement);
- } else {
- //we call the super, to ensure that all variable are initialized
- super.getRootElements(inputElement);
- EObject[] eobjectArray = { semanticRoot };
- return eobjectArray;
- }
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(viewer instanceof StructuredViewer) {
- this.viewer = (StructuredViewer)viewer;
- } else {
- this.viewer = null;
- }
- }
-
- public Object getAdaptedValue(Object selection) {
- if(selection instanceof IAdaptable) {
- EObject adapted = (EObject)((IAdaptable)selection).getAdapter(EObject.class);
- if(adapted != null) {
- return adapted;
- }
- }
- return selection;
- }
-
- public Object getContainerValue(Object selection) {
- if(selection instanceof EObject && viewer != null) {
- Object root = viewer.getInput();
- List<Object> rootElements = Arrays.asList(((ITreeContentProvider)viewer.getContentProvider()).getElements(root));
- List<Object> path = searchPath((EObject)selection, rootElements, new HashSet<Object>());
- if(!path.isEmpty()) {
- Object treeElement = path.get(path.size() - 1);
- return treeElement;
- }
- }
- return selection;
- }
-
- /**
- * look for the path the list of element (comes from the content provider) to go the eObject
- *
- * @param eobject
- * that we look for.
- * @param wrappers
- * a list of elements where eobject can be wrapped.
- * @param visitedElements
- * this parameters maintains the list of visited semantic elements,
- * to avoid infinite loops in infinite trees
- * @return the list of modelElementItem ( from the root to the element that wrap the eobject)
- */
- protected List<Object> searchPath(EObject lookFor, List<Object> wrappers, Set<Object> visitedElements) {
-
- if(lookFor == null) {
- return Collections.emptyList();
- }
- SemanticFromModelExplorer semanticGetter = new SemanticFromModelExplorer();
- List<Object> path = new ArrayList<Object>();
-
- for(Object wrapper : wrappers) {
- Object semanticElement = semanticGetter.getSemanticElement(wrapper);
- if(visitedElements.contains(semanticElement)) {
- continue;
- }
-
- if(!(semanticElement instanceof EReference)) {
- // Don't mark references themselves as visited, as they are meta-level singletons that should always be re-visited.
- visitedElements.add(semanticElement);
- }
-
- if(!isVisible(wrapper)) {
- continue;
- }
-
- // Search matches in this level
- if(!(wrapper instanceof Diagram) && wrapper instanceof IAdaptable) {
- if(lookFor.equals(semanticElement)) {
- path.add(wrapper);
- return path;
- }
- }
-
- // Find childs only for feature container and BigListItems
- //FIXME : Actually, we currently browse all references. We should only browse containment references
- //and a few specific references (To be determined by implementers, such as importPackage for UML)
- Object[] children = getChildren(wrapper);
- for(Object treeItem : children) {
- List<Object> tmppath = new ArrayList<Object>();
- if(treeItem instanceof BigListItem) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- } else {
- //can be change into IADAPTER by using new API of modisco
- Object element = semanticGetter.getSemanticElement(treeItem);
- if(element != null) {
- if(element instanceof EReference) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- } else if(element instanceof EObject) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- }
- }
- }
-
- // if tmppath contains the wrapped eobject we have find the good path
- if(tmppath.size() > 0) {
- if(tmppath.get(tmppath.size() - 1) instanceof IAdaptable) {
- if(lookFor.equals(semanticGetter.getSemanticElement(tmppath.get(tmppath.size() - 1)))) {
- path.add(wrapper);
- path.addAll(tmppath);
- return path;
- }
- }
- }
- }
- }
-
- return new ArrayList<Object>();
- }
-
- protected boolean isVisible(Object wrapper) {
- for(ViewerFilter filter : viewer.getFilters()) {
- if(!filter.select(viewer, null, wrapper)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
index c1e33a2c576..51d5774252f 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
@@ -27,7 +27,7 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java
deleted file mode 100644
index d85de9eb65a..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
- * 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.emf.providers.strategy;
-
-import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
-
-/**
- * @author Camille Letavernier
- *
- * @deprecated This class has been moved to infra.widgets
- */
-@Deprecated
-public class StrategyBasedContentProvider extends org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider {
-
- public StrategyBasedContentProvider(TreeBrowseStrategy browseStrategy, TreeBrowseStrategy revealStrategy) {
- super(browseStrategy, revealStrategy);
- }
-
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
index d2a60c27909..d3d919225bd 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
@@ -18,8 +18,8 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
new file mode 100644
index 00000000000..e905a18e661
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * 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.emf.utils;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * ServicesUtils based on the Handler's ExecutionEvent
+ *
+ * It first tests the current selection, then the IWorkbenchPart on which the handler is executed.
+ * The IWorkbenchPart is expected to be adaptable to a ServiceRegistry.
+ *
+ * @author Camille Letavernier
+ *
+ * @see ServiceUtilsForSelection
+ */
+public class ServiceUtilsForHandlers extends AbstractServiceUtils<ExecutionEvent> {
+
+ private ServiceUtilsForHandlers() {
+ //Singleton
+ }
+
+ @Override
+ public ServicesRegistry getServiceRegistry(ExecutionEvent from) throws ServiceException {
+ Object context = from.getApplicationContext();
+ if(context instanceof IEvaluationContext) {
+ IEvaluationContext evaluationContext = (IEvaluationContext)context;
+ Object selection = evaluationContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+
+ ServicesRegistry registry;
+
+ //First, try to resolve the ServicesRegistry from the current selection
+ if(selection instanceof ISelection && !((ISelection)selection).isEmpty()) {
+ try {
+ registry = ServiceUtilsForSelection.getInstance().getServiceRegistry((ISelection)selection);
+ if(registry != null) {
+ return registry;
+ }
+ } catch (ServiceException ex) {
+ //Ignore and try another ServiceUtils
+ }
+ }
+
+ //We couldn't retrieve the ServiceRegistry from the current selection.
+
+ //Try to adapt the current part to the ServicesRegistry
+ IWorkbenchPart part = (IWorkbenchPart)evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
+ if(part instanceof IAdaptable) {
+ registry = (ServicesRegistry)((IAdaptable)part).getAdapter(ServicesRegistry.class);
+ if(registry != null) {
+ return registry;
+ }
+ }
+ }
+
+ throw new ServiceNotFoundException("The ServiceRegistry cannot be resolved");
+ }
+
+ public static ServiceUtilsForHandlers getInstance() {
+ return instance;
+ }
+
+ private static final ServiceUtilsForHandlers instance = new ServiceUtilsForHandlers();
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
new file mode 100644
index 00000000000..729668d4160
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * 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.emf.utils;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
+
+/**
+ * ServiceUtils based on an ISelection.
+ *
+ * Expects an IStructuredSelection containing at least one EObject (It then relies on ServiceUtilsForEObject to retrieve the ServicesRegistry)
+ *
+ * @author Camille Letavernier
+ */
+public class ServiceUtilsForSelection extends AbstractServiceUtils<ISelection> {
+
+ private ServiceUtilsForSelection() {
+ //Singleton
+ }
+
+ private static ServiceUtilsForSelection instance = new ServiceUtilsForSelection();
+
+ public static ServiceUtilsForSelection getInstance() {
+ return instance;
+ }
+
+ @Override
+ public ServicesRegistry getServiceRegistry(ISelection from) throws ServiceException {
+ if(from instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection)from;
+ Iterator<?> selectionIterator = selection.iterator();
+ while(selectionIterator.hasNext()) {
+ Object selectedElement = selectionIterator.next();
+ EObject selectedEObject = EMFHelper.getEObject(selectedElement);
+ if(selectedEObject != null) {
+ return ServiceUtilsForEObject.getInstance().getServiceRegistry(selectedEObject);
+ }
+ }
+ }
+
+ throw new ServiceException("Cannot retrieve the ServiceRegistry");
+ }
+
+}
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();
- }
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
index 47b08bc75b8..246eb2af498 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
@@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.facet.infra.query;bundle-version="0.1.0",
org.eclipse.emf.facet.infra.query.core;bundle-version="0.1.0",
org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
- org.eclipse.emf.facet.infra.browser.custom.core;bundle-version="0.1.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.papyrus.infra.tools;bundle-version="0.10.0";visibility:=reexport,
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
index 25ba04612ed..f9248c98c6f 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.emf.common.ui;bundle-version="2.7.0",
org.eclipse.papyrus.infra.onefile;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.core.log;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.export
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
index b12d5e4cd3b..32fe14d66de 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
@@ -139,7 +139,9 @@ public class ExportAllDiagrams {
try {
op.run(monitor);
} catch (InvocationTargetException e) {
+ Activator.log.error(e);
} catch (InterruptedException e) {
+ Activator.log.error(e);
}
return Status.OK_STATUS;
}
@@ -200,7 +202,7 @@ public class ExportAllDiagrams {
} catch (RollbackException e) {
}
} else {
- Activator.log("no transactional editing domain found", Status.WARNING);
+ Activator.log.warn("no transactional editing domain found");
}
List<Diagram> diagrams = new ArrayList<Diagram>();
@@ -219,7 +221,7 @@ public class ExportAllDiagrams {
newMonitor.worked(1);
export(new SubProgressMonitor(newMonitor, 9), diagrams);
} else {
- Activator.log(new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.ExportAllDiagrams_3));
+ Activator.log.warn(Messages.ExportAllDiagrams_3);
}
}
@@ -248,7 +250,7 @@ public class ExportAllDiagrams {
diagnostic.add(newDiagnostic);
} else {
- Activator.log(new Status(Status.INFO, Activator.PLUGIN_ID, message));
+ Activator.log.info(message);
}
}
@@ -341,7 +343,7 @@ public class ExportAllDiagrams {
}
} catch (SWTError e) {
String message = Messages.ExportAllDiagrams_9;
- Activator.log(new Exception(message, e));
+ Activator.log.error(message, new Exception(message, e));
}
} catch (Exception e) {
e.printStackTrace();
@@ -357,7 +359,8 @@ public class ExportAllDiagrams {
} catch (Throwable e) {
BasicDiagnostic newDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "", 0, String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString()), null); //$NON-NLS-1$
diagnostic.add(newDiagnostic);
- Activator.log(String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString()), IStatus.ERROR, e);
+ String errorMessage = String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString());
+ Activator.log.error(errorMessage, e);
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
index 0931cbbf080..1dafe8540c9 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
@@ -11,12 +11,9 @@
package org.eclipse.papyrus.infra.export.internal;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -36,6 +33,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -46,13 +45,16 @@ public class Activator extends AbstractUIPlugin {
/**
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
+ log = new LogHelper(this);
}
/**
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@@ -68,65 +70,6 @@ public class Activator extends AbstractUIPlugin {
}
/**
- * Log an IStatus
- *
- * @param status
- * Status of an operation
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Log a message with given level into the Eclipse log file
- *
- * @param message
- * the message to log
- * @param level
- * the message priority
- */
- public static void log(String message, int level) {
- IStatus status = null;
- status = new Status(level, PLUGIN_ID, IStatus.OK, message, null);
- log(status);
- }
-
- /**
- * Log a message with given level into the Eclipse log file
- *
- * @param message
- * the message to log
- * @param level
- * the message priority
- */
- public static void log(String message, int level, Throwable t) {
- IStatus status = null;
- status = new Status(level, PLUGIN_ID, IStatus.OK, message, t);
- log(status);
- }
-
- /**
- * Log an exception into the Eclipse log file
- *
- * @param e
- * the exception to log
- */
- public static void log(Throwable e) {
- Throwable loggedThrowable = e;
- if(loggedThrowable instanceof InvocationTargetException) {
- loggedThrowable = ((InvocationTargetException)loggedThrowable).getTargetException();
- }
-
- IStatus status = null;
- if(loggedThrowable instanceof CoreException) {
- status = ((CoreException)loggedThrowable).getStatus();
- } else {
- status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Error", loggedThrowable);
- }
- log(status);
- }
-
- /**
* Returns the active workbench shell
*
* @return the active workbench shell
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
index 0df2db68c4d..fbd0aaf6882 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
@@ -34,23 +34,21 @@ import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
/**
* this an helper to manage hyperlink document
- *
+ *
*/
-
public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
-
+
@Override
public HyperLinkObject getHyperLinkObject(EAnnotation eAnnotation) {
if(eAnnotation.getSource().equals(HyperLinkConstants.HYPERLINK_DOCUMENT)) {
HyperLinkDocument hyperLinkDocument = new HyperLinkDocument();
hyperLinkDocument.setHyperlinkDocument(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_DOCUMENT_LOCALIZATION));
hyperLinkDocument.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT));
- if(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION)!=null){
- boolean isDefaultNaviagation=Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION));
+ if(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION) != null) {
+ boolean isDefaultNaviagation = Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION));
hyperLinkDocument.setIsDefault(isDefaultNaviagation);
- }
- else{
+ } else {
hyperLinkDocument.setIsDefault(false);
}
@@ -59,18 +57,22 @@ public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
return null;
}
+
@Override
public RecordingCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperlinkObject) {
- if( hyperlinkObject instanceof HyperLinkDocument){
- HyperLinkDocument hyperLinkDocument= (HyperLinkDocument)hyperlinkObject;
- return new CreateHyperLinkDocumentCommand(domain, object, hyperLinkDocument.getTooltipText(), hyperLinkDocument.getHyperlinkDocument(),hyperlinkObject.getIsDefault());
+ if(hyperlinkObject instanceof HyperLinkDocument) {
+ HyperLinkDocument hyperLinkDocument = (HyperLinkDocument)hyperlinkObject;
+ return new CreateHyperLinkDocumentCommand(domain, object, hyperLinkDocument.getTooltipText(), hyperLinkDocument.getHyperlinkDocument(), hyperlinkObject.getIsDefault());
+ } else {
+ return null;
}
- else{return null;}
}
+
@Override
public String getNameofManagedHyperLink() {
return Messages.DocumentHyperLinkHelper_Document;
}
+
@Override
public void executeNewMousePressed(List<HyperLinkObject> list, EObject aModel) {
EditorHyperlinkDocumentShell editor = new EditorHyperlinkDocumentShell();
@@ -80,14 +82,14 @@ public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
}
}
-
+
@Override
public List<HyperLinkObject> getFilteredObject(List<HyperLinkObject> hyperlinkObjects) {
- ArrayList<HyperLinkObject> result= new ArrayList<HyperLinkObject>();
- Iterator<HyperLinkObject> iterator= hyperlinkObjects.iterator();
+ ArrayList<HyperLinkObject> result = new ArrayList<HyperLinkObject>();
+ Iterator<HyperLinkObject> iterator = hyperlinkObjects.iterator();
while(iterator.hasNext()) {
- HyperLinkObject hyperlinkObject = (HyperLinkObject)iterator.next();
- if(hyperlinkObject instanceof HyperLinkDocument){
+ HyperLinkObject hyperlinkObject = iterator.next();
+ if(hyperlinkObject instanceof HyperLinkDocument) {
result.add(hyperlinkObject);
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
index d298c905754..6354010cc2c 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
@@ -23,10 +23,9 @@ import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
import org.eclipse.papyrus.infra.hyperlink.messages.Messages;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
@@ -56,15 +55,15 @@ public class EditorHyperLinkHelper extends AbstractHyperLinkHelper {
*/
@Override
public void executeNewMousePressed(final List<HyperLinkObject> list, final EObject aModel) {
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ IPageIconsRegistry editorRegistry;
try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
+ editorRegistry = ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, aModel);
} catch (ServiceException e) {
Activator.log.error(e);
+ return;
}
EditorHyperLinkEditorShell editor = new EditorHyperLinkEditorShell(editorRegistry, aModel);
- editor.open();//TODO and the cancel?
+ editor.open();
if(editor.getHyperLinkEditor() != null) {
list.add(editor.getHyperLinkEditor());
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
index 637cd502085..c6e306f06ca 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
@@ -16,11 +16,9 @@ package org.eclipse.papyrus.infra.hyperlink.object;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
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.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
@@ -56,13 +54,14 @@ public class HyperLinkEditor extends HyperLinkObject {
*/
@Override
public void executeEditMousePressed(List<HyperLinkObject> list, EObject amodel) {
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ IPageIconsRegistry editorRegistry;
try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
+ editorRegistry = ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, amodel);
} catch (ServiceException e) {
Activator.log.error(e);
+ return;
}
+
EditorHyperLinkEditorShell editor = new EditorHyperLinkEditorShell(editorRegistry, amodel);
editor.setHyperLinkEditor(this);
editor.open();
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
index e95ea10fb97..a5087026772 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
@@ -35,7 +35,6 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
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.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -244,7 +243,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
diagramListTreeViewer.setLabelProvider(labelProvider);
- diagramListTreeViewer.setContentProvider(new EditorListContentProvider());
+ diagramListTreeViewer.setContentProvider(new EditorListContentProvider(model));
diagramListTreeViewer.setInput(" "); //$NON-NLS-1$
// add listner on the new button to display menu for each diagram
@@ -270,10 +269,18 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
IStructuredSelection iSelection = (IStructuredSelection)getModeFilteredTree().getViewer().getSelection();
- Iterator iterator = iSelection.iterator();
+ Iterator<?> iterator = iSelection.iterator();
+
+ IPageMngr pageManager;
+ try {
+ pageManager = ServiceUtilsForEObject.getInstance().getIPageMngr(model);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
while(iterator.hasNext()) {
- IPageMngr pageMngr = EditorUtils.getIPageMngr();
- pageMngr.removePage(iterator.next());
+ pageManager.removePage(iterator.next());
}
getDiagramfilteredTree().getViewer().setInput(null);
getDiagramfilteredTree().getViewer().setInput(""); //$NON-NLS-1$
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
index afaa710665b..9af9b1cab01 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
@@ -21,10 +21,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
@@ -204,13 +201,7 @@ public class HyperLinkTab extends AbstractHyperLinkTab {
downHyperLinkButton.setLayoutData(gridData3);
addListeners();
tableViewer.setContentProvider(contentProvider);
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
- try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
+
this.hyperlinkObjects = hyperLinkHelper.getFilteredObject(hyperlinkObjects);
ILabelProvider provider = null;
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
index fccf86c7c2e..ce121ef5984 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
@@ -16,20 +16,27 @@ package org.eclipse.papyrus.infra.hyperlink.util;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
/**
- * The Class DiagramContentProvider.
+ * The Class EditorListContentProvider.
*/
//TODO why a tree content provider
-//TODO : extends the label provider of the ModelExplorer to get the customization
public class EditorListContentProvider implements ITreeContentProvider {
+ //The context of the ContentProvider
+ private EObject model;
+
+ public EditorListContentProvider(EObject model) {
+ this.model = model;
+ }
+
/**
* {@inheritDoc}
*/
@@ -56,14 +63,14 @@ public class EditorListContentProvider implements ITreeContentProvider {
*/
public Object[] getElements(Object inputElement) {
try {
- IPageMngr iPageMngr = EditorUtils.getIPageMngr();
+ IPageMngr iPageMngr = ServiceUtilsForEObject.getInstance().getIPageMngr(model);
Object[] result = iPageMngr.allPages().toArray();
List<Object> res = new ArrayList<Object>();
for(Object current : result) {
- if(current != null /* && current instanceof PapyrusTableInstance */) {
-// if the model is a little bit corrupted, we can have a null element in the list
- res.add(current);
+ if(current != null /* && current instanceof PapyrusTableInstance */) {
+ // if the model is a little bit corrupted, we can have a null element in the list
+ res.add(current);
}
}
return res.toArray();
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
index 9a9eda9235f..14f141e322b 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
@@ -12,7 +12,7 @@
package org.eclipse.papyrus.infra.hyperlink.util;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
public class HyperLinkFilteredLabelProvider extends HyperLinkLabelProvider implements IFilteredLabelProvider {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
index ed7cfd2ebea..82d73a88f70 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
@@ -28,6 +28,7 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -37,7 +38,6 @@ import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.services.controlmode.commands.ControlCommand;
import org.eclipse.papyrus.infra.services.controlmode.util.ControlModeUtil;
@@ -127,6 +127,7 @@ public class PapyrusControlAction extends ControlAction {
/**
* {@inheritDoc}
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
@Override
public void run() {
// check if object selection is in the current model set. If not, warn the user and disable action
@@ -154,7 +155,7 @@ public class PapyrusControlAction extends ControlAction {
return;
}
try {
- ControlCommand transactionalCommand = new ControlCommand(EditorUtils.getTransactionalEditingDomain(), controlledModel, eObject, "Control", null);
+ ControlCommand transactionalCommand = new ControlCommand((TransactionalEditingDomain)getEditingDomain(), controlledModel, eObject, "Control", null);
IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if(status.isOK()) {
notifySave();
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
index 954d398e8e5..a53c73b3f06 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
@@ -23,13 +23,13 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.action.CommandActionHandler;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.UncontrolCommand;
import org.eclipse.papyrus.infra.services.controlmode.util.ControlModeUtil;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
@@ -103,6 +103,7 @@ public class PapyrusUncontrolAction extends CommandActionHandler {
/**
* {@inheritDoc}
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
@Override
public void run() {
// check if the uncontrol is made from the parent resource. If not, warn the user and disable action
@@ -119,7 +120,7 @@ public class PapyrusUncontrolAction extends CommandActionHandler {
try {
boolean confirmDelete = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Delete controlled resources?", "Delete the original controlled files ?");
- UncontrolCommand transactionalCommand = new UncontrolCommand(EditorUtils.getTransactionalEditingDomain(), eObject, "Uncontrol", null, confirmDelete);
+ UncontrolCommand transactionalCommand = new UncontrolCommand((TransactionalEditingDomain)getEditingDomain(), eObject, "Uncontrol", null, confirmDelete);
IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if(!status.isOK()) {
NotificationBuilder.createErrorPopup(status.getMessage()).setTitle("Unable to uncontrol").run();
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
index d3912d92a5c..b92e6808210 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
@@ -48,6 +48,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.commands.Activator;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.modelsetquery.ModelSetQuery;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -57,7 +58,8 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
import org.eclipse.papyrus.infra.core.sashwindows.di.exception.SashEditorException;
import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.IControlCommand.STATE_CONTROL;
@@ -115,8 +117,14 @@ public class ControlCommand extends AbstractTransactionalCommand {
addContext(new EditingDomainUndoContext(domain));
ResourceSet set = domain.getResourceSet();
- if (set instanceof ModelSet) {
- modelSet = (ModelSet) set;
+ if(set instanceof ModelSet) {
+ modelSet = (ModelSet)set;
+ } else {
+ try {
+ modelSet = ServiceUtilsForResource.getInstance().getModelSet(model);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
}
@@ -128,13 +136,11 @@ public class ControlCommand extends AbstractTransactionalCommand {
commands = getCommandExtensions();
IStatus status = doRedo(monitor, info);
CommandResult result;
- if (status.equals(Status.OK_STATUS)) {
- result = CommandResult.newOKCommandResult();
- }
- else if (status.equals(Status.CANCEL_STATUS)) {
+ if(status.equals(Status.OK_STATUS)) {
+ result = CommandResult.newOKCommandResult();
+ } else if(status.equals(Status.CANCEL_STATUS)) {
result = CommandResult.newErrorCommandResult("Unable to execute control command");
- }
- else {
+ } else {
result = CommandResult.newCancelledCommandResult();
}
return result;
@@ -156,10 +162,6 @@ public class ControlCommand extends AbstractTransactionalCommand {
*/
@Override
protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (modelSet == null) {
- modelSet = EditorUtils.getDiResourceSet();
- }
-
// Create the URI from models that will be created
final URI newNotationURI = URI.createURI(controlledModel.getURI().trimFileExtension().appendFileExtension(NotationModel.NOTATION_FILE_EXTENSION).toString());
this.controlledNotation = getResource(newNotationURI);
@@ -453,7 +455,7 @@ public class ControlCommand extends AbstractTransactionalCommand {
* @param parentURIFullPath
*/
protected void assignToChildExistingControledResources(EditingDomain domain, CompoundCommand compoundCommand, ControledResource child, String controledResourceURL, List<ControledResource> controledFromParent, String parentURL, URI controledURIFullPath, URI parentURIFullPath) {
- for(ControledResource r : controledFromParent) {
+ for(ControledResource r : controledFromParent) {
if(r.getResourceURL() != null) {
URI fullPathParent = URI.createURI(r.getResourceURL()).resolve(parentURIFullPath);
Resource resourceLoaded = modelSet.getResource(fullPathParent, false);
@@ -573,8 +575,8 @@ public class ControlCommand extends AbstractTransactionalCommand {
* @return
*/
protected Resource getHistoryResource(EObject eObject) {
- if (eObject.eResource() != null) {
- return modelSet.getResource(eObject.eResource().getURI().trimFileExtension().appendFileExtension(HistoryModel.MODEL_FILE_EXTENSION), true);
+ if(eObject.eResource() != null) {
+ return modelSet.getResource(eObject.eResource().getURI().trimFileExtension().appendFileExtension(HistoryModel.MODEL_FILE_EXTENSION), true);
}
return null;
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
index 4bbead67c09..5329e18168f 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
@@ -52,11 +52,13 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.commands.Activator;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.IUncontrolCommand.STATE_CONTROL;
@@ -118,7 +120,8 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
* @param label
* @param affectedFiles
* @param selectedObject
- * @param deleteUncontrolledResources whether to delete uncontrolled resources
+ * @param deleteUncontrolledResources
+ * whether to delete uncontrolled resources
*/
public UncontrolCommand(TransactionalEditingDomain domain, EObject selectedObject, String label, List<?> affectedFiles, boolean deleteUncontrolledResources) {
super(domain, label, affectedFiles);
@@ -128,10 +131,16 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
controlledResourceToRemove = new LinkedList<ControledResource>();
addedControlledResource = new LinkedList<ControledResource>();
deleteResources = deleteUncontrolledResources;
-
+
ResourceSet set = domain.getResourceSet();
- if (set instanceof ModelSet) {
- modelSet = (ModelSet) set;
+ if(set instanceof ModelSet) {
+ modelSet = (ModelSet)set;
+ } else {
+ try {
+ modelSet = ServiceUtilsForEObject.getInstance().getModelSet(selectedObject);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
}
@@ -143,13 +152,11 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
commands = getCommandExtensions();
IStatus status = doRedo(monitor, info);
CommandResult result;
- if (status.equals(Status.OK_STATUS)) {
- result = CommandResult.newOKCommandResult();
- }
- else if (status.equals(Status.CANCEL_STATUS)) {
+ if(status.equals(Status.OK_STATUS)) {
+ result = CommandResult.newOKCommandResult();
+ } else if(status.equals(Status.CANCEL_STATUS)) {
result = CommandResult.newErrorCommandResult("Unable to execute uncontrol command");
- }
- else {
+ } else {
result = CommandResult.newCancelledCommandResult();
}
return result;
@@ -179,10 +186,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
final URI newDiURI = URI.createURI(controlledModel.getURI().trimFileExtension().appendFileExtension(DiModel.DI_FILE_EXTENSION).toString());
this.controlledDI = getEditingDomain().getResourceSet().getResource(newDiURI, true);
}
- if (modelSet == null) {
- modelSet = EditorUtils.getDiResourceSet();
- }
-
+
CompoundCommand compoundCommand = new CompoundCommand();
uncontrolNotation(compoundCommand);
uncontrolModel(compoundCommand);
@@ -258,9 +262,9 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
for(Diagram diag : controlledDiagrams) {
uncontrol(getEditingDomain(), diag, controlledNotation, notationResource, compoundCommand, STATE_CONTROL.POST_NOTATION);
}
-
+
//uncontrol for PapyrusTable
- uncontrol(getEditingDomain(),eObject, controlledNotation, notationResource,compoundCommand, STATE_CONTROL.POST_NOTATION);
+ uncontrol(getEditingDomain(), eObject, controlledNotation, notationResource, compoundCommand, STATE_CONTROL.POST_NOTATION);
}
}
@@ -281,7 +285,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
newURL = HistoryUtils.resolve(uriPath, newURL);
oldURL = HistoryUtils.resolve(uriPath, oldURL);
Set<ControledResource> controledOldURL = new HashSet<ControledResource>(HistoryUtils.getControledResourcesForURL(modelSet, oldURL));
- controledOldURL.addAll(HistoryUtils.getControledResourcesForURL(modelSet, oldURL.substring(oldURL.lastIndexOf("/")+1,oldURL.length())));
+ controledOldURL.addAll(HistoryUtils.getControledResourcesForURL(modelSet, oldURL.substring(oldURL.lastIndexOf("/") + 1, oldURL.length())));
List<ControledResource> controledNewURL = HistoryUtils.getControledResourcesForURL(modelSet, newURL);
for(ControledResource resourceOldURL : controledOldURL) {
if(resourceOldURL.getChildren().isEmpty()) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
index 1c9b7d79b8b..f0b667b5904 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
@@ -13,13 +13,13 @@
package org.eclipse.papyrus.infra.services.decoration;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -192,8 +192,7 @@ public class DecorationService extends Observable implements IDecorationService
ImageDescriptor imageForME = infoUtil.getImageDescriptorForME(marker);
PreferedPosition position = infoUtil.getPreferedPosition(marker);
int priority = infoUtil.getPriority(marker);
- IPapyrusDecoration decoration =
- addDecoration(marker.toString(), marker.getType(), element, imageForGE, imageForME, position, infoUtil.getMessage(marker), priority);
+ IPapyrusDecoration decoration = addDecoration(marker.toString(), marker.getType(), element, imageForGE, imageForME, position, infoUtil.getMessage(marker), priority);
return decoration;
}
@@ -217,8 +216,8 @@ public class DecorationService extends Observable implements IDecorationService
* the decoration
* @param message
* the message
- * @param priority
- * the priority
+ * @param priority
+ * the priority
* @see org.eclipse.papyrus.infra.services.decoration.IDecorationService#addDecoration(java.lang.String, org.eclipse.emf.ecore.EObject,
* org.eclipse.jface.resource.ImageDescriptor, java.lang.String)
*/
@@ -228,8 +227,7 @@ public class DecorationService extends Observable implements IDecorationService
if(decoration == null) {
decoration = new Decoration(id, type, decorationImageForGE, decorationImageForME, message, element, priority);
decorations.put(id, decoration);
- }
- else {
+ } else {
decoration.setDecorationImageForGE(decorationImageForGE);
decoration.setDecorationImageForME(decorationImageForME);
decoration.setMessage(message);
@@ -251,7 +249,7 @@ public class DecorationService extends Observable implements IDecorationService
* @return the decoration
* @see org.eclipse.papyrus.infra.services.decoration.IDecorationService#getDecoration(java.lang.Object, boolean)
*/
- public EList<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents) {
+ public List<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents) {
DecorationUtils tool = new DecorationUtils(element);
tool.tryChildIfEmpty();
if(tool.getEObject() != null) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
index 98233257e1c..5502c2eb696 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
@@ -12,9 +12,9 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.services.decoration;
+import java.util.List;
import java.util.Observer;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.services.IService;
@@ -106,5 +106,5 @@ public interface IDecorationService extends IService {
* the navigate to parents
* @return the decoration
*/
- EList<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents);
+ List<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents);
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
index 8c55b7e092b..6eaee24ab8d 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
@@ -14,7 +14,8 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.services.decoration.util;
-import org.eclipse.emf.common.util.EList;
+import java.util.List;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IDecoration;
@@ -257,7 +258,7 @@ public class Decoration implements IPapyrusDecoration {
}
}
- public static String getMessageFromDecorations(EList<IPapyrusDecoration> decorations) {
+ public static String getMessageFromDecorations(List<IPapyrusDecoration> decorations) {
String message = "";
if(decorations != null) {
for(IPapyrusDecoration decoration : decorations) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
index 52de8310ac5..e2ff4eb6f53 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf;bundle-version="2.6.0",
org.eclipse.emf.common.ui;bundle-version="2.7.0",
org.eclipse.emf.common;bundle-version="2.8.0",
- org.eclipse.core.resources;bundle-version="3.8.1",
+ org.eclipse.core.resources;bundle-version="3.8.0",
org.eclipse.gef;bundle-version="3.8.1",
org.eclipse.emf.ecore,
org.eclipse.papyrus.infra.services.resourceloading;bundle-version="0.10.0"
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
index 26d15080700..f551bc27ecd 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
@@ -49,8 +49,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -58,7 +56,6 @@ import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
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.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.table.common.Activator;
@@ -368,22 +365,13 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
}
/**
- * Get the current MultiDiagramEditor.
- *
- * @return
- * @throws BackboneException
- */
- protected IMultiDiagramEditor getMultiDiagramEditor() throws BackboneException {
- return EditorUtils.getMultiDiagramEditorChecked();
- }
-
- /**
* Returns the context used to create the table
*
* @return
* the context used to create the table or <code>null</code> if not found
* @throws ServiceException
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
protected EObject getTableContext() {
List<EObject> selection = getSelection();
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
index b8e0eec2788..8f474a2549a 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
@@ -13,8 +13,8 @@ package org.eclipse.papyrus.infra.table.common.providers;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
/**
* A Filter Label Provider for {@link PapyrusTableInstance}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
index 010338a069e..c0a41845d41 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.infra.table.modelexplorer.queries;
import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
@@ -27,6 +26,6 @@ public class GetTableIcon extends AbstractGetEditorIconQuery implements IJavaMod
* {@inheritDoc}
*/
public String evaluate(final PapyrusTableInstance 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/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java
deleted file mode 100644
index 0180c47d610..00000000000
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*****************************************************************************
- * 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.widgets.providers;
-
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An ExtensibleLabelProvider encapsulates a set of LabelProviders. Each LabelProvider handles only a few kind of elements.
- * The ExtensibleLabelProvider retrieves the most appropriate LabelProvider for each object.
- *
- * When more than one LabelProvider match an element, the one with the smaller priority is used.
- *
- * @author Camille Letavernier
- *
- */
-public class ExtensibleLabelProvider implements ILabelProvider, ILabelProviderListener {
-
- private final Set<ILabelProviderListener> listeners;
-
- private final SortedMap<Integer, List<IFilteredLabelProvider>> providers;
-
- private final ILabelProvider defaultProvider;
-
- public ExtensibleLabelProvider() {
- listeners = new LinkedHashSet<ILabelProviderListener>();
- providers = new TreeMap<Integer, List<IFilteredLabelProvider>>();
-
- defaultProvider = new LabelProvider();
- }
-
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- public void dispose() {
- listeners.clear();
- for(List<IFilteredLabelProvider> filteredProviders : providers.values()) {
- for(IFilteredLabelProvider provider : filteredProviders) {
- provider.dispose();
- }
- }
- providers.clear();
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
-
- public void registerProvider(int priority, IFilteredLabelProvider provider) {
- getProviders(priority).add(provider);
- provider.addListener(this);
- }
-
- public Image getImage(Object element) {
- return getProvider(element).getImage(element);
- }
-
- public String getText(Object element) {
- return getProvider(element).getText(element);
- }
-
- protected final ILabelProvider getProvider(Object element) {
- for(List<IFilteredLabelProvider> filteredProviders : providers.values()) {
- for(IFilteredLabelProvider provider : filteredProviders) {
- if(provider.accept(element)) {
- return provider;
- }
- }
- }
-
- return defaultProvider;
- }
-
- protected final List<IFilteredLabelProvider> getProviders(int priority) {
- if(!providers.containsKey(priority)) {
- providers.put(priority, new LinkedList<IFilteredLabelProvider>());
- }
-
- return providers.get(priority);
- }
-
- /**
- * {@inheritDoc}
- *
- * Forwards the event to each listener
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- for(ILabelProviderListener listener : listeners) {
- listener.labelProviderChanged(event);
- }
- }
-}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java
deleted file mode 100644
index 90a39fa6d3a..00000000000
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java
+++ /dev/null
@@ -1,20 +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.widgets.providers;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-
-
-public interface IDetailLabelProvider extends ILabelProvider {
-
- public String getDetail(Object object);
-}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java
deleted file mode 100644
index 1d7dfb56763..00000000000
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java
+++ /dev/null
@@ -1,24 +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.widgets.providers;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-
-/**
- * A LabelProvider which only accepts a specific set of objects
- *
- * @author Camille Letavernier
- */
-public interface IFilteredLabelProvider extends ILabelProvider {
-
- public boolean accept(Object element);
-}

Back to the top