Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-01-17 17:27:59 +0000
committerChristian W. Damus2016-01-22 15:57:11 +0000
commitb089eab1fca586752027404cc398a173237337f8 (patch)
tree3d5f106bd6ba19ab6364284dec8cd34341cfd758 /extraplugins/layers
parente8587f9c60ed458d6daee5128186f5b1ee54ac00 (diff)
downloadorg.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.tar.gz
org.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.tar.xz
org.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Move UI-dependent APIs from the org.eclipse.papyrus.infra.tools bundle to org.eclipse.papyrus.infra.ui. Accordingly move tests into a new org.eclipse.papyrus.infra.ui.tests bundle. Two crucial UI dependencies are inverted by introduction of new OSGi services with core interfaces specified in the non-UI layer: * IExecutorService extends Java Platform's ExecutorService with APIs for synchronous execution (a la Display.syncExec). A new CoreExecutors class in the infra.tools bundle supplies the instance provided by the OSGi service implementation in the infra.ui bundle. This provides compatibility for clients of various UIUtil APIs that they can no longer access * IContextualServiceRegistryTracker abstracts the concept of the default ServicesRegistry found in the currently active editor, which the ServiceUtilsForHandlers class (and hence all of its clients) relies on. Again an OSGi service implementation in the infra.ui bundle supplies the implementation of this tracker, which is exposed in infra.core through the service-utils API Also move UI-dependent APIs from the org.eclipse.papyrus.infra.core bundle into org.eclipse.papyrus.infra.ui. This includes * moving the 'papyrusDiagram' and 'papyrusContentOutline' extension points into the org.eclipse.papyrus.infra.ui namespace * moving various UI-related services such as EditorLifeycleManager, SaveLayoutBeforeClose, and the IMultiDiagramEditor, itself, into the org.eclipse.papyrus.infra.ui bundle This necessitates not only widespread refactorings on the moved APIs, but also concomitant move of other APIs in other bundles because they cannot plausibly use these moved APIs from their new home in org.eclipse.papyrus.infra.ui and/or they cannot reasonably also be moved to the UI bundle and/or they must be used by bundles that now have no UI dependency: * the DI/sash-windows EMF model is moved out of infra.core.sasheditor.di bundle into a new model-only org.eclipse.papyrus.infra.sashwindows.di bundle (which symbolic name incidentally now better reflects the contained Java package names) * the IPageManager and ILocalPageService interfaces are moved out of infra.core.sasheditor.di bundle because they need to remain accessible by headless code such as the edit advices that ensure deletion of sash-model pages for notations that are deleted. These are now in a package named org.eclipse.papyrus.infra.code.sashwindows.di.service. Accordingly the class hierarchy implementing the IPageManager interface is changed: the obsolete PageMngrImpl is deleted, replaced by a BasicPageManagerImpl which now the PageManagerImpl extends. A service factory creates the basic page manager in a headless context, but is overridden by the UI-aware implementation when the UI bundles are installed * the MultiDiagramEditorGefDelegate (which has a GEF 3 dependency) is moved from the org.eclipse.papyrus.infra.core.sasheditor bundle to a new org.eclipse.papyrus.infra.gmfdiag.gef bundle. Its usage for an adapter of ActionRegistry type is extracted out of the CoreMultiDiagramEditor class into a new external adapter-factory in the infra.gmfdiag.gef bundle Tests all still pass (inasmuch as they do in the nightly master builds). Change-Id: I573dee5d9312d6e5746d74575350d0152b591ab3
Diffstat (limited to 'extraplugins/layers')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.runtime/plugin.xml2
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/META-INF/MANIFEST.MF4
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/plugin.xml2
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/LayersTreeDiagramEditorFactory.java10
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/ui/handlers/AbstractLayerCommand.java8
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayerStackCommand.java8
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayersCommand.java10
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/AttachDiagramSelectedItemsToCurrentLayer.java10
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/RemoveDiagramSelectedItemsFromCurrentLayer.java10
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/utils/HandlersUtils.java10
11 files changed, 52 insertions, 25 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/plugin.xml b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/plugin.xml
index ca048cf167d..32045824c04 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/plugin.xml
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/plugin.xml
@@ -22,7 +22,7 @@
serviceKeyRef="org.eclipse.papyrus.infra.core.resource.ModelSet">
</dependsOn>
<dependsOn
- serviceKeyRef="org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor">
+ serviceKeyRef="org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor">
</dependsOn>
</service>
</extension>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/META-INF/MANIFEST.MF
index 5d9f0e07ce1..d694738bda1 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/META-INF/MANIFEST.MF
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/META-INF/MANIFEST.MF
@@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gmf.runtime.diagram.ui.resources.editor,
org.eclipse.papyrus.layers.runtime;bundle-version="1.2.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0",
- org.eclipse.ui.ide;bundle-version="3.10.0"
+ org.eclipse.ui.ide;bundle-version="3.10.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/plugin.xml b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/plugin.xml
index a4f04ed27ce..27d41b758c3 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/plugin.xml
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension
- point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ point="org.eclipse.papyrus.infra.ui.papyrusDiagram">
<editorDiagram
actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
contextId="defaultContext"
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/LayersTreeDiagramEditorFactory.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/LayersTreeDiagramEditorFactory.java
index b5dbd4e2f73..6e9bf121f1d 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/LayersTreeDiagramEditorFactory.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/LayersTreeDiagramEditorFactory.java
@@ -15,13 +15,13 @@ package org.eclipse.papyrus.layers.stackmodel.diagram;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.EditorDescriptor;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.IPluggableEditorFactory;
-import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.ui.extension.diagrameditor.EditorDescriptor;
+import org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory;
+import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
@@ -71,7 +71,7 @@ public class LayersTreeDiagramEditorFactory implements IPluggableEditorFactory {
/**
* TODO Implements next methods
*
- * @see org.eclipse.papyrus.infra.core.extension.diagrameditor.IPluggableEditorFactory#createIPageModel(java.lang.Object)
+ * @see org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory#createIPageModel(java.lang.Object)
* @param pageIdentifier
* @return
*
@@ -83,7 +83,7 @@ public class LayersTreeDiagramEditorFactory implements IPluggableEditorFactory {
/**
*
- * @see org.eclipse.papyrus.infra.core.extension.diagrameditor.IPluggableEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ * @see org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory#isPageModelFactoryFor(java.lang.Object)
* @param pageIdentifier
* @return
*
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/ui/handlers/AbstractLayerCommand.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/ui/handlers/AbstractLayerCommand.java
index 99044e3a409..1a9b80dc549 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/ui/handlers/AbstractLayerCommand.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.diagram/src/org/eclipse/papyrus/layers/stackmodel/diagram/ui/handlers/AbstractLayerCommand.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +8,8 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
package org.eclipse.papyrus.layers.stackmodel.diagram.ui.handlers;
@@ -21,6 +24,7 @@ import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext;
import org.eclipse.papyrus.layers.runtime.NotationDiagramHelper;
@@ -220,7 +224,7 @@ public abstract class AbstractLayerCommand extends AbstractHandler {
// Get page from the event !
// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
if (!(editor instanceof DiagramDocumentEditor)) {
throw new NotFoundException("Selected editor do not contains Diagram");
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.ui/META-INF/MANIFEST.MF
index b8865fb8b5d..d2c4761141a 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/META-INF/MANIFEST.MF
@@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="1.2.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.layers.stackmodel.edit;bundle-version="1.2.0"
+ org.eclipse.papyrus.layers.stackmodel.edit;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayerStackCommand.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayerStackCommand.java
index 53d7d29ae5d..0abe0660f4a 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayerStackCommand.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayerStackCommand.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +8,8 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
package org.eclipse.papyrus.layers3.ui.commands;
@@ -21,6 +24,7 @@ import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext;
import org.eclipse.papyrus.layers.runtime.NotationDiagramHelper;
@@ -222,7 +226,7 @@ public abstract class AbstractLayerStackCommand extends AbstractHandler {
// Get page from the event !
// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
if (!(editor instanceof DiagramDocumentEditor)) {
throw new NotFoundException("Selected editor do not contains Diagram");
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayersCommand.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayersCommand.java
index ee1cb7d9ae4..967aa5e65a5 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayersCommand.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/commands/AbstractLayersCommand.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +8,8 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
package org.eclipse.papyrus.layers3.ui.commands;
@@ -26,6 +29,7 @@ import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocument
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext;
import org.eclipse.papyrus.layers.runtime.NotationDiagramHelper;
@@ -277,7 +281,7 @@ public abstract class AbstractLayersCommand extends AbstractHandler {
// Get page from the event !
// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
if (!(editor instanceof DiagramDocumentEditor)) {
throw new NotFoundException("Selected editor do not contains Diagram");
@@ -333,7 +337,7 @@ public abstract class AbstractLayersCommand extends AbstractHandler {
*/
protected Diagram lookupNotationDiagramChecked(IEvaluationContext context) throws NotFoundException, ServiceException {
- IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
if (!(editor instanceof DiagramDocumentEditor)) {
throw new NotFoundException("Selected editor do not contains Diagram"); //$NON-NLS-1$
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/AttachDiagramSelectedItemsToCurrentLayer.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/AttachDiagramSelectedItemsToCurrentLayer.java
index e261438ce65..85ef692b7a3 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/AttachDiagramSelectedItemsToCurrentLayer.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/AttachDiagramSelectedItemsToCurrentLayer.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +8,8 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
/**
*
@@ -27,6 +30,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext;
import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
@@ -141,7 +145,7 @@ public class AttachDiagramSelectedItemsToCurrentLayer extends AbstractLayersComm
// }
for (Object obj : structuredSelection.toList()) {
// Adapt the selected object to a View.
- View view = (View) Platform.getAdapterManager().getAdapter(obj, View.class);
+ View view = Platform.getAdapterManager().getAdapter(obj, View.class);
if (view != null) {
result.add(view);
}
@@ -162,7 +166,7 @@ public class AttachDiagramSelectedItemsToCurrentLayer extends AbstractLayersComm
IEditorPart editor;
try {
- editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
} catch (ServiceException e) {
throw new NotFoundException("Selected editor do not provides ServiceRegistry", e); //$NON-NLS-1$
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/RemoveDiagramSelectedItemsFromCurrentLayer.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/RemoveDiagramSelectedItemsFromCurrentLayer.java
index 7d6d2763e3d..decec23faec 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/RemoveDiagramSelectedItemsFromCurrentLayer.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/handlers/RemoveDiagramSelectedItemsFromCurrentLayer.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +8,8 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
/**
*
@@ -27,6 +30,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext;
import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
@@ -144,7 +148,7 @@ public class RemoveDiagramSelectedItemsFromCurrentLayer extends AbstractLayersCo
// }
for (Object obj : structuredSelection.toList()) {
// Adapt the selected object to a View.
- View view = (View) Platform.getAdapterManager().getAdapter(obj, View.class);
+ View view = Platform.getAdapterManager().getAdapter(obj, View.class);
if (view != null) {
result.add(view);
}
@@ -165,7 +169,7 @@ public class RemoveDiagramSelectedItemsFromCurrentLayer extends AbstractLayersCo
IEditorPart editor;
try {
- editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context);
+ editor = ServiceUtilsForIEvaluationContext.getInstance().getService(ISashWindowsContainer.class, context).getActiveEditor();
} catch (ServiceException e) {
throw new NotFoundException("Selected editor do not provides ServiceRegistry", e); //$NON-NLS-1$
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/utils/HandlersUtils.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/utils/HandlersUtils.java
index c135d2cedaa..12d9f01daee 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/utils/HandlersUtils.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/utils/HandlersUtils.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,14 +8,17 @@
*
* Contributors:
* Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ * Christian W. Damus - bug 485220
+ *
******************************************************************************/
package org.eclipse.papyrus.layers3.ui.utils;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForWorkbenchPage;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForWorkbenchPage;
import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -53,7 +57,7 @@ public class HandlersUtils {
throw new NotFoundException("No active IWorkbenchPage");
}
- IEditorPart editor = ServiceUtilsForWorkbenchPage.getInstance().getNestedActiveIEditorPart(page);
+ IEditorPart editor = ServiceUtilsForWorkbenchPage.getInstance().getService(ISashWindowsContainer.class, page).getActiveEditor();
if (!(editor instanceof DiagramDocumentEditor)) {
throw new NotFoundException("Selected editor do not contains Diagram");

Back to the top