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 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite
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 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java31
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java2
6 files changed, 33 insertions, 25 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
index 3fe20cb5ab5..fe547ba50ce 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
@@ -85,7 +85,9 @@ Require-Bundle: org.eclipse.emf.ecore,
org.eclipse.core.databinding.observable,
org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0",
org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0"
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.2.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java
index 05e26fb76a4..74cff6c1a40 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java
@@ -14,7 +14,7 @@
package org.eclipse.papyrus.uml.diagram.composite;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
+import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence;
/**
* CompositeDiagramCreationCondition class allows to check if a Composite diagram can be added to the
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java
index 0750025442a..261d2ce2586 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
+ * Copyright (c) 2015, 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
@@ -8,6 +8,7 @@
*
* Contributors:
* Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
@@ -20,6 +21,7 @@ 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.core.sasheditor.editor.IPage;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.services.BadStateException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -47,13 +49,14 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor {
* @param fromElement
* @return
*/
+ @Override
public List<HyperLinkObject> getHyperlinks(Object fromElement) {
ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
-
+
if (fromElement instanceof org.eclipse.uml2.uml.Package) {
List<org.eclipse.uml2.uml.Package> nestedPackages = ((org.eclipse.uml2.uml.Package) fromElement).getNestedPackages();
List<Object> pages = new ArrayList<Object>();
-
+
for (org.eclipse.uml2.uml.Package nestedPackage : nestedPackages) {
ViewerSearchService viewerSearchService = null;
try {
@@ -76,34 +79,34 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor {
}
}
}
-
+
if (viewerSearchService != null) {
List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestedPackage, true, false);
pages.addAll(viewerSearchResults);
}
}
-
+
for (Object page : pages) {
-
+
if (page instanceof Diagram
&& ((Diagram) page).getType().equals(CompositeStructureDiagramEditPart.MODEL_ID)) {
try {
// Page must not be active page
- IPage activeSashPage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage();
+ IPage activeSashPage = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, (org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage();
Object activePage = null;
-
+
if (activeSashPage != null) {
Object pageId = activeSashPage.getRawModel();
-
+
if (pageId instanceof PageRef) {
Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier();
-
+
if (emfPageId instanceof View) {
activePage = emfPageId;
}
}
}
-
+
if (activePage == null || !activePage.equals(page)) {
HyperLinkEditor hyperlink = new HyperLinkEditor();
hyperlink.setObject(page);
@@ -113,11 +116,11 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor {
Activator.log.error(e);
}
}
-
-
+
+
}
}
-
+
return hyperlinks;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java
index 272c0630c6d..9621232ea7c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
+ * Copyright (c) 2015, 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
@@ -8,6 +8,7 @@
*
* Contributors:
* Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
@@ -20,6 +21,7 @@ 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.core.sasheditor.editor.IPage;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.services.BadStateException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -47,13 +49,14 @@ public class NestingPackageHyperlinkContributor implements HyperlinkContributor
* @param fromElement
* @return
*/
+ @Override
public List<HyperLinkObject> getHyperlinks(Object fromElement) {
ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
-
+
if (fromElement instanceof org.eclipse.uml2.uml.Package) {
org.eclipse.uml2.uml.Package nestingPackage = ((org.eclipse.uml2.uml.Package) fromElement).getNestingPackage();
List<Object> pages = new ArrayList<Object>();
-
+
if (nestingPackage != null) {
ViewerSearchService viewerSearchService = null;
try {
@@ -76,19 +79,19 @@ public class NestingPackageHyperlinkContributor implements HyperlinkContributor
}
}
}
-
+
if (viewerSearchService != null) {
List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestingPackage, true, false);
pages.addAll(viewerSearchResults);
}
}
-
+
for (Object page : pages) {
if (page instanceof Diagram
&& ((Diagram) page).getType().equals(CompositeStructureDiagramEditPart.MODEL_ID)) {
try {
// Page must not be active page
- IPage activeSashPage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage();
+ IPage activeSashPage = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, (org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage();
Object activePage = null;
if (activeSashPage != null) {
@@ -114,7 +117,7 @@ public class NestingPackageHyperlinkContributor implements HyperlinkContributor
}
}
}
-
+
return hyperlinks;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
index da8c5a65788..82a6f9519aa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
@@ -182,7 +182,7 @@
<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"
factoryClass="org.eclipse.papyrus.uml.diagram.composite.CompositeDiagramEditorFactory"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java
index 6be5a3aab5d..de210914611 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java
@@ -36,10 +36,10 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.papyrus.commands.util.OperationHistoryDirtyState;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider;
import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer;

Back to the top