From b089eab1fca586752027404cc398a173237337f8 Mon Sep 17 00:00:00 2001 From: Christian W. Damus Date: Sun, 17 Jan 2016 12:27:59 -0500 Subject: 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 --- .../org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF | 4 +++- .../papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java | 2 +- .../editor/operationhistory/OperationHistoryHandler.java | 2 +- .../papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/integration') diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF index 207d592efe9..db6fac77c6a 100644 --- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF +++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF @@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.uml.diagram.emftree;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf.diagram.common;bundle-version="1.2.0", org.eclipse.core.commands;bundle-version="3.6.100", - org.eclipse.emf.transaction;bundle-version="1.4.0" + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.integrationtests.editor Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java index f720df0b5b1..1aea23c7383 100644 --- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java +++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java @@ -22,11 +22,11 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelsReader; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.papyrus.uml.tools.model.UmlUtils; import org.eclipse.ui.IEditorDescriptor; diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java index ca0274cb961..1c4bd1d940f 100644 --- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java +++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java @@ -16,8 +16,8 @@ package org.eclipse.papyrus.integrationtests.editor.operationhistory; import org.eclipse.core.commands.operations.IOperationHistory; import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.integrationtests.editor.ExecutionException; import org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor; diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java index ebf63c3189f..d1caad59229 100644 --- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java +++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java @@ -18,12 +18,12 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.BadArgumentExcetion; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.junit.After; import org.junit.Before; import org.junit.Test; -- cgit v1.2.3