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.effbd/META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../adltool/assistant/ADLToolAbstractHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../META-INF/MANIFEST.MF | 37 +- .../META-INF/MANIFEST.MF | 26 +- .../internal/ui/editors/PapyrusCDOEditorInput.java | 2 +- .../ui/editors/PapyrusCDOEditorManager.java | 4 +- .../META-INF/MANIFEST.MF | 6 +- .../internal/ui/open/CDOOpenElementService.java | 4 +- .../META-INF/MANIFEST.MF | 4 +- .../provider/DiagramDefinitionLabelProvider.java | 2 +- .../provider/DiagramKindContentProvider.java | 2 +- .../launcher/DiagramTemplateLauncher.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../types/menu/AbstractCreateEastadlChildMenu.java | 2 +- .../org.eclipse.papyrus.layers.runtime/plugin.xml | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../plugin.xml | 2 +- .../diagram/LayersTreeDiagramEditorFactory.java | 10 +- .../diagram/ui/handlers/AbstractLayerCommand.java | 8 +- .../META-INF/MANIFEST.MF | 3 +- .../ui/commands/AbstractLayerStackCommand.java | 8 +- .../layers3/ui/commands/AbstractLayersCommand.java | 10 +- .../AttachDiagramSelectedItemsToCurrentLayer.java | 10 +- ...RemoveDiagramSelectedItemsFromCurrentLayer.java | 10 +- .../papyrus/layers3/ui/utils/HandlersUtils.java | 10 +- .../META-INF/MANIFEST.MF | 3 +- .../contentassist/CopyOfVSLProposalProvider.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../org.eclipse.papyrus.texteditor.cdt/plugin.xml | 2 +- .../papyrus/texteditor/cdt/CommandSupport.java | 2 +- .../texteditor/cdt/editor/PapyrusCDTEditor.java | 8 +- .../cdt/factory/PapyrusCDTEditorFactory.java | 8 +- .../cdt/handler/PapyrusCDTEditorHandler.java | 36 +- .../META-INF/MANIFEST.MF | 3 +- .../eclipse/papyrus/views/cpp/CommandSupport.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../java/reverse/ui/DndReverseCodeHandler.java | 2 +- .../java/reverse/ui/ReverseCodeHandler.java | 6 +- .../CreateAssociationFromPropertyHandler.java | 2 +- .../org.eclipse.papyrus.codegen.base/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +- .../META-INF/MANIFEST.MF | 5 +- .../codegen/base/codesync/ManageChangeEvents.java | 6 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../modellibs/tracing/QompassTraceMechanism.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../handler/PapyrusAbstractHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../assistant/handler/PapyrusAbstractHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../handler/ApplyTracabilityHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../revision/tool/core/ReviewResourceManager.java | 2 +- .../papyrus/revision/tool/ui/ReviewsEditor.java | 2 +- .../papyrus/revision/tool/ui/RevisonDiagLayer.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../papyrus/robotml/deployment/CommandSupport.java | 2 +- .../eclipse/papyrus/robotml/deployment/Utils.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../plugin.xml | 2 +- .../common/utils/RobotmlSelectionTester.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../diagram/common/utils/SoamlSelectionTester.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../export/util/AreThereAppliedProfilesFromWS.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../feature.xml | 4 +- .../feature.xml | 4 +- .../feature.xml | 4 +- .../xtend/aspects/xpt/editor/Editor.xtend | 4 +- .../xtend/aspects/xpt/plugin/manifest.xtend | 2 + .../generator/ElementTypeRegistryGenerator.java | 116 -- .../META-INF/MANIFEST.MF | 3 +- .../developper/mde/handler/IDMAbstractHandler.java | 2 +- .../editor/PapyrusActionBarContributor.java | 2 +- .../papyrus/editor/PapyrusMultiDiagramEditor.java | 2 +- .../.classpath | 1 - .../META-INF/MANIFEST.MF | 9 +- .../build.properties | 4 +- .../di/contentprovider/DiSashModelManager.java | 17 +- .../di/contentprovider/DiSashModelMngr.java | 2 +- .../di/contentprovider/IPageModelFactory.java | 2 +- .../di/contentprovider/commands/PageContext.java | 2 +- .../internal/DiContentProvider.java | 8 +- .../contentprovider/internal/PageManagerImpl.java | 320 +--- .../di/contentprovider/internal/PageMngrImpl.java | 207 --- .../internal/TransactionalPageManagerImpl.java | 14 +- .../di/contentprovider/utils/IPageUtils.java | 98 -- .../contentprovider/utils/TransactionHelper.java | 7 +- .../model/di.ecore | 218 --- .../model/sashwindowsdi.di | 35 - .../model/sashwindowsdi.di2 | 862 ----------- .../model/sashwindowsdi.genmodel | 190 --- .../model/sashwindowsdi.notation | 1256 ---------------- .../model/sashwindowsdi.uml | 612 -------- .../plugin.properties | 2 +- .../plugin.xml | 27 - .../infra/core/sashwindows/di/AbstractPage.java | 57 - .../infra/core/sashwindows/di/AbstractPanel.java | 58 - .../infra/core/sashwindows/di/DiFactory.java | 142 -- .../infra/core/sashwindows/di/DiPackage.java | 1571 -------------------- .../infra/core/sashwindows/di/PageList.java | 65 - .../papyrus/infra/core/sashwindows/di/PageRef.java | 186 --- .../infra/core/sashwindows/di/PanelParent.java | 62 - .../infra/core/sashwindows/di/Position.java | 86 -- .../infra/core/sashwindows/di/SashModel.java | 272 ---- .../infra/core/sashwindows/di/SashPanel.java | 103 -- .../infra/core/sashwindows/di/SashWindowsMngr.java | 88 -- .../papyrus/infra/core/sashwindows/di/Size.java | 86 -- .../infra/core/sashwindows/di/TabFolder.java | 135 -- .../papyrus/infra/core/sashwindows/di/Window.java | 114 -- .../di/exception/SashEditorException.java | 54 - .../core/sashwindows/di/impl/AbstractPageImpl.java | 181 --- .../sashwindows/di/impl/AbstractPanelImpl.java | 219 --- .../core/sashwindows/di/impl/DiFactoryImpl.java | 387 ----- .../core/sashwindows/di/impl/DiPackageImpl.java | 1044 ------------- .../core/sashwindows/di/impl/PageListImpl.java | 195 --- .../core/sashwindows/di/impl/PageRefImpl.java | 507 ------- .../core/sashwindows/di/impl/PanelParentImpl.java | 191 --- .../core/sashwindows/di/impl/PositionImpl.java | 242 --- .../core/sashwindows/di/impl/SashModelImpl.java | 864 ----------- .../core/sashwindows/di/impl/SashPanelImpl.java | 419 ------ .../sashwindows/di/impl/SashWindowsMngrImpl.java | 280 ---- .../infra/core/sashwindows/di/impl/SizeImpl.java | 242 --- .../core/sashwindows/di/impl/TabFolderImpl.java | 356 ----- .../infra/core/sashwindows/di/impl/WindowImpl.java | 316 ---- .../di/util/CompositePageRemovalValidator.java | 44 - .../core/sashwindows/di/util/DiAdapterFactory.java | 363 ----- .../sashwindows/di/util/DiResourceFactoryImpl.java | 47 - .../core/sashwindows/di/util/DiResourceImpl.java | 34 - .../infra/core/sashwindows/di/util/DiSwitch.java | 424 ------ .../infra/core/sashwindows/di/util/DiUtils.java | 206 --- .../sashwindows/di/util/PageRemovalValidator.java | 93 -- .../META-INF/MANIFEST.MF | 3 - .../sasheditor/contentprovider/IPageManager.java | 165 -- .../core/sasheditor/contentprovider/IPageMngr.java | 114 -- .../service/AbstractLocalPageService.java | 35 - .../contentprovider/service/ILocalPageService.java | 35 - .../editor/gef/MultiDiagramEditorGefDelegate.java | 109 -- .../.classpath | 8 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 291 ++++ .../.settings/org.eclipse.jdt.ui.prefs | 68 + .../META-INF/MANIFEST.MF | 21 + .../about.html | 28 + .../build.properties | 9 + .../model/di.ecore | 218 +++ .../model/sashwindowsdi.di | 35 + .../model/sashwindowsdi.di2 | 862 +++++++++++ .../model/sashwindowsdi.genmodel | 192 +++ .../model/sashwindowsdi.notation | 1256 ++++++++++++++++ .../model/sashwindowsdi.uml | 612 ++++++++ .../plugin.properties | 8 + .../plugin.xml | 28 + .../pom.xml | 14 + .../infra/core/sashwindows/di/AbstractPage.java | 57 + .../infra/core/sashwindows/di/AbstractPanel.java | 58 + .../infra/core/sashwindows/di/DiFactory.java | 142 ++ .../infra/core/sashwindows/di/DiPackage.java | 1571 ++++++++++++++++++++ .../infra/core/sashwindows/di/PageList.java | 65 + .../papyrus/infra/core/sashwindows/di/PageRef.java | 186 +++ .../infra/core/sashwindows/di/PanelParent.java | 62 + .../infra/core/sashwindows/di/Position.java | 86 ++ .../infra/core/sashwindows/di/SashModel.java | 272 ++++ .../infra/core/sashwindows/di/SashPanel.java | 103 ++ .../infra/core/sashwindows/di/SashWindowsMngr.java | 88 ++ .../papyrus/infra/core/sashwindows/di/Size.java | 86 ++ .../infra/core/sashwindows/di/TabFolder.java | 135 ++ .../papyrus/infra/core/sashwindows/di/Window.java | 114 ++ .../di/exception/SashEditorException.java | 54 + .../core/sashwindows/di/impl/AbstractPageImpl.java | 181 +++ .../sashwindows/di/impl/AbstractPanelImpl.java | 219 +++ .../core/sashwindows/di/impl/DiFactoryImpl.java | 387 +++++ .../core/sashwindows/di/impl/DiPackageImpl.java | 1044 +++++++++++++ .../core/sashwindows/di/impl/PageListImpl.java | 195 +++ .../core/sashwindows/di/impl/PageRefImpl.java | 507 +++++++ .../core/sashwindows/di/impl/PanelParentImpl.java | 191 +++ .../core/sashwindows/di/impl/PositionImpl.java | 242 +++ .../core/sashwindows/di/impl/SashModelImpl.java | 870 +++++++++++ .../core/sashwindows/di/impl/SashPanelImpl.java | 419 ++++++ .../sashwindows/di/impl/SashWindowsMngrImpl.java | 280 ++++ .../infra/core/sashwindows/di/impl/SizeImpl.java | 242 +++ .../core/sashwindows/di/impl/TabFolderImpl.java | 356 +++++ .../infra/core/sashwindows/di/impl/WindowImpl.java | 316 ++++ .../core/sashwindows/di/util/DiAdapterFactory.java | 363 +++++ .../sashwindows/di/util/DiResourceFactoryImpl.java | 47 + .../core/sashwindows/di/util/DiResourceImpl.java | 34 + .../infra/core/sashwindows/di/util/DiSwitch.java | 424 ++++++ .../di/service/AbstractLocalPageService.java | 35 + .../di/service/BasicPageManagerImpl.java | 398 +++++ .../sashwindows/di/service/ILocalPageService.java | 35 + .../core/sashwindows/di/service/IPageManager.java | 172 +++ .../di/util/CompositePageRemovalValidator.java | 44 + .../infra/core/sashwindows/di/util/DiUtils.java | 298 ++++ .../sashwindows/di/util/PageRemovalValidator.java | 93 ++ .../META-INF/MANIFEST.MF | 22 +- .../build.properties | 2 +- .../icons/papyrus/32x32/PapyrusLogo32x32.png | Bin 2001 -> 0 bytes .../icons/papyrus/32x32/Papyrus_32x32_t.gif | Bin 1264 -> 0 bytes .../icons/papyrus/Papyrus.gif | Bin 561 -> 0 bytes .../icons/papyrus/Papyrus_16x16.gif | Bin 561 -> 0 bytes .../core/org.eclipse.papyrus.infra.core/plugin.xml | 364 +---- .../schema/contentOutline.exsd | 144 -- .../schema/papyrusDiagram.exsd | 342 ----- .../schema/readme.txt | 5 - .../org/eclipse/papyrus/infra/core/Activator.java | 41 +- .../contentoutline/ContentOutlineRegistry.java | 263 ---- .../contentoutline/IPapyrusContentOutlinePage.java | 34 - .../NestedEditorDelegatedOutlinePage.java | 1098 -------------- .../core/editor/ContentProviderServiceFactory.java | 68 - .../infra/core/editor/CoreMultiDiagramEditor.java | 1244 ---------------- .../editor/DiSashModelManagerServiceFactory.java | 114 -- .../core/editor/DiSashModelMngrServiceFactory.java | 101 -- .../infra/core/editor/IMultiDiagramEditor.java | 93 -- .../infra/core/editor/IPapyrusPageInput.java | 35 - .../infra/core/editor/IReloadableEditor.java | 409 ----- .../editor/MultiDiagramEditorSelectionContext.java | 291 ---- .../core/editor/MultiDiagramPropertySheetPage.java | 178 --- .../editor/PageIconRegistryServiceFactory.java | 71 - .../infra/core/editor/PageMngrServiceFactory.java | 85 -- .../infra/core/editor/PapyrusPageInput.java | 62 - .../core/editor/reload/CompositeReloadContext.java | 86 -- .../editor/reload/DelegatingReloadContext.java | 74 - .../core/editor/reload/EMFSelectionContext.java | 52 - .../core/editor/reload/EMFTreeViewerContext.java | 52 - .../core/editor/reload/EditorReloadAdapter.java | 36 - .../core/editor/reload/EditorReloadEvent.java | 188 --- .../editor/reload/IDisposableReloadContext.java | 23 - .../core/editor/reload/IEditorReloadListener.java | 44 - .../reload/IInternalEMFSelectionContext.java | 109 -- .../core/editor/reload/IReloadContextProvider.java | 38 - .../infra/core/editor/reload/SelectionContext.java | 81 - .../core/editor/reload/TreeViewerContext.java | 64 - .../infra/core/editorsfactory/IEditorFactory.java | 57 - .../core/editorsfactory/IEditorIconFactory.java | 64 - .../editorsfactory/IEditorIconFactoryExtended.java | 30 - .../core/editorsfactory/IPageIconsRegistry.java | 40 - .../editorsfactory/IPageIconsRegistryExtended.java | 32 - .../core/editorsfactory/PageIconsRegistry.java | 118 -- .../editorsfactory/PageModelFactoryRegistry.java | 165 -- .../anytype/AnyTypeEditorFactory.java | 135 -- .../extension/commands/ICreationCondition.java | 36 - .../extension/commands/IModelCreationCommand.java | 31 - .../commands/PerspectiveContextDependence.java | 51 - .../diagrameditor/AbstractEditorFactory.java | 109 -- .../extension/diagrameditor/EditorDescriptor.java | 168 --- .../EditorDescriptorExtensionFactory.java | 99 -- .../diagrameditor/EditorFactoryProxy.java | 137 -- .../extension/diagrameditor/EditorIconFactory.java | 152 -- .../diagrameditor/EditorNotFoundException.java | 53 - .../diagrameditor/IPluggableEditorFactory.java | 39 - .../diagrameditor/MultiDiagramException.java | 53 - .../PluggableEditorFactoryReader.java | 143 -- .../internal/commands/PageLayoutStorageState.java | 164 -- .../commands/TogglePageLayoutStorageHandler.java | 79 - .../internal/preferences/EditorPreferencePage.java | 52 - .../internal/preferences/EditorPreferences.java | 88 -- .../infra/core/internal/preferences/Messages.java | 37 - .../infra/core/internal/preferences/YesNo.java | 21 - .../core/internal/preferences/messages.properties | 18 - .../sashmodel/BasicPageManagerServiceFactory.java | 69 + .../TransactionalBasicPageManagerImpl.java | 102 ++ .../infra/core/lifecycleevents/DoSaveEvent.java | 66 - .../IEditorInputChangedListener.java | 40 - .../lifecycleevents/ILifeCycleEventsProvider.java | 57 - .../core/lifecycleevents/ISaveAndDirtyService.java | 56 - .../core/lifecycleevents/ISaveEventListener.java | 27 - .../lifecycleevents/LifeCycleEventsProvider.java | 291 ---- .../LifeCycleEventsProviderServiceFactory.java | 79 - .../core/lifecycleevents/SaveAndDirtyService.java | 550 ------- .../ActionBarContributorDescriptor.java | 72 - .../ActionBarContributorExtensionFactory.java | 72 - .../ActionBarContributorRegistry.java | 176 --- .../CoreComposedActionBarContributor.java | 122 -- .../IActionBarContributorFactory.java | 25 - .../papyrus/infra/core/resource/ModelUtils.java | 20 +- .../sasheditor/SashLayoutCommandFactory.java | 225 --- .../core/resource/sasheditor/SashModelUtils.java | 9 +- .../services/EditorLifecycleEventListener.java | 55 - .../core/services/EditorLifecycleManager.java | 28 - .../papyrus/infra/core/services/Messages.java | 34 - .../infra/core/services/ResourceUpdateService.java | 289 ---- .../infra/core/services/SaveLayoutBeforeClose.java | 215 --- .../internal/EditorLifecycleManagerImpl.java | 128 -- .../internal/InternalEditorLifecycleManager.java | 48 - .../infra/core/services/messages.properties | 15 - .../spi/IContextualServiceRegistryTracker.java | 32 + .../infra/core/utils/AbstractServiceUtils.java | 71 +- .../papyrus/infra/core/utils/DisplayUtils.java | 47 - .../papyrus/infra/core/utils/EditorUtils.java | 721 --------- .../infra/core/utils/PapyrusImageUtils.java | 67 - .../papyrus/infra/core/utils/ServiceUtils.java | 7 +- .../core/utils/ServiceUtilsForActionHandlers.java | 162 -- .../core/utils/ServiceUtilsForWorkbenchPage.java | 62 - .../infra/core/utils/TransactionHelper.java | 106 +- .../META-INF/MANIFEST.MF | 5 +- .../hyperlink/HyperlinkNavigationAction.java | 2 +- .../editor/welcome/nattable/widgets/FormTable.java | 4 +- .../META-INF/MANIFEST.MF | 5 +- .../plugin.xml | 6 +- .../welcome/internal/WelcomePageFactory.java | 4 +- .../welcome/internal/WelcomePageService.java | 8 +- .../commands/AbstractWelcomePageHandler.java | 2 +- .../internal/commands/ResetWelcomePageHandler.java | 2 +- .../commands/SaveDefaultWelcomePageHandler.java | 2 +- .../internal/commands/ShowWelcomePageHandler.java | 2 +- .../internal/dnd/WelcomeSectionTransfer.java | 2 +- .../AbstractPageLayoutToggleValue.java | 6 +- .../modelelements/LanguagesObservableList.java | 2 +- .../internal/modelelements/PrivateLayoutValue.java | 2 +- .../modelelements/RestoreActivePageValue.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../common/handler/CreateDiagramHandler.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../papyrus/infra/emf/readonly/Activator.java | 19 +- .../infra/emf/readonly/ReadOnlyManager.java | 10 +- .../readonly/ReferencedModelReadOnlyHandler.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../emf/org.eclipse.papyrus.infra.emf/plugin.xml | 7 +- .../papyrus/infra/emf/advice/RemovePageHelper.java | 11 +- .../emf/providers/MoDiscoContentProvider.java | 2 +- .../eclipse/papyrus/infra/emf/utils/EMFHelper.java | 14 +- .../infra/emf/utils/EMFStringValueConverter.java | 375 ----- .../infra/emf/utils/ServiceUtilsForHandlers.java | 22 +- .../META-INF/MANIFEST.MF | 3 +- .../properties/dialog/CSSThemeCreationDialog.java | 2 +- .../properties/dialog/CSSThemeEditionDialog.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../gmfdiag/css/handler/ResetStyleHandler.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../editors/ui/DirectEditorsContributionItem.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../commands/CreationCommandDescriptor.java | 2 +- .../commands/CreationCommandExtensionFactory.java | 2 +- .../papyrus/commands/OpenDiagramCommand.java | 8 +- .../papyrus/commands/RenameDiagramHandler.java | 9 +- .../META-INF/MANIFEST.MF | 5 +- ...tractPapyrusGmfCreateDiagramCommandHandler.java | 16 +- .../common/DiagramReloadContextProvider.java | 8 +- .../infra/gmfdiag/common/GmfEditorFactory.java | 8 +- .../common/PaletteViewerReloadContextProvider.java | 6 +- .../common/SynchronizableGmfDiagramEditor.java | 4 +- .../adapter/DiagramOutlineAdapterFactory.java | 2 +- .../DiagramOutlineReloadContextProvider.java | 2 +- .../adapter/GMFMultiDiagramAdapterFactory.java | 2 +- .../common/editpart/PapyrusDiagramEditPart.java | 2 +- .../common/figure/edge/PapyrusEdgeFigure.java | 4 +- .../gmfdiag/common/handler/RefreshHandler.java | 2 +- .../infra/gmfdiag/common/helper/DiagramHelper.java | 16 +- .../common/helper/GMFDiagramViewTypeHelper.java | 2 +- .../internal/sync/UISyncServiceInitializer.java | 2 +- .../infra/gmfdiag/common/model/NotationUtils.java | 2 +- .../gmfdiag/common/utils/DiagramEditPartsUtil.java | 2 +- .../common/utils/DiagramPropertyTester.java | 2 +- .../infra/gmfdiag/common/utils/MDTUtil.java | 2 +- .../gmfdiag/common/utils/ViewServiceUtil.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../export/engine/ExportAllDiagramsEngine.java | 13 +- .../engine/ExportDiagramLocalPageService.java | 4 +- .../gmfdiag/export/utils/SelectionHelper.java | 15 +- .../.classpath | 7 + .../org.eclipse.papyrus.infra.gmfdiag.gef/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 291 ++++ .../.settings/org.eclipse.jdt.ui.prefs | 68 + .../META-INF/MANIFEST.MF | 21 + .../about.html | 28 + .../build.properties | 21 + .../plugin.properties | 13 + .../plugin.xml | 26 + .../org.eclipse.papyrus.infra.gmfdiag.gef/pom.xml | 14 + .../infra/gmfdiag/gef/internal/Activator.java | 50 + .../CoreMultiDiagramEditorAdapterFactory.java | 49 + .../editor/MultiDiagramEditorGefDelegate.java | 117 ++ .../META-INF/MANIFEST.MF | 5 +- .../editpolicies/HyperLinkPopupBarEditPolicy.java | 4 +- .../HyperlinkNavigationMenuEditPolicy.java | 4 +- .../editpolicies/NavigationEditPolicy.java | 42 +- .../providers/SpecificViewContentProvider.java | 2 +- .../gmfdiag/hyperlink/ui/AdvancedHLManager.java | 2 +- .../hyperlink/ui/LocalDefaultLinkDiagramTab.java | 6 +- .../META-INF/MANIFEST.MF | 3 +- .../menu/handlers/AbstractDiagramHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../handlers/DuplicateDiagramHandler.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../menuContributor/OwnedDiagramsButton.java | 19 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../infra/gmfdiag/outline/DiagramOutline.java | 6 +- .../META-INF/MANIFEST.MF | 3 +- .../preferences/PapyrusPreferenceStore.java | 6 +- .../ui/dialog/ApplyValueOnPreferenceKeyDialog.java | 4 +- .../META-INF/MANIFEST.MF | 4 +- .../viewersearcher/DiagramViewerSearcher.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../manager/cell/EMFFeatureValueCellManager.java | 8 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../common/api/TableEditorCreationHelper.java | 12 +- .../commands/CreateAndOpenTableEditorCommand.java | 2 +- .../common/editor/AbstractEMFNattableEditor.java | 2 +- .../editor/NattableReloadContextProvider.java | 4 +- .../factory/AbstractNattableEditorFactory.java | 8 +- .../common/factory/NattableEditorFactory.java | 8 +- .../AbstractCreateNattableEditorHandler.java | 13 +- .../common/handlers/RenameTableHandler.java | 2 +- .../advice/NatTableDuplicateEditHelperAdvice.java | 15 +- .../META-INF/MANIFEST.MF | 7 +- .../axis/EditorContextSynchronizerAxisManager.java | 8 +- .../config/manager/cell/ModelViewsCellManager.java | 14 +- .../infra/nattable/views/config/utils/Utils.java | 12 +- .../META-INF/MANIFEST.MF | 9 +- .../configuration/PapyrusPopupMenuAction.java | 2 +- .../nattable/handler/AbstractTableHandler.java | 2 +- .../nattable/manager/cell/AbstractCellManager.java | 8 +- .../nattable/manager/cell/CellManagerFactory.java | 2 +- .../infra/nattable/manager/cell/ICellManager.java | 2 +- .../StringResolutionProblemWrapperCellManager.java | 6 +- .../table/AbstractNattableWidgetManager.java | 2 +- .../manager/table/NattableModelManager.java | 2 +- .../manager/table/TreeNattableModelManager.java | 2 +- .../preferences/PapyrusTablePreferenceStore.java | 6 +- ...actPasteInSelectionNattableCommandProvider.java | 2 +- .../PasteEObjectAxisInNattableCommandProvider.java | 2 +- .../PasteEObjectAxisInTableCommandProvider.java | 2 +- ...teEObjectTreeAxisInNattableCommandProvider.java | 2 +- .../papyrus/infra/nattable/utils/CellHelper.java | 4 +- .../nattable/utils/CollapseExpandActionHelper.java | 2 +- .../infra/nattable/utils/TableSelectionHelper.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../hyperlink/helper/EditorHyperLinkHelper.java | 15 +- .../hyperlink/helper/ObjectHyperLinkHelper.java | 2 +- .../infra/hyperlink/object/HyperLinkEditor.java | 10 +- .../hyperlink/ui/EditorHyperLinkEditorShell.java | 2 +- .../hyperlink/ui/EditorLookForEditorShell.java | 19 +- .../infra/hyperlink/ui/HyperLinkManagerShell.java | 2 +- .../hyperlink/util/EditorListContentProvider.java | 8 +- .../META-INF/MANIFEST.MF | 4 +- .../infra/onefile/model/impl/PapyrusFile.java | 2 +- .../META-INF/MANIFEST.MF | 11 +- .../org/eclipse/papyrus/infra/tools/Activator.java | 41 +- .../infra/tools/DelegatingUIExecutorService.java | 191 +++ .../converter/AbstractStringValueConverter.java | 85 -- .../tools/converter/ConvertedValueContainer.java | 75 - .../tools/converter/IStringValueConverter.java | 36 - .../converter/MultiConvertedValueContainer.java | 39 - .../converter/StringValueConverterStatus.java | 60 - .../papyrus/infra/tools/dnd/PapyrusTransfer.java | 105 -- .../papyrus/infra/tools/messages/Messages.java | 48 - .../infra/tools/messages/messages.properties | 10 - .../AbstractPapyrusPreferenceStore.java | 300 ---- .../preferences/PapyrusScopedPreferenceStore.java | 858 ----------- .../AbstractApplyValueOnPreferenceKeyDialog.java | 71 - .../ui/dialog/AbstractPreferenceKeyDialog.java | 105 -- .../infra/tools/spi/IExecutorServiceFactory.java | 25 + .../AbstractCreateMenuFromCommandCategory.java | 135 -- .../papyrus/infra/tools/util/CoreExecutors.java | 43 + .../infra/tools/util/EclipseCommandUtils.java | 137 -- .../papyrus/infra/tools/util/EditorHelper.java | 71 - .../infra/tools/util/ICallableWithProgress.java | 45 - .../papyrus/infra/tools/util/IExecutorService.java | 57 + .../papyrus/infra/tools/util/LocalMemento.java | 285 ---- .../papyrus/infra/tools/util/SelectionHelper.java | 119 -- .../eclipse/papyrus/infra/tools/util/UIUtil.java | 465 ------ .../infra/tools/util/WorkbenchPartHelper.java | 71 - .../META-INF/MANIFEST.MF | 3 +- .../resources/refactoring/DirtyEditorChange.java | 4 +- .../resources/refactoring/RenameModelChange.java | 4 +- .../infra/org.eclipse.papyrus.infra.ui/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +- .../META-INF/MANIFEST.MF | 33 +- .../org.eclipse.papyrus.infra.ui/build.properties | 4 +- .../icons/papyrus/32x32/PapyrusLogo32x32.png | Bin 0 -> 2001 bytes .../icons/papyrus/32x32/Papyrus_32x32_t.gif | Bin 0 -> 1264 bytes .../icons/papyrus/Papyrus.gif | Bin 0 -> 561 bytes .../icons/papyrus/Papyrus_16x16.gif | Bin 0 -> 561 bytes .../org.eclipse.papyrus.infra.ui/plugin.properties | 13 +- .../infra/org.eclipse.papyrus.infra.ui/plugin.xml | 361 ++++- .../schema/contentOutline.exsd | 144 ++ .../schema/papyrusDiagram.exsd | 342 +++++ .../org/eclipse/papyrus/infra/ui/Activator.java | 47 +- .../ui/contentoutline/ContentOutlineRegistry.java | 263 ++++ .../contentoutline/IPapyrusContentOutlinePage.java | 34 + .../NestedEditorDelegatedOutlinePage.java | 1098 ++++++++++++++ .../ui/converter/AbstractStringValueConverter.java | 86 ++ .../ui/converter/ConvertedValueContainer.java | 75 + .../ui/converter/EMFStringValueConverter.java | 373 +++++ .../infra/ui/converter/IStringValueConverter.java | 36 + .../ui/converter/MultiConvertedValueContainer.java | 39 + .../ui/converter/StringValueConverterStatus.java | 60 + .../papyrus/infra/ui/dnd/PapyrusTransfer.java | 105 ++ .../ui/editor/ContentProviderServiceFactory.java | 68 + .../infra/ui/editor/CoreMultiDiagramEditor.java | 1244 ++++++++++++++++ .../editor/DiSashModelManagerServiceFactory.java | 114 ++ .../ui/editor/DiSashModelMngrServiceFactory.java | 101 ++ .../infra/ui/editor/IMultiDiagramEditor.java | 93 ++ .../papyrus/infra/ui/editor/IPapyrusPageInput.java | 35 + .../papyrus/infra/ui/editor/IReloadableEditor.java | 409 +++++ .../editor/MultiDiagramEditorSelectionContext.java | 291 ++++ .../ui/editor/MultiDiagramPropertySheetPage.java | 178 +++ .../ui/editor/PageIconRegistryServiceFactory.java | 71 + .../infra/ui/editor/PageMngrServiceFactory.java | 83 ++ .../papyrus/infra/ui/editor/PapyrusPageInput.java | 62 + .../ui/editor/reload/CompositeReloadContext.java | 86 ++ .../ui/editor/reload/DelegatingReloadContext.java | 74 + .../ui/editor/reload/EMFSelectionContext.java | 52 + .../ui/editor/reload/EMFTreeViewerContext.java | 52 + .../ui/editor/reload/EditorReloadAdapter.java | 36 + .../infra/ui/editor/reload/EditorReloadEvent.java | 188 +++ .../ui/editor/reload/IDisposableReloadContext.java | 23 + .../ui/editor/reload/IEditorReloadListener.java | 44 + .../reload/IInternalEMFSelectionContext.java | 109 ++ .../ui/editor/reload/IReloadContextProvider.java | 38 + .../infra/ui/editor/reload/SelectionContext.java | 81 + .../infra/ui/editor/reload/TreeViewerContext.java | 64 + .../infra/ui/editorsfactory/IEditorFactory.java | 57 + .../ui/editorsfactory/IEditorIconFactory.java | 64 + .../editorsfactory/IEditorIconFactoryExtended.java | 30 + .../ui/editorsfactory/IPageIconsRegistry.java | 40 + .../editorsfactory/IPageIconsRegistryExtended.java | 32 + .../infra/ui/editorsfactory/PageIconsRegistry.java | 118 ++ .../editorsfactory/PageModelFactoryRegistry.java | 165 ++ .../anytype/AnyTypeEditorFactory.java | 135 ++ .../ui/extension/commands/ICreationCondition.java | 36 + .../extension/commands/IModelCreationCommand.java | 31 + .../commands/PerspectiveContextDependence.java | 51 + .../diagrameditor/AbstractEditorFactory.java | 109 ++ .../extension/diagrameditor/EditorDescriptor.java | 168 +++ .../EditorDescriptorExtensionFactory.java | 99 ++ .../diagrameditor/EditorFactoryProxy.java | 137 ++ .../extension/diagrameditor/EditorIconFactory.java | 152 ++ .../diagrameditor/EditorNotFoundException.java | 53 + .../diagrameditor/IPluggableEditorFactory.java | 39 + .../diagrameditor/MultiDiagramException.java | 53 + .../PluggableEditorFactoryReader.java | 143 ++ .../internal/commands/PageLayoutStorageState.java | 164 ++ .../commands/SashLayoutCommandFactory.java | 226 +++ .../commands/TogglePageLayoutStorageHandler.java | 78 + .../internal/preferences/EditorPreferencePage.java | 52 + .../ui/internal/preferences/EditorPreferences.java | 88 ++ .../infra/ui/internal/preferences/Messages.java | 37 + .../infra/ui/internal/preferences/YesNo.java | 21 + .../ui/internal/preferences/messages.properties | 18 + .../infra/ui/lifecycleevents/DoSaveEvent.java | 66 + .../IEditorInputChangedListener.java | 40 + .../lifecycleevents/ILifeCycleEventsProvider.java | 57 + .../ui/lifecycleevents/ISaveAndDirtyService.java | 56 + .../ui/lifecycleevents/ISaveEventListener.java | 27 + .../lifecycleevents/LifeCycleEventsProvider.java | 291 ++++ .../LifeCycleEventsProviderServiceFactory.java | 79 + .../ui/lifecycleevents/SaveAndDirtyService.java | 550 +++++++ ...AbstractParametricOnSelectedElementsAction.java | 2 +- .../papyrus/infra/ui/messages/Messages.java | 48 + .../papyrus/infra/ui/messages/messages.properties | 10 + .../ActionBarContributorDescriptor.java | 72 + .../ActionBarContributorExtensionFactory.java | 72 + .../ActionBarContributorRegistry.java | 176 +++ .../CoreComposedActionBarContributor.java | 122 ++ .../IActionBarContributorFactory.java | 25 + .../AbstractPapyrusPreferenceStore.java | 300 ++++ .../preferences/PapyrusScopedPreferenceStore.java | 858 +++++++++++ .../AbstractApplyValueOnPreferenceKeyDialog.java | 71 + .../dialog/AbstractPreferenceKeyDialog.java | 105 ++ .../ui/services/EditorLifecycleEventListener.java | 55 + .../infra/ui/services/EditorLifecycleManager.java | 30 + .../papyrus/infra/ui/services/Messages.java | 34 + .../infra/ui/services/ResourceUpdateService.java | 292 ++++ .../infra/ui/services/SaveLayoutBeforeClose.java | 218 +++ .../internal/EditorLifecycleManagerImpl.java | 128 ++ .../internal/InternalEditorLifecycleManager.java | 48 + .../papyrus/infra/ui/services/messages.properties | 15 + .../AbstractCreateMenuFromCommandCategory.java | 135 ++ .../papyrus/infra/ui/util/DisplayUtils.java | 47 + .../papyrus/infra/ui/util/EclipseCommandUtils.java | 137 ++ .../papyrus/infra/ui/util/EditorHelper.java | 71 + .../eclipse/papyrus/infra/ui/util/EditorUtils.java | 721 +++++++++ .../infra/ui/util/ICallableWithProgress.java | 45 + .../papyrus/infra/ui/util/LocalMemento.java | 285 ++++ .../papyrus/infra/ui/util/PapyrusImageUtils.java | 67 + .../papyrus/infra/ui/util/SelectionHelper.java | 119 ++ .../ui/util/ServiceUtilsForActionHandlers.java | 149 ++ .../ui/util/ServiceUtilsForWorkbenchPage.java | 63 + .../papyrus/infra/ui/util/TransactionUIHelper.java | 81 + .../org/eclipse/papyrus/infra/ui/util/UIUtil.java | 517 +++++++ .../papyrus/infra/ui/util/WorkbenchPartHelper.java | 71 + .../META-INF/MANIFEST.MF | 9 +- .../plugin.xml | 2 +- .../controlmode/commands/LoadDiagramCommand.java | 7 +- .../controlmode/listener/LoadResourceSnippet.java | 6 +- .../listener/UncontrolModeSaveListener.java | 8 +- .../controlmode/service/ControlModeService.java | 9 +- .../controlmode/ui/OptionalMessageDialog.java | 11 +- .../META-INF/MANIFEST.MF | 3 +- .../impl/ActiveEditorNavigationTargetProvider.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../openelement/service/OpenElementService.java | 2 +- .../service/impl/OpenElementServiceImpl.java | 8 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 4 +- .../plugin.xml | 2 +- .../editor/UnloadResourcesEditorFactory.java | 4 +- .../strategies/AskUserStrategy.java | 4 +- .../resourceloading/util/LoadingUtils.java | 13 +- .../META-INF/MANIFEST.MF | 3 +- .../validation/preferences/PreferencePage.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../dialogs/AbstractNotificationPopup.java | 2 +- .../toolbox/notification/dialogs/PapyrusPopup.java | 2 +- .../notification/view/PapyrusNotificationView.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../part/BlockDefinitionDiagramEditor.java | 2 +- .../BlockDefinitionDiagramCondition.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../part/InternalBlockDiagramEditor.java | 2 +- .../InternalBlockDiagramCondition.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../parametric/ParametricDiagramCondition.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 2 +- .../RequirementDiagramCreationCondition.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../META-INF/MANIFEST.MF | 6 +- .../META-INF/MANIFEST.MF | 3 +- .../types/menu/AbstractCreateSysmlChildMenu.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../ui/internal/wizards/GeneratorWizard.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../internal/controlmode/Activator.java | 2 +- .../controlmode/commands/SaveModelCommand.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../elements/DecoratorModelsObservableList.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../uml/decoratormodel/internal/ui/Activator.java | 2 +- .../ui/commands/UnloadDecoratorModelHandler.java | 2 +- .../providers/AvailableDecoratorModelsSnippet.java | 4 +- .../ui/wizards/DuplicateDecoratorModelWizard.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../activity/ActivityDiagramCreationCondition.java | 2 +- .../CreateActionLocalConditionViewCommand.java | 2 +- .../dialogs/CreateActivityParameterNodeDialog.java | 2 +- .../edit/dialogs/CreateAttributeDialog.java | 2 +- .../edit/dialogs/CreateInvocationActionDialog.java | 2 +- .../edit/dialogs/CreateParameterDialog.java | 2 +- .../edit/dialogs/WarningAndLinkDialog.java | 4 +- .../handlers/SynchronizePinsParametersHandler.java | 2 +- .../ActivityParameterAndParameterSynchronizer.java | 2 +- .../helper/PinAndParameterSynchronizer.java | 2 +- .../InInterruptibleActivityRegionListener.java | 2 +- .../listeners/InterruptibleEdgeListener.java | 2 +- .../ActivityDiagramContributionPolicyClass.java | 2 +- .../appearance/SwitchSegmentDirectionSection.java | 2 +- .../activity/testers/UMLCallActionTester.java | 2 +- .../testers/UMLPackageSelectionTester.java | 2 +- .../plugin.xml | 2 +- .../diagram/activity/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../clazz/ClassDiagramCreationCondition.java | 2 +- .../NestedPackageHyperlinkContributor.java | 31 +- .../NestingPackageHyperlinkContributor.java | 17 +- .../ClassDiagramContributionPolicyClass.java | 2 +- .../plugin.xml | 2 +- .../uml/diagram/clazz/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../plugin.xml | 4 +- .../uml/diagram/common/actions/AbstractAction.java | 2 +- .../common/commands/ModelCreationCommandBase.java | 4 +- .../common/dialogs/InterfaceManagerDialog.java | 2 +- .../common/editparts/AbstractShapeEditPart.java | 4 +- .../editparts/AbstractShortCutDiagramEditPart.java | 4 +- .../editpolicies/ShortCutDiagramEditPolicy.java | 10 +- ...ctedRelationshipSourceHyperlinkContributor.java | 34 +- ...ctedRelationshipTargetHyperlinkContributor.java | 32 +- .../diagram/common/part/UmlGmfDiagramEditor.java | 2 +- .../AbstractActionStateSourceProvider.java | 2 +- .../resourceupdate/PartActivationListener.java | 4 +- .../resourceupdate/ResourceUpdateService.java | 4 +- .../common/resourceupdate/SaveListener.java | 4 +- .../service/PaletteProfileApplicationListener.java | 8 +- .../palette/AbstractPreConditionAction.java | 2 +- .../service/palette/AssociationEndPostAction.java | 2 +- .../palette/ChangeStereotypeDisplayPostAction.java | 2 +- .../DisplayAppliedStereotypePostAction.java | 2 +- ...tereotypePropertiesInCompartmentPostAction.java | 2 +- .../service/palette/GraphicalPostAction.java | 2 +- .../common/service/palette/ModelPostAction.java | 2 +- .../common/service/palette/SemanticPostAction.java | 2 +- .../service/palette/StereotypePostAction.java | 2 +- .../uml/diagram/common/util/UMLModelTester.java | 2 +- .../diagram/common/util/UMLSelectionTester.java | 4 +- .../META-INF/MANIFEST.MF | 4 +- .../CommunicationDiagramCreationCondition.java | 2 +- .../plugin.xml | 2 +- .../communication/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../ComponentDiagramCreationCondition.java | 2 +- .../plugin.xml | 2 +- .../diagram/component/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../CompositeDiagramCreationCondition.java | 2 +- .../NestedPackageHyperlinkContributor.java | 31 +- .../NestingPackageHyperlinkContributor.java | 17 +- .../plugin.xml | 2 +- .../diagram/composite/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../DeploymentDiagramCreationCondition.java | 2 +- .../plugin.xml | 2 +- .../diagram/deployment/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../emftree/EmfTreeDiagramEditorFactory.java | 10 +- .../META-INF/MANIFEST.MF | 7 +- .../plugin.xml | 2 +- .../part/InteractionOverviewDiagramEditor.java | 2 +- ...nteractionOverviewDiagramCreationCondition.java | 2 +- ...hotForInteractionFromViewDescriptorCommand.java | 2 +- .../CreateSnapshotFromContextMenuCommand.java | 2 +- .../provider/DiagramContentProvider.java | 2 +- .../utils/CreateDiagramImage.java | 2 +- .../actions/AbstractGraphicalParametricAction.java | 2 +- .../menu/actions/AbstractParametricAction.java | 2 +- .../handlers/AbstractGraphicalCommandHandler.java | 2 +- .../handlers/ShowHideRelatedLinkHandler.java | 2 +- .../uml/diagram/menu/toolbar/ZoomToolbar.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../provider/DiagramContentProvider.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../profile/ProfileDiagramCreationCondition.java | 2 +- .../profile/service/PreSaveProfileListener.java | 4 +- .../diagram/profile/service/ProfileService.java | 6 +- .../plugin.xml | 4 +- .../uml/diagram/profile/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../sequence/SequenceDiagramCreationCondition.java | 2 +- .../uml/diagram/sequence/util/CommandHelper.java | 2 +- .../diagram/sequence/util/InteractionUseUtil.java | 4 +- .../plugin.xml | 2 +- .../diagram/sequence/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../StateMachineDiagramCreationCondition.java | 2 +- .../AbstractModifcationTriggerListener.java | 2 +- .../plugin.xml | 2 +- .../statemachine/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../custom/TimingDiagramCreationCondition.java | 2 +- .../plugin.xml | 2 +- .../uml/diagram/timing/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../usecase/UseCaseDiagramCreationCondition.java | 2 +- .../edit/parts/CustomShortCutDiagramEditPart.java | 4 +- .../plugin.xml | 2 +- .../uml/diagram/usecase/part/UMLDiagramEditor.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../schema/templates.exsd | 2 +- .../category/DiagramCategoryDescriptor.java | 2 +- .../wizards/category/DiagramCategoryRegistry.java | 8 +- .../wizards/pages/SelectDiagramKindPage.java | 2 +- .../diagram/wizards/wizards/CreateModelWizard.java | 6 +- .../META-INF/MANIFEST.MF | 6 +- .../META-INF/MANIFEST.MF | 3 +- .../manager/axis/NotationTreeTableAxisManager.java | 2 +- .../StereotypeDisplayTreeTableCellManager.java | 6 +- .../cell/TableSelectionProviderCellManager.java | 6 +- .../META-INF/MANIFEST.MF | 3 +- .../cell/ValueSpecificationCellManager.java | 15 +- .../META-INF/MANIFEST.MF | 6 +- .../cell/StereotypePropertyCellManager.java | 8 +- .../manager/cell/UMLFeatureCellManager.java | 2 +- ...bstractCreateStereotypePropertyMenuFactory.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../handler/AbstractEMFCommandHandler.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../modelrepair/handler/SwitchLibraryHandler.java | 2 +- .../StereotypeApplicationRepairSnippet.java | 2 +- .../stereotypes/StereotypeRepairService.java | 2 +- .../uml/modelrepair/ui/SwitchLibraryDialog.java | 7 +- .../uml/modelrepair/ui/SwitchProfileDialog.java | 7 +- .../ui/ZombieStereotypeDialogPresenter.java | 2 +- .../modelrepair/ui/ZombieStereotypesDialog.java | 13 +- .../META-INF/MANIFEST.MF | 3 +- .../uml/org.eclipse.papyrus.uml.profile/plugin.xml | 2 +- .../profile/service/ReapplyProfilesService.java | 6 +- .../META-INF/MANIFEST.MF | 5 +- .../uml/search/ui/query/AbstractPapyrusQuery.java | 21 +- .../uml/search/ui/results/PapyrusSearchResult.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../handlers/AbstractCreateCommandHandler.java | 2 +- .../AbstractCreateElementCommandHandler.java | 2 +- .../uml/service/types/helper/ExtensionHelper.java | 2 +- .../types/menu/AbstractCreateUmlChildMenu.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../drafter/ui/handler/AbstractBaseHandler.java | 301 ++-- .../META-INF/MANIFEST.MF | 3 +- .../ui/contentassist/UmlStateProposalProvider.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../uml/tools/utils/UMLStringValueConverter.java | 20 +- .../META-INF/MANIFEST.MF | 3 +- .../eclipse/papyrus/uml/tools/model/UmlUtils.java | 2 +- .../uml/tools/providers/UMLContentProvider.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../xtext/integration/CompletionProposalUtils.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../papyrus/views/modelexplorer/LinkHelper.java | 10 +- .../views/modelexplorer/ModelExplorerPage.java | 2 +- .../ModelExplorerTreeViewerContext.java | 2 +- .../views/modelexplorer/ModelExplorerView.java | 61 +- .../EditingDomainActionProvider.java | 2 +- .../views/modelexplorer/actions/OpenWithMenu.java | 2 +- .../ui/pagebookview/MultiViewPageBookView.java | 2 +- .../dnd/CommonDropAdapterAssistant.java | 8 +- .../handler/AbstractModelExplorerHandler.java | 6 +- .../views/modelexplorer/handler/CloseHandler.java | 2 +- .../handler/DeleteCommandHandler.java | 14 +- .../handler/LoadBrowserCustomization.java | 15 +- .../views/modelexplorer/handler/OpenHandler.java | 2 +- .../listener/DoubleClickListener.java | 14 +- .../modelexplorer/provider/PropertyTester.java | 11 +- .../queries/AbstractGetEditorIconQuery.java | 6 +- .../views/modelexplorer/queries/IsOpenedPage.java | 9 +- .../META-INF/MANIFEST.MF | 3 +- .../papyrus/views/search/scope/ScopeEntry.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../validation/internal/ModelValidationView.java | 2 +- releng/main-tests/pom.xml | 1 + releng/main/pom.xml | 2 + .../META-INF/MANIFEST.MF | 4 +- .../editor/ProgramaticPapyrusEditor.java | 2 +- .../operationhistory/OperationHistoryHandler.java | 2 +- .../editor/ProgramaticPapyrusEditorTest.java | 2 +- .../META-INF/MANIFEST.MF | 12 +- .../META-INF/MANIFEST.MF | 19 +- .../cdo/ui/tests/AbstractPapyrusCDOUITest.java | 10 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 5 +- .../papyrus/cpp/codegen/tests/CppCodegenTest.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../rsa/tests/qvt/AbstractTransformationTest.java | 2 +- .../migration/rsa/tests/qvt/ImportDiagramTest.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../integration/tests/tests/EditorReloadTest.java | 2 +- .../integration/tests/tests/ModelSetTests.java | 6 +- .../integration/tests/tests/PageManagerTests.java | 137 +- .../integration/tests/tests/RecoveryTest.java | 60 +- .../internal/PageManagerImplTest.java | 487 ++++++ .../contentprovider/internal/PageMngrImplTest.java | 482 ------ .../infra/core/sasheditor/di/tests/AllTests.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../NestedEditorDelegatedOutlinePageTest.java | 46 - .../infra/core/lifecycleevents/FakeSaveEvent.java | 25 - .../lifecycleevents/FakeSaveEventListener.java | 55 - .../LifeCycleEventsProviderTest.java | 278 ---- .../lifecycleevents/SaveAndDirtyServiceTest.java | 100 -- .../eclipse/papyrus/infra/core/tests/AllTests.java | 15 +- .../META-INF/MANIFEST.MF | 3 +- .../tests/AbstractElementTypeTests.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../tests/AbstractElementTypeTests.java | 2 +- .../org.eclipse.papyrus.tests/META-INF/MANIFEST.MF | 3 +- .../test/org/eclipse/papyrus/tests/AllTests.java | 10 +- .../META-INF/MANIFEST.MF | 6 +- .../welcome/tests/WelcomeModelElementTest.java | 2 +- .../infra/gmfdiag/common/tests/AssistantUsage.java | 129 +- .../common/tests/ExpansionAddBorderItem.java | 58 +- .../common/tests/ExpansionAddChildLabel.java | 104 +- .../common/tests/ExpansionAddCompartment.java | 80 +- .../tests/ExpansionAddCompartmentWithKind.java | 80 +- .../gmfdiag/common/tests/ExpansionAddLink.java | 72 +- .../common/tests/ExpansionDropElements.java | 119 +- .../META-INF/MANIFEST.MF | 5 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 5 +- .../common/tests/AbstractTableHelperAPITest.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 8 +- .../nattable/views/tests/tests/OpenTableTest.java | 2 +- .../views/tests/tests/TableCreationTest.java | 2 +- .../views/tests/tests/TableCreationTest2.java | 4 +- .../views/tests/tests/TableVerifyContents.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../papyrus/infra/tools/tests/AllTests.java | 8 +- .../papyrus/infra/tools/util/UIUtilTest.java | 211 --- .../org.eclipse.papyrus.infra.ui.tests/.classpath | 7 + .../org.eclipse.papyrus.infra.ui.tests/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 291 ++++ .../.settings/org.eclipse.jdt.ui.prefs | 68 + .../META-INF/MANIFEST.MF | 19 + .../org.eclipse.papyrus.infra.ui.tests/about.html | 28 + .../build.properties | 17 + .../org.eclipse.papyrus.infra.ui.tests.launch | 41 + .../org.eclipse.papyrus.infra.ui.tests/pom.xml | 15 + .../NestedEditorDelegatedOutlinePageTest.java | 47 + .../infra/ui/lifecycleevents/FakeSaveEvent.java | 25 + .../ui/lifecycleevents/FakeSaveEventListener.java | 58 + .../LifeCycleEventsProviderTest.java | 281 ++++ .../lifecycleevents/SaveAndDirtyServiceTest.java | 103 ++ .../eclipse/papyrus/infra/ui/tests/AllTests.java | 40 + .../eclipse/papyrus/infra/ui/util/UIUtilTest.java | 212 +++ .../META-INF/MANIFEST.MF | 4 +- .../tests/control/AbstractControlModeTest.java | 4 +- .../uncontrol/AbstractUncontrolModelTest.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 5 +- .../eclipse/papyrus/junit/utils/DiagramUtils.java | 2 +- .../eclipse/papyrus/junit/utils/EditorUtils.java | 10 +- .../papyrus/junit/utils/ModelExplorerUtils.java | 2 +- .../junit/utils/rules/AbstractHouseKeeperRule.java | 2 +- .../junit/utils/rules/PapyrusEditorFixture.java | 26 +- .../junit/utils/tests/AbstractEditorTest.java | 4 +- .../blockdefinition/tests/utils/EditorUtils.java | 22 +- .../internalblock/tests/utils/EditorUtils.java | 22 +- .../META-INF/MANIFEST.MF | 3 +- .../diagram/parametric/tests/AbstractTest4B.java | 17 +- .../parametric/tests/utils/EditorUtils.java | 22 +- .../META-INF/MANIFEST.MF | 8 +- .../META-INF/MANIFEST.MF | 7 +- .../tests/bugs/AbstractAxisChangeIndexTest.java | 4 +- .../bugs/AbstractInvertedAxisChangeIndexTest.java | 4 +- .../tests/importfile/AbstractImportTest.java | 2 +- .../tests/insert/AbstractInsertTest.java | 2 +- .../overwrite/AbstractPasteEmptyOverwriteTest.java | 2 +- .../overwrite/AbstractPasteOverwriteTest.java | 2 +- .../service/edit/AbstractOpenTableTest.java | 2 +- .../without/service/edit/AbstractPasteTests.java | 2 +- .../requirement/tests/tests/OpenTableTest.java | 2 +- .../tests/tests/TableCreationInSysMLModelTest.java | 2 +- .../tests/tests/TableCreationInUMLModel.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../modelexplorer/tests/utils/EditorUtils.java | 10 +- .../META-INF/MANIFEST.MF | 6 +- .../META-INF/MANIFEST.MF | 7 +- .../test/legacy/PackageDiagramLegacyTest.java | 24 +- .../META-INF/MANIFEST.MF | 5 +- .../META-INF/MANIFEST.MF | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../dnd/tests/tests/InstanceSpecificationTest.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- ...g457712PaletteConfigurationRequiredProfile.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../diagram/sequence/tests/canonical/TestLink.java | 2 +- .../sequence/tests/canonical/TestTopNode.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../AbstractPapyrusTestCase.java | 2 +- .../TestUnapplyProfile2ClosedDiagComment.java | 2 +- .../TestUnapplyProfile2Comment.java | 2 +- .../TestUnapplyStereotypeComment.java | 2 +- .../tests/creation/TestCreationReopen2Comment.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../tests/canonical/AbstractPapyrusTestCase.java | 2 +- .../tests/canonical/SharedTestSuiteState.java | 2 +- .../uml/diagram/tests/canonical/TestLink.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../META-INF/MANIFEST.MF | 6 +- .../tests/canonical/TestSpecificTopNode.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../META-INF/MANIFEST.MF | 4 +- .../tests/bugs/AbstractAxisChangeIndexTest.java | 2 +- .../DeleteRequirementsWithNestedClassifier.java | 2 +- .../tests/bugs/EditInvalidPastedText_V1_V3_V1.java | 2 +- .../tests/bugs/MoveElementsTreeTableTest.java | 2 +- .../bugs/NoDepth0TreeFillingConfigurationTest.java | 2 +- .../clazz/config/tests/bugs/OpenAndDeleteTest.java | 2 +- .../tests/bugs/RequirementsNestedClassifier.java | 2 +- .../tests/filter/AbstractReopenFilteredTable.java | 2 +- .../tests/importfile/AbstractImportTest.java | 2 +- .../config/tests/insert/AbstractInsertTest.java | 2 +- .../overwrite/AbstractPasteEmptyOverwriteTest.java | 2 +- .../paste/overwrite/AbstractPasteInsertTest.java | 4 +- .../overwrite/AbstractPasteOverwriteTest.java | 2 +- .../tests/AbstractPasteWithCategoriesTests.java | 4 +- .../tests/styles/AbstractResizeHeaderTest.java | 2 +- .../config/tests/tests/AbstractOpenTableTest.java | 2 +- ...sAndExpandWithoutCategories_H0_H1_H2_Tests.java | 3 +- .../tests/unset/AbstractUnsetCellValueTest.java | 2 +- .../UnsetCellValueWithProfile_V1_V3_V1_Test.java | 2 +- .../tests/unset/UnsetCellValue_H1_H3_H1_Test.java | 2 +- .../META-INF/MANIFEST.MF | 8 +- .../tests/bugs/AbstractAxisChangeIndexTest.java | 4 +- .../bugs/AbstractInvertedAxisChangeIndexTest.java | 4 +- .../bugs/AddElementsOnConnectedTableTest.java | 2 +- .../tests/bugs/CellEditorsConfigurationTest.java | 4 +- .../generic/tests/bugs/OpenAndDeleteTest.java | 2 +- .../tests/importfile/AbstractImportTest.java | 2 +- .../generic/tests/insert/AbstractInsertTest.java | 2 +- .../overwrite/AbstractPasteEmptyOverwriteTest.java | 2 +- .../overwrite/AbstractPasteOverwriteTest.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../tests/tests/StereotypeDisplayTableTest.java | 40 +- .../creation/AbstractCreateRelationshipTest.java | 2 +- .../types/tests/creation/CreateElementTest.java | 2 +- .../types/tests/creation/MoveElementTest.java | 2 +- .../types/tests/creation/SetFeatureTest.java | 2 +- .../tests/deletion/DeleteAssociationTest.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../modelexplorer/tests/AbstractHandlerTest.java | 16 +- .../modelexplorer/tests/DeleteHandlerTest.java | 2 +- 1008 files changed, 34986 insertions(+), 32615 deletions(-) delete mode 100644 plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/di.ecore delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di2 delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.genmodel delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.notation delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.uml delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.xml delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageManager.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/AbstractLocalPageService.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/ILocalPageService.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.classpath create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.project create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.ui.prefs create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/about.html create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/build.properties create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/di.ecore create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di2 create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.genmodel create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.notation create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.uml create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.properties create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.xml create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/AbstractLocalPageService.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/ILocalPageService.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/IPageManager.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/PapyrusLogo32x32.png delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/Papyrus_32x32_t.gif delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus.gif delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus_16x16.gif delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/schema/contentOutline.exsd delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/schema/papyrusDiagram.exsd delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/schema/readme.txt delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/ContentOutlineRegistry.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/IPapyrusContentOutlinePage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/ContentProviderServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelManagerServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelMngrServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IMultiDiagramEditor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IPapyrusPageInput.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IReloadableEditor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramEditorSelectionContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageIconRegistryServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageMngrServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PapyrusPageInput.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/CompositeReloadContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/DelegatingReloadContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFSelectionContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFTreeViewerContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadAdapter.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadEvent.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IDisposableReloadContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IEditorReloadListener.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IInternalEMFSelectionContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IReloadContextProvider.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/SelectionContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/TreeViewerContext.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactoryExtended.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistry.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistryExtended.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageIconsRegistry.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageModelFactoryRegistry.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/anytype/AnyTypeEditorFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/ICreationCondition.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/IModelCreationCommand.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/PerspectiveContextDependence.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/AbstractEditorFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptorExtensionFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorFactoryProxy.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorIconFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorNotFoundException.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/IPluggableEditorFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/MultiDiagramException.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/PluggableEditorFactoryReader.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/PageLayoutStorageState.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/TogglePageLayoutStorageHandler.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferencePage.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferences.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/Messages.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/YesNo.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/messages.properties create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/BasicPageManagerServiceFactory.java create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/TransactionalBasicPageManagerImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/DoSaveEvent.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/IEditorInputChangedListener.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ILifeCycleEventsProvider.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveAndDirtyService.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveEventListener.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProvider.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderServiceFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/IActionBarContributorFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashLayoutCommandFactory.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleEventListener.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleManager.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/Messages.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/ResourceUpdateService.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/SaveLayoutBeforeClose.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/EditorLifecycleManagerImpl.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/InternalEditorLifecycleManager.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/messages.properties create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/spi/IContextualServiceRegistryTracker.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/PapyrusImageUtils.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java delete mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java delete mode 100644 plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFStringValueConverter.java create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.classpath create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.project create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.ui.prefs create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/about.html create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/build.properties create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.properties create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.xml create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/pom.xml create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/Activator.java create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/CoreMultiDiagramEditorAdapterFactory.java create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/MultiDiagramEditorGefDelegate.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/DelegatingUIExecutorService.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/converter/AbstractStringValueConverter.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/converter/ConvertedValueContainer.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/converter/IStringValueConverter.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/converter/MultiConvertedValueContainer.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/converter/StringValueConverterStatus.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/dnd/PapyrusTransfer.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/messages/Messages.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/messages/messages.properties delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/AbstractPapyrusPreferenceStore.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/PapyrusScopedPreferenceStore.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractApplyValueOnPreferenceKeyDialog.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractPreferenceKeyDialog.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/spi/IExecutorServiceFactory.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/AbstractCreateMenuFromCommandCategory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/CoreExecutors.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EditorHelper.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ICallableWithProgress.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/IExecutorService.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/LocalMemento.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/SelectionHelper.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/UIUtil.java delete mode 100644 plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/WorkbenchPartHelper.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/PapyrusLogo32x32.png create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/Papyrus_32x32_t.gif create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus.gif create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus_16x16.gif create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/schema/contentOutline.exsd create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/schema/papyrusDiagram.exsd create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/ContentOutlineRegistry.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/IPapyrusContentOutlinePage.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePage.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/AbstractStringValueConverter.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/ConvertedValueContainer.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/EMFStringValueConverter.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/IStringValueConverter.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/MultiConvertedValueContainer.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/StringValueConverterStatus.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/dnd/PapyrusTransfer.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/ContentProviderServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/CoreMultiDiagramEditor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelManagerServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelMngrServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IMultiDiagramEditor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IPapyrusPageInput.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IReloadableEditor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramEditorSelectionContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageIconRegistryServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageMngrServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PapyrusPageInput.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/CompositeReloadContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/DelegatingReloadContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFSelectionContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFTreeViewerContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadAdapter.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadEvent.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IDisposableReloadContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IEditorReloadListener.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IInternalEMFSelectionContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IReloadContextProvider.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/SelectionContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/TreeViewerContext.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactoryExtended.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistry.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistryExtended.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageIconsRegistry.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageModelFactoryRegistry.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/anytype/AnyTypeEditorFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/ICreationCondition.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/IModelCreationCommand.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/PerspectiveContextDependence.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/AbstractEditorFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptorExtensionFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorFactoryProxy.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorIconFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorNotFoundException.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/IPluggableEditorFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/MultiDiagramException.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/PluggableEditorFactoryReader.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/PageLayoutStorageState.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/TogglePageLayoutStorageHandler.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferencePage.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferences.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/Messages.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/YesNo.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/messages.properties create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/DoSaveEvent.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/IEditorInputChangedListener.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ILifeCycleEventsProvider.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveAndDirtyService.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveEventListener.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProvider.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderServiceFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyService.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/IActionBarContributorFactory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/AbstractPapyrusPreferenceStore.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/PapyrusScopedPreferenceStore.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractApplyValueOnPreferenceKeyDialog.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractPreferenceKeyDialog.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleEventListener.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleManager.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/Messages.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/ResourceUpdateService.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/SaveLayoutBeforeClose.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/EditorLifecycleManagerImpl.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/InternalEditorLifecycleManager.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/messages.properties create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/AbstractCreateMenuFromCommandCategory.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/DisplayUtils.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EclipseCommandUtils.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorHelper.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorUtils.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ICallableWithProgress.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/LocalMemento.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/PapyrusImageUtils.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/SelectionHelper.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForActionHandlers.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForWorkbenchPage.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/TransactionUIHelper.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/UIUtil.java create mode 100644 plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePageTest.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEvent.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEventListener.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderTest.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyServiceTest.java delete mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/util/UIUtilTest.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.classpath create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.project create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.ui.prefs create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/about.html create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/build.properties create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/org.eclipse.papyrus.infra.ui.tests.launch create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/pom.xml create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePageTest.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEvent.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEventListener.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderTest.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyServiceTest.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/tests/AllTests.java create mode 100644 tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/util/UIUtilTest.java diff --git a/extraplugins/EFFBD/org.eclipse.papyrus.effbd/META-INF/MANIFEST.MF b/extraplugins/EFFBD/org.eclipse.papyrus.effbd/META-INF/MANIFEST.MF index 000eff6a5de..f288e71d01d 100644 --- a/extraplugins/EFFBD/org.eclipse.papyrus.effbd/META-INF/MANIFEST.MF +++ b/extraplugins/EFFBD/org.eclipse.papyrus.effbd/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.1.3", org.eclipse.papyrus.uml.tools.utils, org.eclipse.papyrus.extensionpoints.editors, - org.eclipse.papyrus.infra.emf.appearance + org.eclipse.papyrus.infra.emf.appearance, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF index bda5ada9e89..aa339514ef8 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.osgi.profile, org.eclipse.core.expressions;bundle-version="3.5.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0" + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier Bundle-Localization: plugin diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java index ec3626fa3e3..dd437b69b03 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java @@ -25,7 +25,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.PlatformUI; diff --git a/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/META-INF/MANIFEST.MF b/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/META-INF/MANIFEST.MF index 44f08ffe1c6..9a7ded90206 100644 --- a/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/META-INF/MANIFEST.MF +++ b/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", org.eclipse.papyrus.uml.tools.extendedtypes;bundle-version="1.2.0", org.eclipse.gmf.tooling.runtime;bundle-version="3.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", - org.eclipse.gmf.runtime.diagram.core + org.eclipse.gmf.runtime.diagram.core, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.bpmn.diagram.common, org.eclipse.papyrus.bpmn.diagram.common.commands, org.eclipse.papyrus.bpmn.diagram.common.edit.part, diff --git a/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/plugin.xml b/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/plugin.xml index 3f64ce1a9c8..2e9c0068bf6 100644 --- a/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/plugin.xml +++ b/extraplugins/bpmn/org.eclipse.papyrus.bpmn.diagram.common/plugin.xml @@ -2,7 +2,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + serviceKeyRef="org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor"> 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 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/CommandSupport.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/CommandSupport.java index a3e32434420..d1b408c7852 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/CommandSupport.java +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/CommandSupport.java @@ -23,7 +23,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; /** * Utility function. Allow execution of commands on a transactional command stack diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java index 4ae37530cac..3d37ad4570f 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java @@ -36,12 +36,12 @@ import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; import org.eclipse.papyrus.texteditor.cdt.Activator; import org.eclipse.papyrus.texteditor.cdt.sync.ObtainICElement; import org.eclipse.papyrus.texteditor.cdt.sync.RevealCurrentOperation; diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/factory/PapyrusCDTEditorFactory.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/factory/PapyrusCDTEditorFactory.java index f4f552858e7..ce3d0697767 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/factory/PapyrusCDTEditorFactory.java +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/factory/PapyrusCDTEditorFactory.java @@ -16,11 +16,11 @@ package org.eclipse.papyrus.texteditor.cdt.factory; import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory; -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.ui.extension.diagrameditor.AbstractEditorFactory; +import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry; import org.eclipse.papyrus.texteditor.cdt.Activator; import org.eclipse.papyrus.texteditor.cdt.editor.PapyrusCDTEditor; import org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel; @@ -42,7 +42,7 @@ public class PapyrusCDTEditorFactory extends AbstractEditorFactory { /** * Create the IPageModel that is used by the SashWindows to manage the editor. * - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object) + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object) * * @param pageIdentifier * The model pushed in the sashmodel by the creation command @@ -54,7 +54,7 @@ public class PapyrusCDTEditorFactory extends AbstractEditorFactory { } /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) * * @param pageIdentifier * @return diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java index 7d6df1edfc4..5131d325044 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * + * Copyright (c) 2012, 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 @@ -10,6 +9,7 @@ * Contributors: * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.texteditor.cdt.handler; @@ -31,13 +31,13 @@ import org.eclipse.papyrus.codegen.extensionpoints.ILangCodegen; import org.eclipse.papyrus.codegen.extensionpoints.LanguageCodegen; import org.eclipse.papyrus.commands.CheckedOperationHistory; import org.eclipse.papyrus.infra.core.resource.NotFoundException; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -81,8 +81,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { // Filter Classes (including Behaviors, since Behavior inherits from Class), Operation and Transition if (selectedEObject instanceof Class || selectedEObject instanceof Operation || - selectedEObject instanceof Transition) - { + selectedEObject instanceof Transition) { URI uri = selectedEObject.eResource().getURI(); // URIConverter uriConverter = resource.getResourceSet().getURIConverter(); @@ -147,7 +146,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { */ public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException { // Get the page manager allowing to add/open an editor. - final IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + final IPageManager pageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry); Classifier classifierToEdit = getClassifierToEdit(); TextEditorModel editorModel = getEditorModel(serviceRegistry, classifierToEdit); @@ -163,7 +162,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { if (codegen.getTargetProject(classifierToEdit, true) == null) { return; } - + if (selectedEObject instanceof Transition) { Transition transition = (Transition) selectedEObject; if (transition.getEffect() == null) { @@ -182,8 +181,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { if (pageMngr.isOpen(editorModelFinal)) { // select existing editor pageMngr.selectPage(editorModelFinal); - } - else { + } else { pageMngr.openPage(editorModelFinal); } try { @@ -194,13 +192,12 @@ public class PapyrusCDTEditorHandler extends CmdHandler { if (rootModel instanceof TabFolder) { // root = tabFolder, i.e. there is a single folder - ISashWindowsContainer sashContainer = ServiceUtils.getInstance().getISashWindowsContainer(serviceRegistry); + ISashWindowsContainer sashContainer = ServiceUtils.getInstance().getService(ISashWindowsContainer.class, serviceRegistry); int index = lookupIndex((TabFolder) rootModel, editorModelFinal); if (index != -1) { sashContentProvider.createFolder(sashContainer.getSelectedTabFolderModel(), index, sashContainer.getSelectedTabFolderModel(), SWT.RIGHT); } - } - else if (rootModel instanceof SashPanel) { + } else if (rootModel instanceof SashPanel) { // multiple tab-folders exist. Find existing one and move editorModel to other // TODO // ISashWindowsContainer sashContainer = ServiceUtils.getInstance().getISashWindowsContainer(serviceRegistry); @@ -234,8 +231,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { return null; } editorModel.setGeneratorID(LanguageCodegen.getID(codegen)); - TextEditorModelSharedResource model = (TextEditorModelSharedResource) - ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID); + TextEditorModelSharedResource model = (TextEditorModelSharedResource) ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID); model.addTextEditorModel(editorModel); return editorModel; @@ -249,11 +245,9 @@ public class PapyrusCDTEditorHandler extends CmdHandler { protected Classifier getClassifierToEdit() { if (selectedEObject instanceof Operation) { return ((Operation) selectedEObject).getFeaturingClassifiers().get(0); - } - else if (selectedEObject instanceof Transition) { + } else if (selectedEObject instanceof Transition) { return ((Transition) selectedEObject).getContainer().getStateMachine().getContext(); - } - else if (selectedEObject instanceof Behavior) { + } else if (selectedEObject instanceof Behavior) { Element owner = (Behavior) selectedEObject; while (owner != null) { owner = owner.getOwner(); @@ -262,8 +256,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { } } return null; - } - else if (selectedEObject instanceof Classifier) { + } else if (selectedEObject instanceof Classifier) { // must be class or datatype return (Classifier) selectedEObject; } @@ -282,8 +275,7 @@ public class PapyrusCDTEditorHandler extends CmdHandler { * @throws NotFoundException */ protected TextEditorModel getEditorModel(final ServicesRegistry serviceRegistry, Classifier classifierToEdit) throws ServiceException, NotFoundException { - TextEditorModelSharedResource model = (TextEditorModelSharedResource) - ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID); + TextEditorModelSharedResource model = (TextEditorModelSharedResource) ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID); return model.getTextEditorModel(classifierToEdit); } diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF index 3e836907323..4a263ec3c2e 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0", org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.100" + org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.100", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.views.cpp; uses:="org.eclipse.ui, com.cea.papyrus.views.panels, org.eclipse.jface.viewers, diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CommandSupport.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CommandSupport.java index ab69b52fd0d..46c46adb5ae 100644 --- a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CommandSupport.java +++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CommandSupport.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; /** * Utility function. Allow adaption to command stack diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF index b24c01b97bd..831105a95fd 100644 --- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF +++ b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.diagram.core, org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf.diagram.common;bundle-version="1.2.0", - org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0" + org.eclipse.papyrus.uml.diagram.common;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/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java index 5c5568282c7..491ddc1c18a 100644 --- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java +++ b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java @@ -28,7 +28,7 @@ import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.java.reverse.ui.dialog.DndReverseCodeDialog; import org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog; import org.eclipse.papyrus.uml.diagram.common.util.MDTUtil; diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java index 433344eba35..6bd5d992149 100644 --- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java +++ b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java @@ -17,10 +17,10 @@ import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog; import org.eclipse.papyrus.uml.tools.model.UmlUtils; import org.eclipse.swt.widgets.Shell; diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java index 848f5ea6cbc..f9388cdfd3b 100644 --- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java +++ b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java @@ -20,7 +20,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.java.reverse.utils.TypeOperationsEnhanced; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; diff --git a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.classpath b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.classpath index ad32c83a788..098194ca4b7 100644 --- a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.classpath +++ b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.classpath @@ -1,6 +1,6 @@ - + diff --git a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.settings/org.eclipse.jdt.core.prefs b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.settings/org.eclipse.jdt.core.prefs index 94d61f00da6..f08be2b06c4 100644 --- a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.settings/org.eclipse.jdt.core.prefs +++ b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/.settings/org.eclipse.jdt.core.prefs @@ -1,10 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/META-INF/MANIFEST.MF b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/META-INF/MANIFEST.MF index a09b81b1fc6..671eafefef9 100644 --- a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/META-INF/MANIFEST.MF +++ b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.emf.transaction;bundle-version="1.8.0" + org.eclipse.emf.transaction;bundle-version="1.8.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.codegen.base, org.eclipse.papyrus.codegen.base.codesync Bundle-Vendor: %providerName @@ -17,4 +18,4 @@ Bundle-Localization: plugin Bundle-ManifestVersion: 2 Bundle-Activator: org.eclipse.papyrus.codegen.base.Activator Bundle-SymbolicName: org.eclipse.papyrus.codegen.base;singleton:=true -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/src/org/eclipse/papyrus/codegen/base/codesync/ManageChangeEvents.java b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/src/org/eclipse/papyrus/codegen/base/codesync/ManageChangeEvents.java index fdac34742d7..2b1c77b6402 100644 --- a/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/src/org/eclipse/papyrus/codegen/base/codesync/ManageChangeEvents.java +++ b/extraplugins/qompass/codegen/org.eclipse.papyrus.codegen.base/src/org/eclipse/papyrus/codegen/base/codesync/ManageChangeEvents.java @@ -20,12 +20,12 @@ import java.util.Map; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.codegen.base.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleEventListener; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.services.EditorLifecycleEventListener; +import org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager; /** * Manage and update change events for incremental code generation diff --git a/extraplugins/qompass/codegen/org.eclipse.papyrus.texteditor.modelexplorer/META-INF/MANIFEST.MF b/extraplugins/qompass/codegen/org.eclipse.papyrus.texteditor.modelexplorer/META-INF/MANIFEST.MF index f3e062e8080..1b103be399d 100644 --- a/extraplugins/qompass/codegen/org.eclipse.papyrus.texteditor.modelexplorer/META-INF/MANIFEST.MF +++ b/extraplugins/qompass/codegen/org.eclipse.papyrus.texteditor.modelexplorer/META-INF/MANIFEST.MF @@ -21,5 +21,5 @@ Bundle-Version: 1.2.0.qualifier Bundle-ManifestVersion: 2 Bundle-Activator: org.eclipse.papyrus.texteditor.modelexplorer.Activator Bundle-SymbolicName: org.eclipse.papyrus.texteditor.modelexplorer;singleton:=true -Import-Package: org.eclipse.papyrus.infra.core.editorsfactory, +Import-Package: org.eclipse.papyrus.infra.ui.editorsfactory, org.eclipse.papyrus.infra.viewpoints.policy diff --git a/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/META-INF/MANIFEST.MF b/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/META-INF/MANIFEST.MF index 6908c801140..b6f74cde686 100644 --- a/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/META-INF/MANIFEST.MF +++ b/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.papyrus.fcm.profile;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", org.eclipse.xtext.xbase.lib, org.eclipse.xtend.lib, - org.eclipse.xtend.lib.macro + org.eclipse.xtend.lib.macro, + 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/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java b/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java index 8e286a6792e..adf406d18eb 100644 --- a/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java +++ b/extraplugins/qompass/designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java @@ -16,10 +16,10 @@ import org.eclipse.papyrus.FCM.ContainerRule; import org.eclipse.papyrus.FCM.RuleApplication; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism; import org.eclipse.papyrus.infra.services.tracepoints.MarkerUtils; import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAOperation; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.services.tracepoints.TracepointConstants; import org.eclipse.papyrus.qompass.designer.core.Description; import org.eclipse.papyrus.qompass.designer.core.Log; diff --git a/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/META-INF/MANIFEST.MF b/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/META-INF/MANIFEST.MF index bd97d331b4c..b6795fb088f 100644 --- a/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/META-INF/MANIFEST.MF +++ b/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/META-INF/MANIFEST.MF @@ -8,7 +8,8 @@ Require-Bundle: org.eclipse.papyrus.uml.tools.utils, org.eclipse.papyrus.uml.diagram.common, org.eclipse.ui, org.eclipse.core.runtime, - org.eclipse.papyrus.infra.core;bundle-version="1.2.0" + org.eclipse.papyrus.infra.core;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor diff --git a/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/plugin.xml b/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/plugin.xml index 0ada562a96a..bc2fec87e6e 100644 --- a/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/plugin.xml +++ b/extraplugins/req/org.eclipse.papyrus.req.bmm.diagram.common/plugin.xml @@ -2,7 +2,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - Copyright (c) 2012 CEA LIST + Copyright (c) 2012, 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 @@ -21,6 +21,8 @@ http://www.eclipse.org/legal/epl-v10.html + + diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.gmfdiag.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.gmfdiag.feature/feature.xml index 2780c94cf0e..675052489a9 100644 --- a/features/papyrus-main-features/org.eclipse.papyrus.infra.gmfdiag.feature/feature.xml +++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.gmfdiag.feature/feature.xml @@ -1,7 +1,7 @@ - Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others. + Copyright (c) 2012, 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 @@ -31,6 +31,8 @@ http://www.eclipse.org/legal/epl-v10.html + + diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml index 2507039b24c..b75df8562a2 100644 --- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml +++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml @@ -1,7 +1,7 @@ - Copyright (c) 2008, 2015 CEA LIST, Atos Origin, Conselleria de + Copyright (c) 2008, 2016 CEA LIST, Atos Origin, Conselleria de Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana, Christian W. Damus, and others. All rights reserved. This program and the accompanying materials @@ -26,6 +26,8 @@ http://www.eclipse.org/legal/epl-v10.html + + diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend index 760b8b2e38c..590c26f7440 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend @@ -481,8 +481,8 @@ def selectionChanged (GenEditorView it)''' «generatedMemberComment» @Override public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) { - if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor) { - org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor(); + if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) { + org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor(); // If not the active editor, ignore selection changed. if (this.equals(editor.getActiveEditor())) { updateActions(getSelectionActions()); diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend index 47cf84a0fcd..90283e76a92 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend @@ -46,6 +46,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.gmfdiag.common, org.eclipse.papyrus.uml.service.types, org.eclipse.papyrus.infra.widgets, + org.eclipse.papyrus.infra.ui, + org.eclipse.papyrus.infra.core.sashwindows.di, «IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing, org.eclipse.gmf.runtime.diagram.ui.printing.render, «ENDIF» diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.java deleted file mode 100644 index 585e65a24e8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.papyrus.elementtypesconfigurations.developer.generator; - -import com.google.common.collect.Iterables; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; - -@SuppressWarnings("all") -public class ElementTypeRegistryGenerator { - public static Iterable allContentsIterable(final Resource resource) { - TreeIterator _allContents = resource.getAllContents(); - return IteratorExtensions.toIterable(_allContents); - } - - public static String camelToUnderScore(final String in) { - String regex = "([a-z])([A-Z])"; - String replacement = "$1_$2"; - return in.replaceAll(regex, replacement); - } - - public static String safeName(final String in) { - String result = ElementTypeRegistryGenerator.camelToUnderScore(in); - String _replaceAll = result.replaceAll("[^A-Za-z0-9]", "_"); - result = _replaceAll; - String _replaceAll_1 = result.replaceAll("_{2,}", "_"); - result = _replaceAll_1; - String _upperCase = result.toUpperCase(); - result = _upperCase; - String _replaceAll_2 = result.replaceAll("UML_", ""); - result = _replaceAll_2; - return result; - } - - public static CharSequence generateRegistry(final Resource it, final String outputType) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/*****************************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* Copyright (c) 2014 CEA LIST."); - _builder.newLine(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* All rights reserved. This program and the accompanying materials"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* are made available under the terms of the Eclipse Public License v1.0"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* which accompanies this distribution, and is available at"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* http://www.eclipse.org/legal/epl-v10.html"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* Contributors:"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* \t\tCEA LIST - Initial API and implementation"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*****************************************************************************/"); - _builder.newLine(); - _builder.append("import org.eclipse.gmf.runtime.emf.type.core.AbstractElementTypeEnumerator;"); - _builder.newLine(); - _builder.append("import org.eclipse.gmf.runtime.emf.type.core.IHintedType;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - _builder.append(outputType, ""); - _builder.append(" extends AbstractElementTypeEnumerator {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/** Constant for UML nature */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public static final String UML_NATURE = \"UML_Nature\";"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - Iterable _allContentsIterable = ElementTypeRegistryGenerator.allContentsIterable(it); - Iterable _filter = Iterables.filter(_allContentsIterable, ElementTypeConfiguration.class); - for(final ElementTypeConfiguration elementTypeConfiguration : _filter) { - _builder.append("\t"); - _builder.append("public static final IHintedType "); - String _name = elementTypeConfiguration.getName(); - String _safeName = ElementTypeRegistryGenerator.safeName(_name); - String _upperCase = _safeName.toUpperCase(); - _builder.append(_upperCase, "\t"); - _builder.append(" = (IHintedType)getElementType(\""); - String _identifier = elementTypeConfiguration.getIdentifier(); - _builder.append(_identifier, "\t"); - _builder.append("\"); //$NON-NLS-1$"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } -} diff --git a/plugins/developer/org.eclipse.papyrus.uml.developer.mde/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.uml.developer.mde/META-INF/MANIFEST.MF index 50466118b98..5800a5549da 100644 --- a/plugins/developer/org.eclipse.papyrus.uml.developer.mde/META-INF/MANIFEST.MF +++ b/plugins/developer/org.eclipse.papyrus.uml.developer.mde/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.emf.ecore.edit;bundle-version="2.9.0", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.100" + org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.100", + 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/plugins/developer/org.eclipse.papyrus.uml.developer.mde/src/org/eclipse/papyrus/uml/developper/mde/handler/IDMAbstractHandler.java b/plugins/developer/org.eclipse.papyrus.uml.developer.mde/src/org/eclipse/papyrus/uml/developper/mde/handler/IDMAbstractHandler.java index 6bbd14fe10d..bd09f994fc3 100644 --- a/plugins/developer/org.eclipse.papyrus.uml.developer.mde/src/org/eclipse/papyrus/uml/developper/mde/handler/IDMAbstractHandler.java +++ b/plugins/developer/org.eclipse.papyrus.uml.developer.mde/src/org/eclipse/papyrus/uml/developper/mde/handler/IDMAbstractHandler.java @@ -34,9 +34,9 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.PlatformUI; import org.eclipse.uml2.uml.Element; diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java index 8615fee5bf2..3d066d90dad 100644 --- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java +++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java @@ -17,7 +17,7 @@ package org.eclipse.papyrus.editor; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.CoreComposedActionBarContributor; +import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.CoreComposedActionBarContributor; import org.eclipse.ui.IEditorActionBarContributor; diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java index cf889d72ff8..a1d532815ab 100644 --- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java +++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java @@ -14,8 +14,8 @@ package org.eclipse.papyrus.editor; -import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.ui.editor.CoreMultiDiagramEditor; /** * Papyrus main MultiEditor. This class add GMF adaptation dedicated to Papyrus. diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/.classpath b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/.classpath index cf9a62af9c3..badbd655541 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/.classpath +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/.classpath @@ -2,7 +2,6 @@ - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF index ae5263cb498..3d881990d21 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF @@ -2,11 +2,7 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider, org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.commands, org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal, - org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils, - org.eclipse.papyrus.infra.core.sashwindows.di, - org.eclipse.papyrus.infra.core.sashwindows.di.exception, - org.eclipse.papyrus.infra.core.sashwindows.di.impl, - org.eclipse.papyrus.infra.core.sashwindows.di.util + org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Bundle-Localization: plugin @@ -21,7 +17,8 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.5.0", org.eclipse.uml2.types;visibility:=reexport, org.eclipse.uml2.common;visibility:=reexport, org.eclipse.emf.transaction;bundle-version="1.4.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0" + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier Bundle-Activator: org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.Activator diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/build.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/build.properties index abbb33c3b41..f7235933ad9 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/build.properties +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/build.properties @@ -1,8 +1,8 @@ # #Mon Sep 12 09:30:11 CEST 2011 output..=bin/ -bin.includes=.,model/,META-INF/,plugin.xml,plugin.properties,about.html +bin.includes=.,META-INF/,plugin.properties,about.html jars.compile.order=. src.includes = about.html -source..=src/,custom-src/ +source..=custom-src/ bin..=bin/ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelManager.java index 5737b1ff72a..2d242f0b080 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelManager.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelManager.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013, 2015 Cedric Dumoulin, Christian W. Damus, and others. - * + * Copyright (c) 2013, 2016 Cedric Dumoulin, 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 @@ -9,7 +8,7 @@ * * Contributors: * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Christian W. Damus - bug 469188 + * Christian W. Damus - bugs 469188, 485220 * *****************************************************************************/ @@ -21,8 +20,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedProvider; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.ContentChangedEventProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.CurrentFolderAndPageManager; @@ -34,6 +31,7 @@ import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.Tra import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; @@ -245,15 +243,6 @@ public class DiSashModelManager { return contentChangedEventProvider; } - /** - * Get the IPageMngr providing basic methods to manage Pages in the sash model. - * - * @return - */ - public IPageMngr getIPageMngr() { - return getIPageManager(); - } - /** * Get the IPageManager providing basic methods to manage Pages in the sash model. * diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngr.java index 9fb452b4a0e..75a65785394 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngr.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngr.java @@ -17,13 +17,13 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedProvider; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.ContentChangedEventProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.DiContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalPageManagerImpl; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/IPageModelFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/IPageModelFactory.java index 1ae6b592b8c..c9a5991f9e7 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/IPageModelFactory.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/IPageModelFactory.java @@ -16,8 +16,8 @@ import java.util.Collections; import java.util.Map; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; /** diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/PageContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/PageContext.java index e64c3890932..168a4877f9b 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/PageContext.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/PageContext.java @@ -17,13 +17,13 @@ import java.util.Collection; import java.util.Collections; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.IPageUtils; import org.eclipse.papyrus.infra.core.sasheditor.editor.IComponentPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.ISources; import org.eclipse.ui.handlers.HandlerUtil; diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProvider.java index bdf672416fc..9ce92353972 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProvider.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProvider.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2009 CEA LIST & LIFL - * + * Copyright (c) 2009, 2016 CEA LIST, LIFL, 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 @@ -9,6 +8,7 @@ * * Contributors: * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -16,7 +16,6 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener.ContentEvent; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory; @@ -24,6 +23,7 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; /** @@ -130,7 +130,7 @@ public class DiContentProvider implements ISashWindowsContentProvider { * TabFolder. * * @param pageIdentifier - * @deprecated Not used by SashContainer. Use {@link IPageMngr#addPage(Object)} instead + * @deprecated Not used by SashContainer. Use {@link IPageManager#openPage(Object)} instead */ @Deprecated @Override diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImpl.java index bb3b6a56c1f..9430edf2787 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImpl.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImpl.java @@ -16,28 +16,13 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.service.ILocalPageService; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.Activator; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl; import org.eclipse.swt.widgets.Display; -import org.osgi.framework.FrameworkUtil; /** @@ -47,7 +32,16 @@ import org.osgi.framework.FrameworkUtil; * @author cedric dumoulin * */ -public class PageManagerImpl extends PageMngrImpl implements IPageManager { +public class PageManagerImpl extends BasicPageManagerImpl { + + /** + * An object used to get the current folder, or to ask to set the + * active page. + * This is usually backuped by the SashWindowContainer.
+ */ + private ICurrentFolderAndPageMngr folderAndPageMngr; + + private ContentChangedEventProvider contentChangedEventProvider; /** * Constructor. @@ -64,7 +58,10 @@ public class PageManagerImpl extends PageMngrImpl implements IPageManager { * */ protected PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) { - super(diSashModel, contentChangedEventProvider); + super(diSashModel); + + this.contentChangedEventProvider = contentChangedEventProvider; + this.folderAndPageMngr = new DefaultCurrentFolderAndPageMngr(diSashModel); } /** @@ -78,233 +75,46 @@ public class PageManagerImpl extends PageMngrImpl implements IPageManager { * the folder and page mngr */ protected PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) { - super(diSashModel, contentChangedEventProvider, folderAndPageMngr); - } + super(diSashModel); - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager#closeAllOpenedPages(java.lang.Object) - * - * @param pageIdentifier - */ - @Override - public void closeAllOpenedPages(Object pageIdentifier) { - while (isOpen(pageIdentifier)) { - closePage(pageIdentifier); - } + this.contentChangedEventProvider = contentChangedEventProvider; + this.folderAndPageMngr = folderAndPageMngr; } - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(java.lang.Object) - * - * @param pageIdentifier - */ @Override - public void addPage(Object pageIdentifier) { - // Nothing + protected TabFolder getCurrentFolder() { + return folderAndPageMngr.getCurrentFolder(); } - /** - * Reload the Diagram - * This used when a resource is reloaded, the related diagrams are reloaded as well - * - * @see org.eclipse.papyrus.infra.services.controlmode.listener.LoadResourceSnippet - * - * @param diagramProxy - * Identifier of the page to reload - */ @Override - public void reloadPage(Object diagramProxy) { - - if (diagramProxy instanceof EObject) { - - PageRef proxyRef = diSashModel.getSashModel().lookupPage(diagramProxy); - - if (proxyRef.eContainer() instanceof TabFolder) { - TabFolder folder = (TabFolder) proxyRef.eContainer(); - - - if (folder != null) { - if (folder.getChildren() != null) { - // get the initial index of the Diagram Tab - int i = folder.getChildren().indexOf(proxyRef); - - if (i >= 0) { - // Create a new Page - PageRef newRef = DiFactory.eINSTANCE.createPageRef(); - newRef.setEmfPageIdentifier((EObject) diagramProxy); - // Replace the previous by the new one - folder.getChildren().set(i, newRef); - } - } - } - } - } + protected boolean isLegacyMode() { + // We are never in legacy mode even if there is a page list + return false; } - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#allPages() - * - * @return - */ @Override - public List allPages() { - // FIXME: Temporary, naive code. Need to implement a mechanism to contribute page providers - List result = new LinkedList(); - List notationResources = getResources("notation"); - for (Resource notationResource : notationResources) { - for (EObject content : notationResource.getContents()) { - if (isPage(content)) { - result.add(content); - } - } - } - - - return result; + protected boolean isPage(EObject content) { + return Platform.getAdapterManager().getAdapter(content, IOpenable.class) != null; } - /** - * Gets the local pages. - * - * @param model - * the model - * @return the local pages - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager#allLocalPages() - */ @Override - public List allLocalPages(ILocalPageService service) { - List result = new LinkedList(); - - List notationResources = getResources("notation"); - for (Resource notationResource : notationResources) { - for (EObject content : notationResource.getContents()) { - if (isPage(content)) { - - if (service.isLocalPage(content)) { - result.add(content); - } - } - } - } - - return result; + public void closePage(Object pageIdentifier) { + // Suppress event notifications + doExecute(() -> super.closePage(pageIdentifier)); } - - /** - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager#getAssociatedPages(org.eclipse.emf.common.util.URI) - * - * @param uriTrim - * @return - */ @Override - public List getAssociatedPages(Object uriTrim) { - - List list = new ArrayList(); - - SashModel sashModel = diSashModel.getSashModel(); - Iterator iter = sashModel.eAllContents(); - - while (iter.hasNext()) { - Object next = iter.next(); - if (next instanceof PageRef) { - PageRef pageRef = (PageRef) next; - - // pageRef is one of the pages referred into the sash resource - if (pageRef != null) { - EObject pageID = pageRef.getEmfPageIdentifier(); - if (pageID != null) { - URI uriContainer; - if (pageID.eIsProxy()) { - InternalEObject internal = (InternalEObject) pageID; - uriContainer = internal.eProxyURI().trimFragment().trimFileExtension(); - - } else { - uriContainer = pageID.eResource().getURI().trimFileExtension(); - } - if (uriTrim instanceof URI) { - if (uriContainer.equals(uriTrim)) { - list.add(pageID); - } - } - } - } - - } - - } - return list; + public void closeAllOpenedPages() { + // Suppress event notifications + doExecute(() -> super.closeAllOpenedPages()); } - /** - * Gets the resources. - * - * @param fileExtension - * the file extension - * @return the resources - */ - private List getResources(String fileExtension) { - List resourcesList = new LinkedList(); - - // Get resource set from Di Sash model - ResourceSet resourceSet = diSashModel.eResource().getResourceSet(); - - for (Resource resource : resourceSet.getResources()) { - - // Verify if the resource exist and is loaded - if (resource != null && resource.isLoaded()) { - // Verify if its extension correspond - if (fileExtension.equals(resource.getURI().fileExtension())) { - resourcesList.add(resource); - } - - } - } - - return resourcesList; - } - - /** - * Checks if is page. - * - * @param content - * the content - * @return true, if is page - */ - private boolean isPage(EObject content) { - return Platform.getAdapterManager().getAdapter(content, IOpenable.class) != null; - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#openPage(java.lang.Object) - * - * @param pageIdentifier - */ @Override - public void openPage(Object pageIdentifier) { - diSashModel.getSashModel().addPage(getCurrentFolder(), pageIdentifier); + public void closeOtherPages(Object pageIdentifier) { + // Suppress event notifications + doExecute(() -> super.closeOtherPages(pageIdentifier)); } - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager#openPage(java.lang.Object, java.lang.String) - * - * @param pageIdentifier - * @param editorID - */ - @Override - public void openPage(Object pageIdentifier, String editorID) { - PageRef newPage = DiFactory.eINSTANCE.createPageRef(); - newPage.setFavoriteEditor(editorID); - newPage.setPageIdentifier(pageIdentifier); - diSashModel.getSashModel().addPage(getCurrentFolder(), newPage); - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager#selectPage(java.lang.Object) - * - * @param pageIdentifier - */ @Override public void selectPage(final Object pageIdentifier) { Display.getDefault().syncExec(new Runnable() { @@ -316,16 +126,6 @@ public class PageManagerImpl extends PageMngrImpl implements IPageManager { }); } - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(java.lang.Object) - * - * @param pageIdentifier - */ - @Override - public void removePage(Object pageIdentifier) { - closeAllOpenedPages(pageIdentifier); - } - /** * Sets the current folder and page mngr. * @@ -337,57 +137,27 @@ public class PageManagerImpl extends PageMngrImpl implements IPageManager { } - /** - * Executes an operation on my internal sash model. - * - * @param - * the generic type - * @param sashModelOperation - * the operation to execute - * @return the operation's result - * @throws IllegalAccessException - * on attempt to execute an operation defined by a client bundle - */ - public T execute(SashModelOperation sashModelOperation) throws IllegalAccessException { + @Override + protected T doExecute(SashModelOperation sashModelOperation) { T result; - if (FrameworkUtil.getBundle(sashModelOperation.getClass()) != Activator.getDefault().getBundle()) { - throw new IllegalAccessException("Attempt to access bundle-private API."); //$NON-NLS-1$ - } - - ContentChangedEventProvider eventProvider = getContentChangedEventProvider(); - final boolean deliver = eventProvider.isDeliver(); + final boolean deliver = contentChangedEventProvider.isDeliver(); - eventProvider.setDeliver(false); + contentChangedEventProvider.setDeliver(false); try { - result = sashModelOperation.execute(diSashModel); + result = super.doExecute(sashModelOperation); } finally { - eventProvider.setDeliver(deliver); + contentChangedEventProvider.setDeliver(deliver); } return result; } - // - // Private interfaces - // - - /** - * An operation on the internal sash model of a page manager. - * - * @param - * the generic type - */ - public static interface SashModelOperation { - - /** - * Execute. - * - * @param sashWindowsManager - * the sash windows manager - * @return the t - */ - T execute(SashWindowsMngr sashWindowsManager); + private void doExecute(Runnable sashModelOperation) { + doExecute(ignored -> { + sashModelOperation.run(); + return ignored; + }); } } \ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImpl.java deleted file mode 100644 index a23a6d8ffb5..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009, 2014 LIFL, CEA LIST, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Christian W. Damus (CEA) - bug 433371 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -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.TabFolder; - - -/** - * Implementation of the page manager. - * The page manager provides basic methods to access the DiSashModel and its PageList. - * This is the users interface to add, open, close and remove pages. - * - * @author cedric dumoulin - */ -public class PageMngrImpl implements IPageMngr { - - /** Internal EMF model */ - protected SashWindowsMngr diSashModel; - - /** - * An object used to get the current folder, or to ask to set the - * active page. - * This is usually backuped by the SashWindowContainer.
- */ - protected ICurrentFolderAndPageMngr folderAndPageMngr; - - private ContentChangedEventProvider contentChangedEventProvider; - - protected PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) { - this.diSashModel = diSashModel; - this.contentChangedEventProvider = contentChangedEventProvider; - folderAndPageMngr = new DefaultCurrentFolderAndPageMngr(diSashModel); - } - - protected PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) { - this.diSashModel = diSashModel; - this.contentChangedEventProvider = contentChangedEventProvider; - this.folderAndPageMngr = folderAndPageMngr; - } - - /** - * Add a page to the PageList. Do not open the corresponding editor. - * The page will be visible in the list. - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#addEditor(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - @Deprecated - public void addPage(Object pageIdentifier) { - - // We do not need to disable event delivering, - // as addition to pageList doesn't fire events. - - diSashModel.getPageList().addPage(pageIdentifier); - } - - /** - * Get the folder model {@link TabFolder} of the current folder. - * - * @return - */ - protected TabFolder getCurrentFolder() { - return folderAndPageMngr.getCurrentFolder(); - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#allPages() - * - * @return - */ - @Override - public List allPages() { - // TODO : use and return a shadow list ? - List list = new ArrayList(); - for (PageRef pageRef : diSashModel.getPageList().getAvailablePage()) { - - list.add(pageRef.getPageIdentifier()); - } - return list; - } - - /** - * Remove the page from the SashModel - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#closePage(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - public void closePage(Object pageIdentifier) { - - contentChangedEventProvider.setDeliver(false); - diSashModel.getSashModel().removePageAndEmptyFolder(pageIdentifier); - contentChangedEventProvider.setDeliver(true); - } - - /** - * Remove all pages from the SashModel. Left only the top level folder - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#closePage(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - public void closeAllOpenedPages() { - - contentChangedEventProvider.setDeliver(false); - diSashModel.getSashModel().removeAllPages(); - contentChangedEventProvider.setDeliver(true); - - } - - /** - * Remove all pages from the SashModel. Left only the top level folder - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#closePage(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - public void closeOtherPages(Object pageIdentifier) { - contentChangedEventProvider.setDeliver(false); - diSashModel.getSashModel().removeOtherPages(pageIdentifier); - contentChangedEventProvider.setDeliver(true); - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#openPage(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - public void openPage(Object pageIdentifier) { - // Add the page to the SashModel and to the PageList - - // We do not need to disable event delivering as the operation already fired - // one single event. - - Iterator iterator = diSashModel.getPageList().getAvailablePage().iterator(); - boolean found = false; - while (iterator.hasNext() && found == false) { - // Bug #288806 : the test should be inversed - if (pageIdentifier.equals(iterator.next().getPageIdentifier())) { - found = true; - } - } - if (!found) { - diSashModel.getPageList().addPage(pageIdentifier); - } - diSashModel.getSashModel().addPage(getCurrentFolder(), pageIdentifier); - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#removePage(org.eclipse.emf.ecore.EObject) - * - * @param pageIdentifier - */ - @Override - @Deprecated - public void removePage(Object pageIdentifier) { - // remove from pageList and from SashModel - diSashModel.getPageList().removePage(pageIdentifier); - - contentChangedEventProvider.setDeliver(false); - diSashModel.getSashModel().removePageAndEmptyFolder(pageIdentifier); - contentChangedEventProvider.setDeliver(true); - } - - /** - * - * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#isOpen(java.lang.Object) - * @param pageIdentifier - * @return - * - */ - @Override - public boolean isOpen(Object pageIdentifier) { - return diSashModel.getSashModel().lookupPage(pageIdentifier) != null; - } - - ContentChangedEventProvider getContentChangedEventProvider() { - return contentChangedEventProvider; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java index b81764aedf9..ff49592f87e 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014, 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,8 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; @@ -27,21 +29,21 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; */ public class TransactionalPageManagerImpl extends PageManagerImpl { - protected EditingDomain editingDomain; + private EditingDomain editingDomain; public TransactionalPageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) { super(diSashModel, contentChangedEventProvider); + + this.editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(diSashModel); } public TransactionalPageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) { super(diSashModel, contentChangedEventProvider, folderAndPageMngr); + + this.editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(diSashModel); } protected EditingDomain getEditingDomain() { - if (editingDomain == null) { - editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(diSashModel); - } - return editingDomain; } diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java index cac86d97047..a719de92179 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java @@ -16,25 +16,11 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils; -import java.util.HashMap; -import java.util.Map; - import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl.SashModelOperation; import org.eclipse.papyrus.infra.core.sasheditor.editor.ICloseablePart; 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.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch; /** @@ -83,90 +69,6 @@ public class IPageUtils { return visitor.getResult(); } - /** - * Obtains a command that will close all of the pages in the given {@code pageManager} that reference the specified {@code pageIdentifier}, - * regardless of whether they still reference that identifier at the time of execution (this is the "memoization"). - * - * @param domain - * the editing domain in which the command will be executed - * @param pageManager - * the page manager for which to construct the command - * @param pageIdentifier - * the identifier of the page(s) to be removed - * - * @return the memoized close-all-pages command, or {@code null} if there are no pages to close - */ - public static Command getMemoizedCloseAllPagesCommand(final TransactionalEditingDomain domain, final IPageManager pageManager, final Object pageIdentifier) { - Command result = null; - - final PageManagerImpl pageMan = (PageManagerImpl) pageManager; - - final Map pages = execute(pageMan, new SashModelOperation>() { - - @Override - public Map execute(SashWindowsMngr sashWindowsManager) { - return new DiSwitch>() { - - private Map pages = new HashMap(); - - @Override - public Map defaultCase(EObject object) { - for (EObject next : object.eContents()) { - doSwitch(next); - } - return pages; - } - - @Override - public Map casePageRef(PageRef object) { - if (object.getPageIdentifier() == pageIdentifier) { - pages.put(object, object.getParent()); - } - return pages; - } - }.doSwitch(sashWindowsManager.getSashModel()); - } - }); - - - if (!pages.isEmpty()) { - final SashModelOperation removeOp = new SashModelOperation() { - - @Override - public Void execute(SashWindowsMngr sashWindowsManager) { - SashModel sashModel = sashWindowsManager.getSashModel(); - for (Map.Entry next : pages.entrySet()) { - PageRef page = next.getKey(); - TabFolder folder = next.getValue(); - - folder.getChildren().remove(page); - sashModel.removeEmptyFolder(folder); - } - return null; - } - }; - - result = new RecordingCommand(domain, "Remove Editor Page(s)") { //$NON-NLS-1$ - - @Override - protected void doExecute() { - IPageUtils.execute(pageMan, removeOp); - } - }; - } - - return result; - } - - private static T execute(PageManagerImpl pageManager, SashModelOperation sashOperation) { - try { - return pageManager.execute(sashOperation); - } catch (IllegalAccessException e) { - // Won't happen because this is our own operation - throw new IllegalAccessError(e.getLocalizedMessage()); - } - } - /** * Queries whether the user should be permitted to close a {@code page}. * diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java index 4aacb6463d6..0254626caac 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014, 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,8 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils; @@ -24,8 +26,9 @@ import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; * This helper can be used to run (safe) transactions outside the CommandStack * * @author Camille Letavernier - * + * @deprecated Use the {@code org.eclipse.papyrus.infra.core.util.TransactionHelper}, instead */ +@Deprecated public class TransactionHelper { public static void run(EditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException { diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/di.ecore b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/di.ecore deleted file mode 100644 index 42cbafe650a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/di.ecore +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di deleted file mode 100644 index 5efd747784a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di2 b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di2 deleted file mode 100644 index 69f634adc89..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.di2 +++ /dev/null @@ -1,862 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 810:142 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 228:672 - 1167:672 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 301:34 - 914:35 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 58:578 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 116:278 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.genmodel b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.genmodel deleted file mode 100644 index 1673dbb947d..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.genmodel +++ /dev/null @@ -1,190 +0,0 @@ - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - sashwindowsdi.uml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.notation b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.notation deleted file mode 100644 index a2058c1d7fc..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.notation +++ /dev/null @@ -1,1256 +0,0 @@ - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - - - - - - - - - -
- - -
- - -
- - - - - - - - - - -
- - -
- - -
- - - - - - - - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.uml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.uml deleted file mode 100644 index 5d8586393bd..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/sashwindowsdi.uml +++ /dev/null @@ -1,612 +0,0 @@ - - - - - - - - - Root node of the model describing the sash windows, panels and pages. -A SashModel can have several windows containing panels separated by sashes. Such panels can be folders -containing pages. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lookup the pageRef identified by the pageIdentifier. -Return the pageRef or null if not found. -Lookup in the entire SashModel structure. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Remove all pages from the model. Only left one empty top level folder. - - - - - Remove pages other than the one specified from the model. Intermediate folders are also removed. - - - - - - - - - - - - Get the first available window. - - - - - - - - - - - - Lookup the first available folder. - - - - - - - - - - - - - - - - - - - - - Set the current selection without firing a changedEvent. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Redefine children. - - - - - - - - - - - - - - - - - Position of the sash in the panel. The position is in percent. The value should be between 0 and 100. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pageIdentifier can be a plain JavaObject or an EObject. -They are not stored in the same place. - - - - - - - - - - Storage to store Identifier that are not EObject. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Replace the specified child by the new value. -Don't need to be implemented in TabFolder. -Used to insert a new SashPanel. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - resource=XMI - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.properties index 44f6d28ccd1..c741a7e7faf 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.properties +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.properties @@ -4,5 +4,5 @@ # # $Id$ -pluginName = Papyrus Sashwindows di Model +pluginName = Papyrus Sashwindows DI Content Provider providerName=Eclipse Modeling Project diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.xml deleted file mode 100644 index bf5e305d70c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java deleted file mode 100644 index ae0256e8cc7..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Abstract Page'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPage() - * @model - * @generated - */ -public interface AbstractPage extends EObject { - - /** - * Returns the value of the 'Page Identifier' attribute. - * - *

- * If the meaning of the 'Page Identifier' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Page Identifier' attribute. - * @see #setPageIdentifier(Object) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPage_PageIdentifier() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" ordered="false" - * @generated - */ - Object getPageIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}' attribute. - * - * - * - * @param value - * the new value of the 'Page Identifier' attribute. - * @see #getPageIdentifier() - * @generated - */ - void setPageIdentifier(Object value); - -} // AbstractPage diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java deleted file mode 100644 index 76256d6a567..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Abstract Panel'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPanel() - * @model abstract="true" - * @generated - */ -public interface AbstractPanel extends EObject { - - /** - * Returns the value of the 'Parent' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}'. - * - *

- * If the meaning of the 'Parent' container reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Parent' container reference. - * @see #setParent(PanelParent) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPanel_Parent() - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren - * @model opposite="children" required="true" transient="false" ordered="false" - * @generated - */ - PanelParent getParent(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}' container reference. - * - * - * - * @param value - * the new value of the 'Parent' container reference. - * @see #getParent() - * @generated - */ - void setParent(PanelParent value); -} // AbstractPanel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java deleted file mode 100644 index 14f53841dc0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EFactory; - -/** - * - * The Factory for the model. - * It provides a create method for each non-abstract class of the model. - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage - * @generated - */ -public interface DiFactory extends EFactory { - - /** - * The singleton instance of the factory. - * - * - * - * @generated - */ - DiFactory eINSTANCE = org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiFactoryImpl.init(); - - /** - * Returns a new object of class 'Sash Model'. - * - * - * - * @return a new object of class 'Sash Model'. - * @generated - */ - SashModel createSashModel(); - - /** - * Returns a new object of class 'Window'. - * - * - * - * @return a new object of class 'Window'. - * @generated - */ - Window createWindow(); - - /** - * Returns a new object of class 'Position'. - * - * - * - * @return a new object of class 'Position'. - * @generated - */ - Position createPosition(); - - /** - * Returns a new object of class 'Size'. - * - * - * - * @return a new object of class 'Size'. - * @generated - */ - Size createSize(); - - /** - * Returns a new object of class 'Tab Folder'. - * - * - * - * @return a new object of class 'Tab Folder'. - * @generated - */ - TabFolder createTabFolder(); - - /** - * Returns a new object of class 'Page Ref'. - * - * - * - * @return a new object of class 'Page Ref'. - * @generated - */ - PageRef createPageRef(); - - /** - * Returns a new object of class 'Sash Panel'. - * - * - * - * @return a new object of class 'Sash Panel'. - * @generated - */ - SashPanel createSashPanel(); - - /** - * Returns a new object of class 'Abstract Page'. - * - * - * - * @return a new object of class 'Abstract Page'. - * @generated - */ - AbstractPage createAbstractPage(); - - /** - * Returns a new object of class 'Page List'. - * - * - * - * @return a new object of class 'Page List'. - * @generated - */ - @Deprecated - PageList createPageList(); - - /** - * Returns a new object of class 'Sash Windows Mngr'. - * - * - * - * @return a new object of class 'Sash Windows Mngr'. - * @generated - */ - SashWindowsMngr createSashWindowsMngr(); - - /** - * Returns the package supported by this factory. - * - * - * - * @return the package supported by this factory. - * @generated - */ - DiPackage getDiPackage(); - -} // DiFactory diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java deleted file mode 100644 index 3bfd9bb55d3..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java +++ /dev/null @@ -1,1571 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * - * The Package for the model. - * It contains accessors for the meta objects to represent - *
    - *
  • each class,
  • - *
  • each feature of each class,
  • - *
  • each enum,
  • - *
  • and each data type
  • - *
- * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory - * @model kind="package" - * @generated - */ -public interface DiPackage extends EPackage { - - /** - * The package name. - * - * - * - * @generated - */ - String eNAME = "di"; - - /** - * The package namespace URI. - * - * - * - * @generated - */ - String eNS_URI = "http://www.eclipse.org/papyrus/0.7.0/sashdi"; - - /** - * The package namespace name. - * - * - * - * @generated - */ - String eNS_PREFIX = "di"; - - /** - * The singleton instance of the package. - * - * - * - * @generated - */ - DiPackage eINSTANCE = org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl Sash Model}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashModel() - * @generated - */ - int SASH_MODEL = 0; - - /** - * The feature id for the 'Windows' containment reference list. - * - * - * - * @generated - * @ordered - */ - int SASH_MODEL__WINDOWS = 0; - - /** - * The feature id for the 'Current Selection' reference. - * - * - * - * @generated - * @ordered - */ - int SASH_MODEL__CURRENT_SELECTION = 1; - - /** - * The feature id for the 'Restore Active Page' attribute. - * - * - * - * @generated - * @ordered - */ - int SASH_MODEL__RESTORE_ACTIVE_PAGE = 2; - - /** - * The number of structural features of the 'Sash Model' class. - * - * - * - * @generated - * @ordered - */ - int SASH_MODEL_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl Panel Parent}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPanelParent() - * @generated - */ - int PANEL_PARENT = 2; - - /** - * The feature id for the 'Children' containment reference list. - * - * - * - * @generated - * @ordered - */ - int PANEL_PARENT__CHILDREN = 0; - - /** - * The number of structural features of the 'Panel Parent' class. - * - * - * - * @generated - * @ordered - */ - int PANEL_PARENT_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl Window}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getWindow() - * @generated - */ - int WINDOW = 1; - - /** - * The feature id for the 'Children' containment reference list. - * - * - * - * @generated - * @ordered - */ - int WINDOW__CHILDREN = PANEL_PARENT__CHILDREN; - - /** - * The feature id for the 'Position' reference. - * - * - * - * @generated - * @ordered - */ - int WINDOW__POSITION = PANEL_PARENT_FEATURE_COUNT + 0; - - /** - * The feature id for the 'Size' reference. - * - * - * - * @generated - * @ordered - */ - int WINDOW__SIZE = PANEL_PARENT_FEATURE_COUNT + 1; - - /** - * The feature id for the 'Panel' reference. - * - * - * - * @generated - * @ordered - */ - int WINDOW__PANEL = PANEL_PARENT_FEATURE_COUNT + 2; - - /** - * The number of structural features of the 'Window' class. - * - * - * - * @generated - * @ordered - */ - int WINDOW_FEATURE_COUNT = PANEL_PARENT_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl Abstract Panel}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPanel() - * @generated - */ - int ABSTRACT_PANEL = 3; - - /** - * The feature id for the 'Parent' container reference. - * - * - * - * @generated - * @ordered - */ - int ABSTRACT_PANEL__PARENT = 0; - - /** - * The number of structural features of the 'Abstract Panel' class. - * - * - * - * @generated - * @ordered - */ - int ABSTRACT_PANEL_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl Position}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPosition() - * @generated - */ - int POSITION = 4; - - /** - * The feature id for the 'X' attribute. - * - * - * - * @generated - * @ordered - */ - int POSITION__X = 0; - - /** - * The feature id for the 'Y' attribute. - * - * - * - * @generated - * @ordered - */ - int POSITION__Y = 1; - - /** - * The number of structural features of the 'Position' class. - * - * - * - * @generated - * @ordered - */ - int POSITION_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl Size}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSize() - * @generated - */ - int SIZE = 5; - - /** - * The feature id for the 'Width' attribute. - * - * - * - * @generated - * @ordered - */ - int SIZE__WIDTH = 0; - - /** - * The feature id for the 'Length' attribute. - * - * - * - * @generated - * @ordered - */ - int SIZE__LENGTH = 1; - - /** - * The number of structural features of the 'Size' class. - * - * - * - * @generated - * @ordered - */ - int SIZE_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl Tab Folder}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getTabFolder() - * @generated - */ - int TAB_FOLDER = 6; - - /** - * The feature id for the 'Parent' container reference. - * - * - * - * @generated - * @ordered - */ - int TAB_FOLDER__PARENT = ABSTRACT_PANEL__PARENT; - - /** - * The feature id for the 'Children' containment reference list. - * - * - * - * @generated - * @ordered - */ - int TAB_FOLDER__CHILDREN = ABSTRACT_PANEL_FEATURE_COUNT + 0; - - /** - * The feature id for the 'Current Selection' reference. - * - * - * - * @generated - * @ordered - */ - int TAB_FOLDER__CURRENT_SELECTION = ABSTRACT_PANEL_FEATURE_COUNT + 1; - - /** - * The number of structural features of the 'Tab Folder' class. - * - * - * - * @generated - * @ordered - */ - int TAB_FOLDER_FEATURE_COUNT = ABSTRACT_PANEL_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl Page Ref}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageRef() - * @generated - */ - int PAGE_REF = 7; - - /** - * The feature id for the 'Emf Page Identifier' reference. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF__EMF_PAGE_IDENTIFIER = 0; - - /** - * The feature id for the 'Page Identifier' attribute. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF__PAGE_IDENTIFIER = 1; - - /** - * The feature id for the 'Object Page Identifier' attribute. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF__OBJECT_PAGE_IDENTIFIER = 2; - - /** - * The feature id for the 'Favorite Editor' attribute. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF__FAVORITE_EDITOR = 3; - - /** - * The feature id for the 'Parent' container reference. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF__PARENT = 4; - - /** - * The number of structural features of the 'Page Ref' class. - * - * - * - * @generated - * @ordered - */ - int PAGE_REF_FEATURE_COUNT = 5; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl Sash Panel}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashPanel() - * @generated - */ - int SASH_PANEL = 8; - - /** - * The feature id for the 'Parent' container reference. - * - * - * - * @generated - * @ordered - */ - int SASH_PANEL__PARENT = ABSTRACT_PANEL__PARENT; - - /** - * The feature id for the 'Children' containment reference list. - * - * - * - * @generated - * @ordered - */ - int SASH_PANEL__CHILDREN = ABSTRACT_PANEL_FEATURE_COUNT + 0; - - /** - * The feature id for the 'Sash Position' attribute. - * - * - * - * @generated - * @ordered - */ - int SASH_PANEL__SASH_POSITION = ABSTRACT_PANEL_FEATURE_COUNT + 1; - - /** - * The feature id for the 'Direction' attribute. - * - * - * - * @generated - * @ordered - */ - int SASH_PANEL__DIRECTION = ABSTRACT_PANEL_FEATURE_COUNT + 2; - - /** - * The number of structural features of the 'Sash Panel' class. - * - * - * - * @generated - * @ordered - */ - int SASH_PANEL_FEATURE_COUNT = ABSTRACT_PANEL_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl Abstract Page}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPage() - * @generated - */ - int ABSTRACT_PAGE = 9; - - /** - * The feature id for the 'Page Identifier' attribute. - * - * - * - * @generated - * @ordered - */ - int ABSTRACT_PAGE__PAGE_IDENTIFIER = 0; - - /** - * The number of structural features of the 'Abstract Page' class. - * - * - * - * @generated - * @ordered - */ - int ABSTRACT_PAGE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl Page List}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList() - * @generated - */ - @Deprecated - int PAGE_LIST = 10; - - /** - * The feature id for the 'Available Page' containment reference list. - * - * - * - * @generated - * @ordered - */ - @Deprecated - int PAGE_LIST__AVAILABLE_PAGE = 0; - - /** - * The number of structural features of the 'Page List' class. - * - * - * - * @generated - * @ordered - */ - int PAGE_LIST_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl Sash Windows Mngr}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashWindowsMngr() - * @generated - */ - int SASH_WINDOWS_MNGR = 11; - - /** - * The feature id for the 'Page List' containment reference. - * - * - * - * @generated - * @ordered - */ - int SASH_WINDOWS_MNGR__PAGE_LIST = 0; - - /** - * The feature id for the 'Sash Model' containment reference. - * - * - * - * @generated - * @ordered - */ - int SASH_WINDOWS_MNGR__SASH_MODEL = 1; - - /** - * The number of structural features of the 'Sash Windows Mngr' class. - * - * - * - * @generated - * @ordered - */ - int SASH_WINDOWS_MNGR_FEATURE_COUNT = 2; - - /** - * The meta object id for the 'int' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getint() - * @generated - */ - int INT = 12; - - /** - * The meta object id for the 'Java Object' data type. - * - * - * - * @see java.lang.Object - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getJavaObject() - * @generated - */ - int JAVA_OBJECT = 13; - - /** - * The meta object id for the 'Float' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getFloat() - * @generated - */ - int FLOAT = 15; - - /** - * The meta object id for the 'boolean' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getboolean() - * @generated - */ - int BOOLEAN = 14; - - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel Sash Model}'. - * - * - * - * @return the meta object for class 'Sash Model'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel - * @generated - */ - EClass getSashModel(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows Windows}'. - * - * - * - * @return the meta object for the containment reference list 'Windows'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows() - * @see #getSashModel() - * @generated - */ - EReference getSashModel_Windows(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}'. - * - * - * - * @return the meta object for the reference 'Current Selection'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection() - * @see #getSashModel() - * @generated - */ - EReference getSashModel_CurrentSelection(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}'. - * - * - * - * @return the meta object for the attribute 'Restore Active Page'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage() - * @see #getSashModel() - * @generated - */ - EAttribute getSashModel_RestoreActivePage(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window Window}'. - * - * - * - * @return the meta object for class 'Window'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window - * @generated - */ - EClass getWindow(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}'. - * - * - * - * @return the meta object for the reference 'Position'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition() - * @see #getWindow() - * @generated - */ - EReference getWindow_Position(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}'. - * - * - * - * @return the meta object for the reference 'Size'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize() - * @see #getWindow() - * @generated - */ - EReference getWindow_Size(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}'. - * - * - * - * @return the meta object for the reference 'Panel'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel() - * @see #getWindow() - * @generated - */ - EReference getWindow_Panel(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent Panel Parent}'. - * - * - * - * @return the meta object for class 'Panel Parent'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent - * @generated - */ - EClass getPanelParent(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}'. - * - * - * - * @return the meta object for the containment reference list 'Children'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren() - * @see #getPanelParent() - * @generated - */ - EReference getPanelParent_Children(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel Abstract Panel}'. - * - * - * - * @return the meta object for class 'Abstract Panel'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel - * @generated - */ - EClass getAbstractPanel(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}'. - * - * - * - * @return the meta object for the container reference 'Parent'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent() - * @see #getAbstractPanel() - * @generated - */ - EReference getAbstractPanel_Parent(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position Position}'. - * - * - * - * @return the meta object for class 'Position'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position - * @generated - */ - EClass getPosition(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}'. - * - * - * - * @return the meta object for the attribute 'X'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX() - * @see #getPosition() - * @generated - */ - EAttribute getPosition_X(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}'. - * - * - * - * @return the meta object for the attribute 'Y'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY() - * @see #getPosition() - * @generated - */ - EAttribute getPosition_Y(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size Size}'. - * - * - * - * @return the meta object for class 'Size'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size - * @generated - */ - EClass getSize(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}'. - * - * - * - * @return the meta object for the attribute 'Width'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth() - * @see #getSize() - * @generated - */ - EAttribute getSize_Width(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}'. - * - * - * - * @return the meta object for the attribute 'Length'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength() - * @see #getSize() - * @generated - */ - EAttribute getSize_Length(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder Tab Folder}'. - * - * - * - * @return the meta object for class 'Tab Folder'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder - * @generated - */ - EClass getTabFolder(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}'. - * - * - * - * @return the meta object for the containment reference list 'Children'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren() - * @see #getTabFolder() - * @generated - */ - EReference getTabFolder_Children(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}'. - * - * - * - * @return the meta object for the reference 'Current Selection'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection() - * @see #getTabFolder() - * @generated - */ - EReference getTabFolder_CurrentSelection(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef Page Ref}'. - * - * - * - * @return the meta object for class 'Page Ref'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef - * @generated - */ - EClass getPageRef(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}'. - * - * - * - * @return the meta object for the reference 'Emf Page Identifier'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier() - * @see #getPageRef() - * @generated - */ - EReference getPageRef_EmfPageIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}'. - * - * - * - * @return the meta object for the attribute 'Page Identifier'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier() - * @see #getPageRef() - * @generated - */ - EAttribute getPageRef_PageIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}'. - * - * - * - * @return the meta object for the attribute 'Object Page Identifier'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier() - * @see #getPageRef() - * @generated - */ - EAttribute getPageRef_ObjectPageIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}'. - * - * - * - * @return the meta object for the attribute 'Favorite Editor'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor() - * @see #getPageRef() - * @generated - */ - EAttribute getPageRef_FavoriteEditor(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}'. - * - * - * - * @return the meta object for the container reference 'Parent'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent() - * @see #getPageRef() - * @generated - */ - EReference getPageRef_Parent(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel Sash Panel}'. - * - * - * - * @return the meta object for class 'Sash Panel'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel - * @generated - */ - EClass getSashPanel(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}'. - * - * - * - * @return the meta object for the attribute 'Sash Position'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition() - * @see #getSashPanel() - * @generated - */ - EAttribute getSashPanel_SashPosition(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}'. - * - * - * - * @return the meta object for the attribute 'Direction'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection() - * @see #getSashPanel() - * @generated - */ - EAttribute getSashPanel_Direction(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage Abstract Page}'. - * - * - * - * @return the meta object for class 'Abstract Page'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage - * @generated - */ - EClass getAbstractPage(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}'. - * - * - * - * @return the meta object for the attribute 'Page Identifier'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier() - * @see #getAbstractPage() - * @generated - */ - EAttribute getAbstractPage_PageIdentifier(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList Page List}'. - * - * - * - * @return the meta object for class 'Page List'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList - * @generated - */ - @Deprecated - EClass getPageList(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage Available Page}'. - * - * - * - * @return the meta object for the containment reference list 'Available Page'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage() - * @see #getPageList() - * @generated - */ - @Deprecated - EReference getPageList_AvailablePage(); - - /** - * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr Sash Windows Mngr}'. - * - * - * - * @return the meta object for class 'Sash Windows Mngr'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr - * @generated - */ - EClass getSashWindowsMngr(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}'. - * - * - * - * @return the meta object for the containment reference 'Page List'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList() - * @see #getSashWindowsMngr() - * @generated - */ - @Deprecated - EReference getSashWindowsMngr_PageList(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}'. - * - * - * - * @return the meta object for the containment reference 'Sash Model'. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel() - * @see #getSashWindowsMngr() - * @generated - */ - EReference getSashWindowsMngr_SashModel(); - - /** - * Returns the meta object for data type 'int'. - * - * - * - * @return the meta object for data type 'int'. - * @model instanceClass="int" - * annotation="http://www.eclipse.org/uml2/2.0.0/UML originalName='Integer'" - * @generated - */ - EDataType getint(); - - /** - * Returns the meta object for data type '{@link java.lang.Object Java Object}'. - * - * - * - * @return the meta object for data type 'Java Object'. - * @see java.lang.Object - * @model instanceClass="java.lang.Object" - * @generated - */ - EDataType getJavaObject(); - - /** - * Returns the meta object for data type 'Float'. - * - * - * - * @return the meta object for data type 'Float'. - * @model instanceClass="float" - * @generated - */ - EDataType getFloat(); - - /** - * Returns the meta object for data type 'boolean'. - * - * - * - * @return the meta object for data type 'boolean'. - * @model instanceClass="boolean" - * @generated - */ - EDataType getboolean(); - - /** - * Returns the factory that creates the instances of the model. - * - * - * - * @return the factory that creates the instances of the model. - * @generated - */ - DiFactory getDiFactory(); - - /** - * - * Defines literals for the meta objects that represent - *
    - *
  • each class,
  • - *
  • each feature of each class,
  • - *
  • each enum,
  • - *
  • and each data type
  • - *
- * - * - * @generated - */ - interface Literals { - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl Sash Model}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashModel() - * @generated - */ - EClass SASH_MODEL = eINSTANCE.getSashModel(); - - /** - * The meta object literal for the 'Windows' containment reference list feature. - * - * - * - * @generated - */ - EReference SASH_MODEL__WINDOWS = eINSTANCE.getSashModel_Windows(); - - /** - * The meta object literal for the 'Current Selection' reference feature. - * - * - * - * @generated - */ - EReference SASH_MODEL__CURRENT_SELECTION = eINSTANCE.getSashModel_CurrentSelection(); - - /** - * The meta object literal for the 'Restore Active Page' attribute feature. - * - * - * - * @generated - */ - EAttribute SASH_MODEL__RESTORE_ACTIVE_PAGE = eINSTANCE.getSashModel_RestoreActivePage(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl Window}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getWindow() - * @generated - */ - EClass WINDOW = eINSTANCE.getWindow(); - - /** - * The meta object literal for the 'Position' reference feature. - * - * - * - * @generated - */ - EReference WINDOW__POSITION = eINSTANCE.getWindow_Position(); - - /** - * The meta object literal for the 'Size' reference feature. - * - * - * - * @generated - */ - EReference WINDOW__SIZE = eINSTANCE.getWindow_Size(); - - /** - * The meta object literal for the 'Panel' reference feature. - * - * - * - * @generated - */ - EReference WINDOW__PANEL = eINSTANCE.getWindow_Panel(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl Panel Parent}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPanelParent() - * @generated - */ - EClass PANEL_PARENT = eINSTANCE.getPanelParent(); - - /** - * The meta object literal for the 'Children' containment reference list feature. - * - * - * - * @generated - */ - EReference PANEL_PARENT__CHILDREN = eINSTANCE.getPanelParent_Children(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl Abstract Panel}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPanel() - * @generated - */ - EClass ABSTRACT_PANEL = eINSTANCE.getAbstractPanel(); - - /** - * The meta object literal for the 'Parent' container reference feature. - * - * - * - * @generated - */ - EReference ABSTRACT_PANEL__PARENT = eINSTANCE.getAbstractPanel_Parent(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl Position}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPosition() - * @generated - */ - EClass POSITION = eINSTANCE.getPosition(); - - /** - * The meta object literal for the 'X' attribute feature. - * - * - * - * @generated - */ - EAttribute POSITION__X = eINSTANCE.getPosition_X(); - - /** - * The meta object literal for the 'Y' attribute feature. - * - * - * - * @generated - */ - EAttribute POSITION__Y = eINSTANCE.getPosition_Y(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl Size}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSize() - * @generated - */ - EClass SIZE = eINSTANCE.getSize(); - - /** - * The meta object literal for the 'Width' attribute feature. - * - * - * - * @generated - */ - EAttribute SIZE__WIDTH = eINSTANCE.getSize_Width(); - - /** - * The meta object literal for the 'Length' attribute feature. - * - * - * - * @generated - */ - EAttribute SIZE__LENGTH = eINSTANCE.getSize_Length(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl Tab Folder}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getTabFolder() - * @generated - */ - EClass TAB_FOLDER = eINSTANCE.getTabFolder(); - - /** - * The meta object literal for the 'Children' containment reference list feature. - * - * - * - * @generated - */ - EReference TAB_FOLDER__CHILDREN = eINSTANCE.getTabFolder_Children(); - - /** - * The meta object literal for the 'Current Selection' reference feature. - * - * - * - * @generated - */ - EReference TAB_FOLDER__CURRENT_SELECTION = eINSTANCE.getTabFolder_CurrentSelection(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl Page Ref}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageRef() - * @generated - */ - EClass PAGE_REF = eINSTANCE.getPageRef(); - - /** - * The meta object literal for the 'Emf Page Identifier' reference feature. - * - * - * - * @generated - */ - EReference PAGE_REF__EMF_PAGE_IDENTIFIER = eINSTANCE.getPageRef_EmfPageIdentifier(); - - /** - * The meta object literal for the 'Page Identifier' attribute feature. - * - * - * - * @generated - */ - EAttribute PAGE_REF__PAGE_IDENTIFIER = eINSTANCE.getPageRef_PageIdentifier(); - - /** - * The meta object literal for the 'Object Page Identifier' attribute feature. - * - * - * - * @generated - */ - EAttribute PAGE_REF__OBJECT_PAGE_IDENTIFIER = eINSTANCE.getPageRef_ObjectPageIdentifier(); - - /** - * The meta object literal for the 'Favorite Editor' attribute feature. - * - * - * - * @generated - */ - EAttribute PAGE_REF__FAVORITE_EDITOR = eINSTANCE.getPageRef_FavoriteEditor(); - - /** - * The meta object literal for the 'Parent' container reference feature. - * - * - * - * @generated - */ - EReference PAGE_REF__PARENT = eINSTANCE.getPageRef_Parent(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl Sash Panel}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashPanel() - * @generated - */ - EClass SASH_PANEL = eINSTANCE.getSashPanel(); - - /** - * The meta object literal for the 'Sash Position' attribute feature. - * - * - * - * @generated - */ - EAttribute SASH_PANEL__SASH_POSITION = eINSTANCE.getSashPanel_SashPosition(); - - /** - * The meta object literal for the 'Direction' attribute feature. - * - * - * - * @generated - */ - EAttribute SASH_PANEL__DIRECTION = eINSTANCE.getSashPanel_Direction(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl Abstract Page}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPage() - * @generated - */ - EClass ABSTRACT_PAGE = eINSTANCE.getAbstractPage(); - - /** - * The meta object literal for the 'Page Identifier' attribute feature. - * - * - * - * @generated - */ - EAttribute ABSTRACT_PAGE__PAGE_IDENTIFIER = eINSTANCE.getAbstractPage_PageIdentifier(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl Page List}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList() - * @generated - */ - @Deprecated - EClass PAGE_LIST = eINSTANCE.getPageList(); - - /** - * The meta object literal for the 'Available Page' containment reference list feature. - * - * - * - * @generated - */ - @Deprecated - EReference PAGE_LIST__AVAILABLE_PAGE = eINSTANCE.getPageList_AvailablePage(); - - /** - * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl Sash Windows Mngr}' class. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashWindowsMngr() - * @generated - */ - EClass SASH_WINDOWS_MNGR = eINSTANCE.getSashWindowsMngr(); - - /** - * The meta object literal for the 'Page List' containment reference feature. - * - * - * - * @generated - */ - @Deprecated - EReference SASH_WINDOWS_MNGR__PAGE_LIST = eINSTANCE.getSashWindowsMngr_PageList(); - - /** - * The meta object literal for the 'Sash Model' containment reference feature. - * - * - * - * @generated - */ - EReference SASH_WINDOWS_MNGR__SASH_MODEL = eINSTANCE.getSashWindowsMngr_SashModel(); - - /** - * The meta object literal for the 'int' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getint() - * @generated - */ - EDataType INT = eINSTANCE.getint(); - - /** - * The meta object literal for the 'Java Object' data type. - * - * - * - * @see java.lang.Object - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getJavaObject() - * @generated - */ - EDataType JAVA_OBJECT = eINSTANCE.getJavaObject(); - - /** - * The meta object literal for the 'Float' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getFloat() - * @generated - */ - EDataType FLOAT = eINSTANCE.getFloat(); - - /** - * The meta object literal for the 'boolean' data type. - * - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getboolean() - * @generated - */ - EDataType BOOLEAN = eINSTANCE.getboolean(); - - } - -} // DiPackage diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java deleted file mode 100644 index 5146cb31b1c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Page List'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage Available Page}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageList() - * @model - * @generated - */ -@Deprecated -public interface PageList extends EObject { - - /** - * Returns the value of the 'Available Page' containment reference list. - * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef}. - * - *

- * If the meaning of the 'Available Page' containment reference list isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Available Page' containment reference list. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageList_AvailablePage() - * @model containment="true" ordered="false" - * @generated - */ - EList getAvailablePage(); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void addPage(Object pageIdentifier); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void removePage(Object pageIdentifier); - -} // PageList diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java deleted file mode 100644 index 1504152423b..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Page Ref'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef() - * @model - * @generated - */ -public interface PageRef extends EObject { - - /** - * Returns the value of the 'Emf Page Identifier' reference. - * - *

- * If the meaning of the 'Emf Page Identifier' reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Emf Page Identifier' reference. - * @see #setEmfPageIdentifier(EObject) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_EmfPageIdentifier() - * @model required="true" ordered="false" - * @generated - */ - EObject getEmfPageIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}' reference. - * - * - * - * @param value - * the new value of the 'Emf Page Identifier' reference. - * @see #getEmfPageIdentifier() - * @generated - */ - void setEmfPageIdentifier(EObject value); - - /** - * Returns the value of the 'Page Identifier' attribute. - * - * - * - * pageIdentifier can be a plain JavaObject or an EObject. - * They are not stored in the same place. - * - * - * @return the value of the 'Page Identifier' attribute. - * @see #setPageIdentifier(Object) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_PageIdentifier() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" transient="true" volatile="true" derived="true" ordered="false" - * @generated - */ - Object getPageIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}' attribute. - * - * - * - * @param value - * the new value of the 'Page Identifier' attribute. - * @see #getPageIdentifier() - * @generated - */ - void setPageIdentifier(Object value); - - /** - * Returns the value of the 'Object Page Identifier' attribute. - * - * - * - * Storage to store Identifier that are not EObject. - * - * - * @return the value of the 'Object Page Identifier' attribute. - * @see #setObjectPageIdentifier(Object) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_ObjectPageIdentifier() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" ordered="false" - * @generated - */ - Object getObjectPageIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}' attribute. - * - * - * - * @param value - * the new value of the 'Object Page Identifier' attribute. - * @see #getObjectPageIdentifier() - * @generated - */ - void setObjectPageIdentifier(Object value); - - /** - * Returns the value of the 'Favorite Editor' attribute. - * - *

- * If the meaning of the 'Favorite Editor' attribute isn't clear, - * there really should be more of a description here... - *

- * - * - * @return the value of the 'Favorite Editor' attribute. - * @see #setFavoriteEditor(String) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_FavoriteEditor() - * @model dataType="org.eclipse.uml2.types.String" ordered="false" - * @generated - */ - String getFavoriteEditor(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}' attribute. - * - * - * - * @param value - * the new value of the 'Favorite Editor' attribute. - * @see #getFavoriteEditor() - * @generated - */ - void setFavoriteEditor(String value); - - /** - * Returns the value of the 'Parent' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}'. - * - *

- * If the meaning of the 'Parent' container reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Parent' container reference. - * @see #setParent(TabFolder) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_Parent() - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren - * @model opposite="children" transient="false" ordered="false" - * @generated - */ - TabFolder getParent(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}' container reference. - * - * - * - * @param value - * the new value of the 'Parent' container reference. - * @see #getParent() - * @generated - */ - void setParent(TabFolder value); - - /** - * - * - * - * @model dataType="org.eclipse.papyrus.infra.core.sashwindows.di.boolean" required="true" ordered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - boolean isForIdentifier(Object pageIdentifier); - -} // PageRef diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java deleted file mode 100644 index fc42d37bc92..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Panel Parent'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPanelParent() - * @model abstract="true" - * @generated - */ -public interface PanelParent extends EObject { - - /** - * Returns the value of the 'Children' containment reference list. - * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel}. - * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}'. - * - *

- * If the meaning of the 'Children' containment reference list isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Children' containment reference list. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPanelParent_Children() - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent - * @model opposite="parent" containment="true" lower="2" upper="2" ordered="false" - * @generated - */ - EList getChildren(); - - /** - * - * - * - * Replace the specified child by the new value. - * Don't need to be implemented in TabFolder. - * Used to insert a new SashPanel. - * - * - * @model oldChildRequired="true" oldChildOrdered="false" newChildRequired="true" newChildOrdered="false" - * @generated - */ - void replaceChild(AbstractPanel oldChild, AbstractPanel newChild); - -} // PanelParent diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java deleted file mode 100644 index 53c5b3da406..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Position'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition() - * @model - * @generated - */ -public interface Position extends EObject { - - /** - * Returns the value of the 'X' attribute. - * - *

- * If the meaning of the 'X' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'X' attribute. - * @see #setX(int) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition_X() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" - * @generated - */ - int getX(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}' attribute. - * - * - * - * @param value - * the new value of the 'X' attribute. - * @see #getX() - * @generated - */ - void setX(int value); - - /** - * Returns the value of the 'Y' attribute. - * - *

- * If the meaning of the 'Y' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Y' attribute. - * @see #setY(int) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition_Y() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" - * @generated - */ - int getY(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}' attribute. - * - * - * - * @param value - * the new value of the 'Y' attribute. - * @see #getY() - * @generated - */ - void setY(int value); - -} // Position diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java deleted file mode 100644 index 70f43ba2066..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java +++ /dev/null @@ -1,272 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Sash Model'. - * - * - * - * Root node of the model describing the sash windows, panels and pages. - * A SashModel can have several windows containing panels separated by sashes. Such panels can be folders - * containing pages. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows Windows}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel() - * @model - * @generated - */ -public interface SashModel extends EObject { - - /** - * Returns the value of the 'Windows' containment reference list. - * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window}. - * - *

- * If the meaning of the 'Windows' containment reference list isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Windows' containment reference list. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_Windows() - * @model containment="true" ordered="false" - * @generated - */ - EList getWindows(); - - /** - * Returns the value of the 'Current Selection' reference. - * - *

- * If the meaning of the 'Current Selection' reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Current Selection' reference. - * @see #setCurrentSelection(TabFolder) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_CurrentSelection() - * @model required="true" ordered="false" - * @generated - */ - TabFolder getCurrentSelection(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}' reference. - * - * - * - * @param value - * the new value of the 'Current Selection' reference. - * @see #getCurrentSelection() - * @generated - */ - void setCurrentSelection(TabFolder value); - - /** - * Returns the value of the 'Restore Active Page' attribute. - * - *

- * If the meaning of the 'Restore Active Page' attribute isn't clear, - * there really should be more of a description here... - *

- * - * - * @return the value of the 'Restore Active Page' attribute. - * @see #setRestoreActivePage(boolean) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_RestoreActivePage() - * @model dataType="org.eclipse.papyrus.infra.core.sashwindows.di.boolean" required="true" ordered="false" - * @generated - */ - boolean isRestoreActivePage(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}' attribute. - * - * - * - * @param value - * the new value of the 'Restore Active Page' attribute. - * @see #isRestoreActivePage() - * @generated - */ - void setRestoreActivePage(boolean value); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - @Deprecated - void addPage(Object pageIdentifier); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void removePage(Object pageIdentifier); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void removePageAndEmptyFolder(Object pageIdentifier); - - /** - * - * - * - * @model selectionRequired="true" selectionOrdered="false" - * @generated - */ - void setCurrentSelectionSilently(TabFolder selection); - - /** - * - * - * - * @model folderRequired="true" folderOrdered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void addPage(TabFolder folder, Object pageIdentifier); - - /** - * - * - * - * @model folderRequired="true" folderOrdered="false" pageRefRequired="true" pageRefOrdered="false" - * @generated - */ - void addPage(TabFolder folder, PageRef pageRef); - - /** - * - * - * - * Lookup the pageRef identified by the pageIdentifier. - * Return the pageRef or null if not found. - * Lookup in the entire SashModel structure. - * - * - * @model required="true" ordered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - PageRef lookupPage(Object pageIdentifier); - - /** - * - * - * - * @model srcParentFolderRequired="true" srcParentFolderOrdered="false" srcIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" srcIndexRequired="true" srcIndexOrdered="false" targetParentFolderRequired="true" targetParentFolderOrdered="false" - * targetIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" targetIndexRequired="true" targetIndexOrdered="false" - * @generated - */ - void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder, int targetIndex); - - /** - * - * - * - * @model folderToInsertRequired="true" folderToInsertOrdered="false" refFolderRequired="true" refFolderOrdered="false" refFolderSideDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" refFolderSideRequired="true" refFolderSideOrdered="false" - * @generated - */ - void insertFolder(TabFolder folderToInsert, TabFolder refFolder, int refFolderSide); - - /** - * - * - * - * @model srcParentFolderRequired="true" srcParentFolderOrdered="false" srcIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" srcIndexRequired="true" srcIndexOrdered="false" targetParentFolderRequired="true" targetParentFolderOrdered="false" - * @generated - */ - void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder); - - /** - * - * - * - * @model folderRequired="true" folderOrdered="false" - * @generated - */ - void removeEmptyFolder(TabFolder folder); - - /** - * - * - * - * Remove all pages from the model. Only left one empty top level folder. - * - * - * @model - * @generated - */ - void removeAllPages(); - - /** - * - * - * - * Remove pages other than the one specified from the model. Intermediate folders are also removed. - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void removeOtherPages(Object pageIdentifier); - - /** - * - * - * - * Get the first available window. - * - * - * @model required="true" ordered="false" - * @generated - */ - Window lookupFirstWindow(); - - /** - * - * - * - * Lookup the first available folder. - * - * - * @model required="true" ordered="false" - * @generated - */ - TabFolder lookupFirstFolder(); - -} // SashModel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java deleted file mode 100644 index 6fe1ae7a36a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - - -/** - * - * A representation of the model object 'Sash Panel'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel() - * @model - * @generated - */ -public interface SashPanel extends AbstractPanel, PanelParent { - - /** - * Returns the value of the 'Sash Position' attribute. - * - * - * - * Position of the sash in the panel. The position is in percent. The value should be between 0 and 100. - * - * - * @return the value of the 'Sash Position' attribute. - * @see #setSashPosition(float) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel_SashPosition() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.Float" required="true" ordered="false" - * @generated - */ - float getSashPosition(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}' attribute. - * - * - * - * @param value - * the new value of the 'Sash Position' attribute. - * @see #getSashPosition() - * @generated - */ - void setSashPosition(float value); - - /** - * Returns the value of the 'Direction' attribute. - * - *

- * If the meaning of the 'Direction' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Direction' attribute. - * @see #setDirection(int) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel_Direction() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" - * @generated - */ - int getDirection(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}' attribute. - * - * - * - * @param value - * the new value of the 'Direction' attribute. - * @see #getDirection() - * @generated - */ - void setDirection(int value); - - /** - * - * - * - * @model leftChildRequired="true" leftChildOrdered="false" rightChildRequired="true" rightChildOrdered="false" directionDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" directionRequired="true" directionOrdered="false" - * @generated - */ - void setChildren(AbstractPanel leftChild, AbstractPanel rightChild, int direction); - - /** - * - * - * - * @model childToDeleteRequired="true" childToDeleteOrdered="false" - * @generated - */ - void delete(AbstractPanel childToDelete); - -} // SashPanel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java deleted file mode 100644 index 98435168cbf..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Sash Windows Mngr'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr() - * @model - * @generated - */ -public interface SashWindowsMngr extends EObject { - - /** - * Returns the value of the 'Page List' containment reference. - * - *

- * If the meaning of the 'Page List' containment reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Page List' containment reference. - * @see #setPageList(PageList) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_PageList() - * @model containment="true" required="true" ordered="false" - * @generated - */ - @Deprecated - PageList getPageList(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}' containment reference. - * - * - * - * @param value - * the new value of the 'Page List' containment reference. - * @see #getPageList() - * @generated - */ - @Deprecated - void setPageList(PageList value); - - /** - * Returns the value of the 'Sash Model' containment reference. - * - *

- * If the meaning of the 'Sash Model' containment reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Sash Model' containment reference. - * @see #setSashModel(SashModel) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_SashModel() - * @model containment="true" required="true" ordered="false" - * @generated - */ - SashModel getSashModel(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}' containment reference. - * - * - * - * @param value - * the new value of the 'Sash Model' containment reference. - * @see #getSashModel() - * @generated - */ - void setSashModel(SashModel value); - -} // SashWindowsMngr diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java deleted file mode 100644 index bae6ddb996a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * A representation of the model object 'Size'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize() - * @model - * @generated - */ -public interface Size extends EObject { - - /** - * Returns the value of the 'Width' attribute. - * - *

- * If the meaning of the 'Width' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Width' attribute. - * @see #setWidth(int) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize_Width() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" - * @generated - */ - int getWidth(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}' attribute. - * - * - * - * @param value - * the new value of the 'Width' attribute. - * @see #getWidth() - * @generated - */ - void setWidth(int value); - - /** - * Returns the value of the 'Length' attribute. - * - *

- * If the meaning of the 'Length' attribute isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Length' attribute. - * @see #setLength(int) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize_Length() - * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" - * @generated - */ - int getLength(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}' attribute. - * - * - * - * @param value - * the new value of the 'Length' attribute. - * @see #getLength() - * @generated - */ - void setLength(int value); - -} // Size diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java deleted file mode 100644 index 14add487fed..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java +++ /dev/null @@ -1,135 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di; - -import org.eclipse.emf.common.util.EList; - -/** - * - * A representation of the model object 'Tab Folder'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder() - * @model - * @generated - */ -public interface TabFolder extends AbstractPanel { - - /** - * Returns the value of the 'Children' containment reference list. - * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef}. - * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}'. - * - *

- * If the meaning of the 'Children' containment reference list isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Children' containment reference list. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder_Children() - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent - * @model opposite="parent" containment="true" ordered="false" - * @generated - */ - EList getChildren(); - - /** - * Returns the value of the 'Current Selection' reference. - *

- * This feature subsets the following features: - *

- *
    - *
  • '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren() Children}'
  • - *
- * - *

- * If the meaning of the 'Current Selection' reference isn't clear, - * there really should be more of a description here... - *

- * - * - * @return the value of the 'Current Selection' reference. - * @see #setCurrentSelection(PageRef) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder_CurrentSelection() - * @model ordered="false" - * @generated - */ - PageRef getCurrentSelection(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}' reference. - * - * - * - * @param value - * the new value of the 'Current Selection' reference. - * @see #getCurrentSelection() - * @generated - */ - void setCurrentSelection(PageRef value); - - /** - * - * - * - * @model oldIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" oldIndexRequired="true" oldIndexOrdered="false" newIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" newIndexRequired="true" newIndexOrdered="false" - * @generated - */ - void movePage(int oldIndex, int newIndex); - - /** - * - * - * - * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void addPage(Object pageIdentifier); - - /** - * - * - * - * @model pageIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" pageIndexRequired="true" pageIndexOrdered="false" - * @generated - */ - void removePage(int pageIndex); - - /** - * - * - * - * @model indexDataType="org.eclipse.uml2.types.Integer" indexRequired="true" indexOrdered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" - * @generated - */ - void addPage(int index, Object pageIdentifier); - - /** - * - * - * - * @model pageRefRequired="true" pageRefOrdered="false" - * @generated - */ - void addPage(PageRef pageRef); - -} // TabFolder diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java deleted file mode 100644 index da7ad8de820..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di; - - -/** - * - * A representation of the model object 'Window'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}
  • - *
- * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow() - * @model - * @generated - */ -public interface Window extends PanelParent { - - /** - * Returns the value of the 'Position' reference. - * - *

- * If the meaning of the 'Position' reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Position' reference. - * @see #setPosition(Position) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Position() - * @model required="true" ordered="false" - * @generated - */ - Position getPosition(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}' reference. - * - * - * - * @param value - * the new value of the 'Position' reference. - * @see #getPosition() - * @generated - */ - void setPosition(Position value); - - /** - * Returns the value of the 'Size' reference. - * - *

- * If the meaning of the 'Size' reference isn't clear, there really should be more of a description here... - *

- * - * - * @return the value of the 'Size' reference. - * @see #setSize(Size) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Size() - * @model required="true" ordered="false" - * @generated - */ - Size getSize(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}' reference. - * - * - * - * @param value - * the new value of the 'Size' reference. - * @see #getSize() - * @generated - */ - void setSize(Size value); - - /** - * Returns the value of the 'Panel' reference. - * - * - * - * Redefine children. - * - * - * @return the value of the 'Panel' reference. - * @see #setPanel(AbstractPanel) - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Panel() - * @model required="true" transient="true" volatile="true" derived="true" ordered="false" - * @generated - */ - AbstractPanel getPanel(); - - /** - * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}' reference. - * - * - * - * @param value - * the new value of the 'Panel' reference. - * @see #getPanel() - * @generated - */ - void setPanel(AbstractPanel value); - -} // Window diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java deleted file mode 100644 index 8822cbbf94c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 Atos Origin. - * - * - * 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: - * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di.exception; - - -/** - * Exception for the Sash editor system - * - * @author eperico - */ -public class SashEditorException extends Exception { - - private static final long serialVersionUID = 1L; - - /** - * Instantiates a new sash editor exception. - */ - public SashEditorException() { - } - - /** - * @param message - */ - public SashEditorException(String message) { - super(message); - } - - /** - * @param cause - */ - public SashEditorException(Throwable cause) { - super(cause); - } - - /** - * @param message - * @param cause - */ - public SashEditorException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java deleted file mode 100644 index 3be4962100e..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java +++ /dev/null @@ -1,181 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; - -/** - * - * An implementation of the model object 'Abstract Page'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl#getPageIdentifier Page Identifier}
  • - *
- * - * @generated - */ -public class AbstractPageImpl extends EObjectImpl implements AbstractPage { - - /** - * The default value of the '{@link #getPageIdentifier() Page Identifier}' attribute. - * - * - * - * @see #getPageIdentifier() - * @generated - * @ordered - */ - protected static final Object PAGE_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPageIdentifier() Page Identifier}' attribute. - * - * - * - * @see #getPageIdentifier() - * @generated - * @ordered - */ - protected Object pageIdentifier = PAGE_IDENTIFIER_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected AbstractPageImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.ABSTRACT_PAGE; - } - - /** - * - * - * - * @generated - */ - @Override - public Object getPageIdentifier() { - return pageIdentifier; - } - - /** - * - * - * - * @generated - */ - @Override - public void setPageIdentifier(Object newPageIdentifier) { - Object oldPageIdentifier = pageIdentifier; - pageIdentifier = newPageIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER, oldPageIdentifier, pageIdentifier)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: - return getPageIdentifier(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: - setPageIdentifier(newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: - setPageIdentifier(PAGE_IDENTIFIER_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: - return PAGE_IDENTIFIER_EDEFAULT == null ? pageIdentifier != null : !PAGE_IDENTIFIER_EDEFAULT.equals(pageIdentifier); - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (pageIdentifier: "); - result.append(pageIdentifier); - result.append(')'); - return result.toString(); - } - -} // AbstractPageImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java deleted file mode 100644 index 7211ea21a2c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; - -/** - * - * An implementation of the model object 'Abstract Panel'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl#getParent Parent}
  • - *
- * - * @generated - */ -public abstract class AbstractPanelImpl extends EObjectImpl implements AbstractPanel { - - /** - * - * - * - * @generated - */ - protected AbstractPanelImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.ABSTRACT_PANEL; - } - - /** - * - * - * - * @generated - */ - @Override - public PanelParent getParent() { - if (eContainerFeatureID() != DiPackage.ABSTRACT_PANEL__PARENT) { - return null; - } - return (PanelParent) eInternalContainer(); - } - - /** - * - * - * - * @generated - */ - public NotificationChain basicSetParent(PanelParent newParent, NotificationChain msgs) { - msgs = eBasicSetContainer((InternalEObject) newParent, DiPackage.ABSTRACT_PANEL__PARENT, msgs); - return msgs; - } - - /** - * - * - * - * @generated - */ - @Override - public void setParent(PanelParent newParent) { - if (newParent != eInternalContainer() || (eContainerFeatureID() != DiPackage.ABSTRACT_PANEL__PARENT && newParent != null)) { - if (EcoreUtil.isAncestor(this, newParent)) { - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - } - NotificationChain msgs = null; - if (eInternalContainer() != null) { - msgs = eBasicRemoveFromContainer(msgs); - } - if (newParent != null) { - msgs = ((InternalEObject) newParent).eInverseAdd(this, DiPackage.PANEL_PARENT__CHILDREN, PanelParent.class, msgs); - } - msgs = basicSetParent(newParent, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.ABSTRACT_PANEL__PARENT, newParent, newParent)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - if (eInternalContainer() != null) { - msgs = eBasicRemoveFromContainer(msgs); - } - return basicSetParent((PanelParent) otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - return basicSetParent(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { - switch (eContainerFeatureID()) { - case DiPackage.ABSTRACT_PANEL__PARENT: - return eInternalContainer().eInverseRemove(this, DiPackage.PANEL_PARENT__CHILDREN, PanelParent.class, msgs); - } - return super.eBasicRemoveFromContainerFeature(msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - return getParent(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - setParent((PanelParent) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - setParent((PanelParent) null); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.ABSTRACT_PANEL__PARENT: - return getParent() != null; - } - return super.eIsSet(featureID); - } - -} // AbstractPanelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java deleted file mode 100644 index 4adfc55f84b..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java +++ /dev/null @@ -1,387 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation (assumed) - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; - -/** - * - * An implementation of the model Factory. - * - * - * @generated - */ -public class DiFactoryImpl extends EFactoryImpl implements DiFactory { - - /** - * Creates the default factory implementation. - * - * - * - * @generated - */ - public static DiFactory init() { - try { - DiFactory theDiFactory = (DiFactory) EPackage.Registry.INSTANCE.getEFactory(DiPackage.eNS_URI); - if (theDiFactory != null) { - return theDiFactory; - } - } catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new DiFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * - * - * - * @generated - */ - public DiFactoryImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case DiPackage.SASH_MODEL: - return createSashModel(); - case DiPackage.WINDOW: - return createWindow(); - case DiPackage.POSITION: - return createPosition(); - case DiPackage.SIZE: - return createSize(); - case DiPackage.TAB_FOLDER: - return createTabFolder(); - case DiPackage.PAGE_REF: - return createPageRef(); - case DiPackage.SASH_PANEL: - return createSashPanel(); - case DiPackage.ABSTRACT_PAGE: - return createAbstractPage(); - case DiPackage.PAGE_LIST: - return createPageList(); - case DiPackage.SASH_WINDOWS_MNGR: - return createSashWindowsMngr(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case DiPackage.INT: - return createintFromString(eDataType, initialValue); - case DiPackage.JAVA_OBJECT: - return createJavaObjectFromString(eDataType, initialValue); - case DiPackage.BOOLEAN: - return createbooleanFromString(eDataType, initialValue); - case DiPackage.FLOAT: - return createFloatFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * - * - * - * @generated - */ - @Override - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case DiPackage.INT: - return convertintToString(eDataType, instanceValue); - case DiPackage.JAVA_OBJECT: - return convertJavaObjectToString(eDataType, instanceValue); - case DiPackage.BOOLEAN: - return convertbooleanToString(eDataType, instanceValue); - case DiPackage.FLOAT: - return convertFloatToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * - * - * - * @generated - */ - @Override - public SashModel createSashModel() { - SashModelImpl sashModel = new SashModelImpl(); - return sashModel; - } - - /** - * - * - * - * @generated - */ - @Override - public Window createWindow() { - WindowImpl window = new WindowImpl(); - return window; - } - - /** - * - * - * - * @generated - */ - @Override - public Position createPosition() { - PositionImpl position = new PositionImpl(); - return position; - } - - /** - * - * - * - * @generated - */ - @Override - public Size createSize() { - SizeImpl size = new SizeImpl(); - return size; - } - - /** - * - * - * - * @generated - */ - @Override - public TabFolder createTabFolder() { - TabFolderImpl tabFolder = new TabFolderImpl(); - return tabFolder; - } - - /** - * - * - * - * @generated - */ - @Override - public PageRef createPageRef() { - PageRefImpl pageRef = new PageRefImpl(); - return pageRef; - } - - /** - * - * - * - * @generated - */ - @Override - public SashPanel createSashPanel() { - SashPanelImpl sashPanel = new SashPanelImpl(); - return sashPanel; - } - - /** - * - * - * - * @generated - */ - @Override - public AbstractPage createAbstractPage() { - AbstractPageImpl abstractPage = new AbstractPageImpl(); - return abstractPage; - } - - /** - * - * - * - * @generated - */ - @Override - public PageList createPageList() { - PageListImpl pageList = new PageListImpl(); - return pageList; - } - - /** - * - * - * - * @generated - */ - @Override - public SashWindowsMngr createSashWindowsMngr() { - SashWindowsMngrImpl sashWindowsMngr = new SashWindowsMngrImpl(); - return sashWindowsMngr; - } - - /** - * - * - * - * @generated - */ - public Integer createintFromString(EDataType eDataType, String initialValue) { - return (Integer) super.createFromString(eDataType, initialValue); - } - - /** - * - * - * - * @generated - */ - public String convertintToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * - * - * - * @generated NOT - */ - public Object createJavaObjectFromString(EDataType eDataType, String initialValue) { - Object result = null; - - try { - result = super.createFromString(eDataType, initialValue); - } catch (IllegalArgumentException e) { - // Not deserialized as a Java object? Then just return the string value (or null) - if (initialValue != null) { - result = initialValue.intern(); - } - } - - return result; - } - - /** - * - * - * - * @generated - */ - public String convertJavaObjectToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * - * - * - * @generated - */ - public Float createFloatFromString(EDataType eDataType, String initialValue) { - return (Float) super.createFromString(eDataType, initialValue); - } - - /** - * - * - * - * @generated - */ - public String convertFloatToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * - * - * - * @generated - */ - public Boolean createbooleanFromString(EDataType eDataType, String initialValue) { - return (Boolean) super.createFromString(eDataType, initialValue); - } - - /** - * - * - * - * @generated - */ - public String convertbooleanToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * - * - * - * @generated - */ - @Override - public DiPackage getDiPackage() { - return (DiPackage) getEPackage(); - } - - /** - * - * - * - * @deprecated - * @generated - */ - @Deprecated - public static DiPackage getPackage() { - return DiPackage.eINSTANCE; - } - -} // DiFactoryImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java deleted file mode 100644 index edd144b0e7f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java +++ /dev/null @@ -1,1044 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; -import org.eclipse.uml2.types.TypesPackage; - -/** - * - * An implementation of the model Package. - * - * - * @generated - */ -public class DiPackageImpl extends EPackageImpl implements DiPackage { - - /** - * - * - * - * @generated - */ - private EClass sashModelEClass = null; - - /** - * - * - * - * @generated - */ - private EClass windowEClass = null; - - /** - * - * - * - * @generated - */ - private EClass panelParentEClass = null; - - /** - * - * - * - * @generated - */ - private EClass abstractPanelEClass = null; - - /** - * - * - * - * @generated - */ - private EClass positionEClass = null; - - /** - * - * - * - * @generated - */ - private EClass sizeEClass = null; - - /** - * - * - * - * @generated - */ - private EClass tabFolderEClass = null; - - /** - * - * - * - * @generated - */ - private EClass pageRefEClass = null; - - /** - * - * - * - * @generated - */ - private EClass sashPanelEClass = null; - - /** - * - * - * - * @generated - */ - private EClass abstractPageEClass = null; - - /** - * - * - * - * @generated - */ - private EClass pageListEClass = null; - - /** - * - * - * - * @generated - */ - private EClass sashWindowsMngrEClass = null; - - /** - * - * - * - * @generated - */ - private EDataType intEDataType = null; - - /** - * - * - * - * @generated - */ - private EDataType javaObjectEDataType = null; - - /** - * - * - * - * @generated - */ - private EDataType floatEDataType = null; - - /** - * - * - * - * @generated - */ - private EDataType booleanEDataType = null; - - /** - * Creates an instance of the model Package, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - *

- * Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * - * - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#eNS_URI - * @see #init() - * @generated - */ - private DiPackageImpl() { - super(eNS_URI, DiFactory.eINSTANCE); - } - - /** - * - * - * - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. - * - *

- * This method is used to initialize {@link DiPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * - * - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static DiPackage init() { - if (isInited) { - return (DiPackage) EPackage.Registry.INSTANCE.getEPackage(DiPackage.eNS_URI); - } - - // Obtain or create and register package - DiPackageImpl theDiPackage = (DiPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DiPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DiPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - TypesPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theDiPackage.createPackageContents(); - - // Initialize created meta-data - theDiPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theDiPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(DiPackage.eNS_URI, theDiPackage); - return theDiPackage; - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getSashModel() { - return sashModelEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getSashModel_Windows() { - return (EReference) sashModelEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getSashModel_CurrentSelection() { - return (EReference) sashModelEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getSashModel_RestoreActivePage() { - return (EAttribute) sashModelEClass.getEStructuralFeatures().get(2); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getWindow() { - return windowEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getWindow_Position() { - return (EReference) windowEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getWindow_Size() { - return (EReference) windowEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getWindow_Panel() { - return (EReference) windowEClass.getEStructuralFeatures().get(2); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getPanelParent() { - return panelParentEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getPanelParent_Children() { - return (EReference) panelParentEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getAbstractPanel() { - return abstractPanelEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getAbstractPanel_Parent() { - return (EReference) abstractPanelEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getPosition() { - return positionEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getPosition_X() { - return (EAttribute) positionEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getPosition_Y() { - return (EAttribute) positionEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getSize() { - return sizeEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getSize_Width() { - return (EAttribute) sizeEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getSize_Length() { - return (EAttribute) sizeEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getTabFolder() { - return tabFolderEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getTabFolder_Children() { - return (EReference) tabFolderEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getTabFolder_CurrentSelection() { - return (EReference) tabFolderEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getPageRef() { - return pageRefEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getPageRef_EmfPageIdentifier() { - return (EReference) pageRefEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getPageRef_PageIdentifier() { - return (EAttribute) pageRefEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getPageRef_ObjectPageIdentifier() { - return (EAttribute) pageRefEClass.getEStructuralFeatures().get(2); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getPageRef_FavoriteEditor() { - return (EAttribute) pageRefEClass.getEStructuralFeatures().get(3); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getPageRef_Parent() { - return (EReference) pageRefEClass.getEStructuralFeatures().get(4); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getSashPanel() { - return sashPanelEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getSashPanel_SashPosition() { - return (EAttribute) sashPanelEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getSashPanel_Direction() { - return (EAttribute) sashPanelEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getAbstractPage() { - return abstractPageEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EAttribute getAbstractPage_PageIdentifier() { - return (EAttribute) abstractPageEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getPageList() { - return pageListEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getPageList_AvailablePage() { - return (EReference) pageListEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EClass getSashWindowsMngr() { - return sashWindowsMngrEClass; - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getSashWindowsMngr_PageList() { - return (EReference) sashWindowsMngrEClass.getEStructuralFeatures().get(0); - } - - /** - * - * - * - * @generated - */ - @Override - public EReference getSashWindowsMngr_SashModel() { - return (EReference) sashWindowsMngrEClass.getEStructuralFeatures().get(1); - } - - /** - * - * - * - * @generated - */ - @Override - public EDataType getint() { - return intEDataType; - } - - /** - * - * - * - * @generated - */ - @Override - public EDataType getJavaObject() { - return javaObjectEDataType; - } - - /** - * - * - * - * @generated - */ - @Override - public EDataType getFloat() { - return floatEDataType; - } - - /** - * - * - * - * @generated - */ - @Override - public EDataType getboolean() { - return booleanEDataType; - } - - /** - * - * - * - * @generated - */ - @Override - public DiFactory getDiFactory() { - return (DiFactory) getEFactoryInstance(); - } - - /** - * - * - * - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * - * - * - * @generated - */ - public void createPackageContents() { - if (isCreated) { - return; - } - isCreated = true; - - // Create classes and their features - sashModelEClass = createEClass(SASH_MODEL); - createEReference(sashModelEClass, SASH_MODEL__WINDOWS); - createEReference(sashModelEClass, SASH_MODEL__CURRENT_SELECTION); - createEAttribute(sashModelEClass, SASH_MODEL__RESTORE_ACTIVE_PAGE); - - windowEClass = createEClass(WINDOW); - createEReference(windowEClass, WINDOW__POSITION); - createEReference(windowEClass, WINDOW__SIZE); - createEReference(windowEClass, WINDOW__PANEL); - - panelParentEClass = createEClass(PANEL_PARENT); - createEReference(panelParentEClass, PANEL_PARENT__CHILDREN); - - abstractPanelEClass = createEClass(ABSTRACT_PANEL); - createEReference(abstractPanelEClass, ABSTRACT_PANEL__PARENT); - - positionEClass = createEClass(POSITION); - createEAttribute(positionEClass, POSITION__X); - createEAttribute(positionEClass, POSITION__Y); - - sizeEClass = createEClass(SIZE); - createEAttribute(sizeEClass, SIZE__WIDTH); - createEAttribute(sizeEClass, SIZE__LENGTH); - - tabFolderEClass = createEClass(TAB_FOLDER); - createEReference(tabFolderEClass, TAB_FOLDER__CHILDREN); - createEReference(tabFolderEClass, TAB_FOLDER__CURRENT_SELECTION); - - pageRefEClass = createEClass(PAGE_REF); - createEReference(pageRefEClass, PAGE_REF__EMF_PAGE_IDENTIFIER); - createEAttribute(pageRefEClass, PAGE_REF__PAGE_IDENTIFIER); - createEAttribute(pageRefEClass, PAGE_REF__OBJECT_PAGE_IDENTIFIER); - createEAttribute(pageRefEClass, PAGE_REF__FAVORITE_EDITOR); - createEReference(pageRefEClass, PAGE_REF__PARENT); - - sashPanelEClass = createEClass(SASH_PANEL); - createEAttribute(sashPanelEClass, SASH_PANEL__SASH_POSITION); - createEAttribute(sashPanelEClass, SASH_PANEL__DIRECTION); - - abstractPageEClass = createEClass(ABSTRACT_PAGE); - createEAttribute(abstractPageEClass, ABSTRACT_PAGE__PAGE_IDENTIFIER); - - pageListEClass = createEClass(PAGE_LIST); - createEReference(pageListEClass, PAGE_LIST__AVAILABLE_PAGE); - - sashWindowsMngrEClass = createEClass(SASH_WINDOWS_MNGR); - createEReference(sashWindowsMngrEClass, SASH_WINDOWS_MNGR__PAGE_LIST); - createEReference(sashWindowsMngrEClass, SASH_WINDOWS_MNGR__SASH_MODEL); - - // Create data types - intEDataType = createEDataType(INT); - javaObjectEDataType = createEDataType(JAVA_OBJECT); - booleanEDataType = createEDataType(BOOLEAN); - floatEDataType = createEDataType(FLOAT); - } - - /** - * - * - * - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * - * - * - * @generated - */ - public void initializePackageContents() { - if (isInitialized) { - return; - } - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - TypesPackage theTypesPackage = (TypesPackage) EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI); - EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - windowEClass.getESuperTypes().add(this.getPanelParent()); - tabFolderEClass.getESuperTypes().add(this.getAbstractPanel()); - sashPanelEClass.getESuperTypes().add(this.getAbstractPanel()); - sashPanelEClass.getESuperTypes().add(this.getPanelParent()); - - // Initialize classes and features; add operations and parameters - initEClass(sashModelEClass, SashModel.class, "SashModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getSashModel_Windows(), this.getWindow(), null, "windows", null, 0, -1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEReference(getSashModel_CurrentSelection(), this.getTabFolder(), null, "currentSelection", null, 1, 1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - initEAttribute(getSashModel_RestoreActivePage(), this.getboolean(), "restoreActivePage", null, 1, 1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - EOperation op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, this.getPageRef(), "lookupPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "srcParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "srcIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "targetParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "targetIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "insertFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "folderToInsert", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "refFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "refFolderSide", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "srcParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "srcIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "targetParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "removeEmptyFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); - - addEOperation(sashModelEClass, null, "removeAllPages", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "removeOtherPages", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - addEOperation(sashModelEClass, this.getWindow(), "lookupFirstWindow", 1, 1, IS_UNIQUE, !IS_ORDERED); - - addEOperation(sashModelEClass, this.getTabFolder(), "lookupFirstFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "removePageAndEmptyFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "setCurrentSelectionSilently", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "selection", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getPageRef(), "pageRef", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(windowEClass, Window.class, "Window", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getWindow_Position(), this.getPosition(), null, "position", null, 1, 1, Window.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEReference(getWindow_Size(), this.getSize(), null, "size", null, 1, 1, Window.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEReference(getWindow_Panel(), this.getAbstractPanel(), null, "panel", null, 1, 1, Window.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, IS_DERIVED, !IS_ORDERED); - - initEClass(panelParentEClass, PanelParent.class, "PanelParent", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPanelParent_Children(), this.getAbstractPanel(), this.getAbstractPanel_Parent(), "children", null, 2, 2, PanelParent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, !IS_ORDERED); - - op = addEOperation(panelParentEClass, null, "replaceChild", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getAbstractPanel(), "oldChild", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getAbstractPanel(), "newChild", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(abstractPanelEClass, AbstractPanel.class, "AbstractPanel", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getAbstractPanel_Parent(), this.getPanelParent(), this.getPanelParent_Children(), "parent", null, 1, 1, AbstractPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, - !IS_DERIVED, !IS_ORDERED); - - initEClass(positionEClass, Position.class, "Position", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPosition_X(), this.getint(), "x", null, 1, 1, Position.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEAttribute(getPosition_Y(), this.getint(), "y", null, 1, 1, Position.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - initEClass(sizeEClass, Size.class, "Size", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getSize_Width(), this.getint(), "width", null, 1, 1, Size.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEAttribute(getSize_Length(), this.getint(), "length", null, 1, 1, Size.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - initEClass(tabFolderEClass, TabFolder.class, "TabFolder", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTabFolder_Children(), this.getPageRef(), this.getPageRef_Parent(), "children", null, 0, -1, TabFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - initEReference(getTabFolder_CurrentSelection(), this.getPageRef(), null, "currentSelection", null, 0, 1, TabFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - - op = addEOperation(tabFolderEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "oldIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "newIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(tabFolderEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "pageIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, theTypesPackage.getInteger(), "index", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getPageRef(), "pageRef", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(pageRefEClass, PageRef.class, "PageRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPageRef_EmfPageIdentifier(), theEcorePackage.getEObject(), null, "emfPageIdentifier", null, 1, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - initEAttribute(getPageRef_PageIdentifier(), this.getJavaObject(), "pageIdentifier", null, 1, 1, PageRef.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, !IS_ORDERED); - initEAttribute(getPageRef_ObjectPageIdentifier(), this.getJavaObject(), "objectPageIdentifier", null, 1, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEAttribute(getPageRef_FavoriteEditor(), theTypesPackage.getString(), "favoriteEditor", null, 0, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEReference(getPageRef_Parent(), this.getTabFolder(), this.getTabFolder_Children(), "parent", null, 0, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - - op = addEOperation(pageRefEClass, this.getboolean(), "isForIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(sashPanelEClass, SashPanel.class, "SashPanel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getSashPanel_SashPosition(), this.getFloat(), "sashPosition", null, 1, 1, SashPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEAttribute(getSashPanel_Direction(), this.getint(), "direction", null, 1, 1, SashPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - op = addEOperation(sashPanelEClass, null, "setChildren", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getAbstractPanel(), "leftChild", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getAbstractPanel(), "rightChild", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getint(), "direction", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(sashPanelEClass, null, "delete", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getAbstractPanel(), "childToDelete", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(abstractPageEClass, AbstractPage.class, "AbstractPage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getAbstractPage_PageIdentifier(), this.getJavaObject(), "pageIdentifier", null, 1, 1, AbstractPage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - initEClass(pageListEClass, PageList.class, "PageList", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPageList_AvailablePage(), this.getPageRef(), null, "availablePage", null, 0, -1, PageList.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - - op = addEOperation(pageListEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - op = addEOperation(pageListEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); - addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); - - initEClass(sashWindowsMngrEClass, SashWindowsMngr.class, "SashWindowsMngr", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getSashWindowsMngr_PageList(), this.getPageList(), null, "pageList", null, 1, 1, SashWindowsMngr.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - initEReference(getSashWindowsMngr_SashModel(), this.getSashModel(), null, "sashModel", null, 1, 1, SashWindowsMngr.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, - !IS_ORDERED); - - // Initialize data types - initEDataType(intEDataType, int.class, "int", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - initEDataType(javaObjectEDataType, Object.class, "JavaObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - initEDataType(booleanEDataType, boolean.class, "boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - initEDataType(floatEDataType, float.class, "Float", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // resource=XMI - createResourceXMIAnnotations(); - // http://www.eclipse.org/uml2/2.0.0/UML - createUMLAnnotations(); - // subsets - createSubsetsAnnotations(); - } - - /** - * Initializes the annotations for resource=XMI. - * - * - * - * @generated - */ - protected void createResourceXMIAnnotations() { - String source = "resource=XMI"; - addAnnotation(this, - source, - new String[] { - }); - } - - /** - * Initializes the annotations for http://www.eclipse.org/uml2/2.0.0/UML. - * - * - * - * @generated - */ - protected void createUMLAnnotations() { - String source = "http://www.eclipse.org/uml2/2.0.0/UML"; - addAnnotation(intEDataType, - source, - new String[] { - "originalName", "Integer" - }); - } - - /** - * Initializes the annotations for subsets. - * - * - * - * @generated - */ - protected void createSubsetsAnnotations() { - String source = "subsets"; - addAnnotation(getTabFolder_CurrentSelection(), - source, - new String[] { - }, - new URI[] { - URI.createURI(eNS_URI).appendFragment("//TabFolder/children") - }); - } - -} // DiPackageImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java deleted file mode 100644 index f2bad18afc5..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java +++ /dev/null @@ -1,195 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; - -/** - * - * An implementation of the model object 'Page List'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl#getAvailablePage Available Page}
  • - *
- * - * @generated - */ -public class PageListImpl extends EObjectImpl implements PageList { - - /** - * The cached value of the '{@link #getAvailablePage() Available Page}' containment reference list. - * - * - * - * @see #getAvailablePage() - * @generated - * @ordered - */ - protected EList availablePage; - - /** - * - * - * - * @generated - */ - protected PageListImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.PAGE_LIST; - } - - /** - * - * - * - * @generated - */ - @Override - public EList getAvailablePage() { - if (availablePage == null) { - availablePage = new EObjectContainmentEList(PageRef.class, this, DiPackage.PAGE_LIST__AVAILABLE_PAGE); - } - return availablePage; - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(Object pageIdentifier) { - - PageRef pageRef = DiFactory.eINSTANCE.createPageRef(); - pageRef.setPageIdentifier(pageIdentifier); - getAvailablePage().add(pageRef); - - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removePage(Object pageIdentifier) { - for (PageRef pageRef : getAvailablePage()) { - - if (pageRef.isForIdentifier(pageIdentifier)) { - getAvailablePage().remove(pageRef); - return; - } - } - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.PAGE_LIST__AVAILABLE_PAGE: - return ((InternalEList) getAvailablePage()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.PAGE_LIST__AVAILABLE_PAGE: - return getAvailablePage(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.PAGE_LIST__AVAILABLE_PAGE: - getAvailablePage().clear(); - getAvailablePage().addAll((Collection) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.PAGE_LIST__AVAILABLE_PAGE: - getAvailablePage().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.PAGE_LIST__AVAILABLE_PAGE: - return availablePage != null && !availablePage.isEmpty(); - } - return super.eIsSet(featureID); - } - -} // PageListImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java deleted file mode 100644 index 0d7e17a5419..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java +++ /dev/null @@ -1,507 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; - -/** - * - * An implementation of the model object 'Page Ref'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getEmfPageIdentifier Emf Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getPageIdentifier Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getObjectPageIdentifier Object Page Identifier}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getFavoriteEditor Favorite Editor}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getParent Parent}
  • - *
- * - * @generated - */ -public class PageRefImpl extends EObjectImpl implements PageRef { - - /** - * The cached value of the '{@link #getEmfPageIdentifier() Emf Page Identifier}' reference. - * - * - * - * @see #getEmfPageIdentifier() - * @generated - * @ordered - */ - protected EObject emfPageIdentifier; - - /** - * The default value of the '{@link #getPageIdentifier() Page Identifier}' attribute. - * - * - * - * @see #getPageIdentifier() - * @generated - * @ordered - */ - protected static final Object PAGE_IDENTIFIER_EDEFAULT = null; - - /** - * The default value of the '{@link #getObjectPageIdentifier() Object Page Identifier}' attribute. - * - * - * - * @see #getObjectPageIdentifier() - * @generated - * @ordered - */ - protected static final Object OBJECT_PAGE_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getObjectPageIdentifier() Object Page Identifier}' attribute. - * - * - * - * @see #getObjectPageIdentifier() - * @generated - * @ordered - */ - protected Object objectPageIdentifier = OBJECT_PAGE_IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getFavoriteEditor() Favorite Editor}' attribute. - * - * - * - * @see #getFavoriteEditor() - * @generated - * @ordered - */ - protected static final String FAVORITE_EDITOR_EDEFAULT = null; - - /** - * The cached value of the '{@link #getFavoriteEditor() Favorite Editor}' attribute. - * - * - * - * @see #getFavoriteEditor() - * @generated - * @ordered - */ - protected String favoriteEditor = FAVORITE_EDITOR_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected PageRefImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.PAGE_REF; - } - - /** - * - * - * - * @generated - */ - @Override - public EObject getEmfPageIdentifier() { - if (emfPageIdentifier != null && emfPageIdentifier.eIsProxy()) { - InternalEObject oldEmfPageIdentifier = (InternalEObject) emfPageIdentifier; - emfPageIdentifier = eResolveProxy(oldEmfPageIdentifier); - if (emfPageIdentifier != oldEmfPageIdentifier) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER, oldEmfPageIdentifier, emfPageIdentifier)); - } - } - } - return emfPageIdentifier; - } - - /** - * - * - * - * @generated - */ - public EObject basicGetEmfPageIdentifier() { - return emfPageIdentifier; - } - - /** - * - * - * - * @generated - */ - @Override - public void setEmfPageIdentifier(EObject newEmfPageIdentifier) { - EObject oldEmfPageIdentifier = emfPageIdentifier; - emfPageIdentifier = newEmfPageIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER, oldEmfPageIdentifier, emfPageIdentifier)); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public Object getPageIdentifier() { - Object res = getEmfPageIdentifier(); - - if (res != null) { - return res; - } else { - return getObjectPageIdentifier(); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public boolean isForIdentifier(Object pageIdentifier) { - // Avoid npe when there is an invalid "availablePage". See Bug 398712: Multiple issues with the PageManager - if (getPageIdentifier() == null) { - return false; - } - return getPageIdentifier().equals(pageIdentifier); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.PAGE_REF__PARENT: - if (eInternalContainer() != null) { - msgs = eBasicRemoveFromContainer(msgs); - } - return basicSetParent((TabFolder) otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.PAGE_REF__PARENT: - return basicSetParent(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { - switch (eContainerFeatureID()) { - case DiPackage.PAGE_REF__PARENT: - return eInternalContainer().eInverseRemove(this, DiPackage.TAB_FOLDER__CHILDREN, TabFolder.class, msgs); - } - return super.eBasicRemoveFromContainerFeature(msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: - if (resolve) { - return getEmfPageIdentifier(); - } - return basicGetEmfPageIdentifier(); - case DiPackage.PAGE_REF__PAGE_IDENTIFIER: - return getPageIdentifier(); - case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: - return getObjectPageIdentifier(); - case DiPackage.PAGE_REF__FAVORITE_EDITOR: - return getFavoriteEditor(); - case DiPackage.PAGE_REF__PARENT: - return getParent(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: - setEmfPageIdentifier((EObject) newValue); - return; - case DiPackage.PAGE_REF__PAGE_IDENTIFIER: - setPageIdentifier(newValue); - return; - case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: - setObjectPageIdentifier(newValue); - return; - case DiPackage.PAGE_REF__FAVORITE_EDITOR: - setFavoriteEditor((String) newValue); - return; - case DiPackage.PAGE_REF__PARENT: - setParent((TabFolder) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: - setEmfPageIdentifier((EObject) null); - return; - case DiPackage.PAGE_REF__PAGE_IDENTIFIER: - setPageIdentifier(PAGE_IDENTIFIER_EDEFAULT); - return; - case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: - setObjectPageIdentifier(OBJECT_PAGE_IDENTIFIER_EDEFAULT); - return; - case DiPackage.PAGE_REF__FAVORITE_EDITOR: - setFavoriteEditor(FAVORITE_EDITOR_EDEFAULT); - return; - case DiPackage.PAGE_REF__PARENT: - setParent((TabFolder) null); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: - return emfPageIdentifier != null; - case DiPackage.PAGE_REF__PAGE_IDENTIFIER: - return PAGE_IDENTIFIER_EDEFAULT == null ? getPageIdentifier() != null : !PAGE_IDENTIFIER_EDEFAULT.equals(getPageIdentifier()); - case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: - return OBJECT_PAGE_IDENTIFIER_EDEFAULT == null ? objectPageIdentifier != null : !OBJECT_PAGE_IDENTIFIER_EDEFAULT.equals(objectPageIdentifier); - case DiPackage.PAGE_REF__FAVORITE_EDITOR: - return FAVORITE_EDITOR_EDEFAULT == null ? favoriteEditor != null : !FAVORITE_EDITOR_EDEFAULT.equals(favoriteEditor); - case DiPackage.PAGE_REF__PARENT: - return getParent() != null; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (objectPageIdentifier: "); - result.append(objectPageIdentifier); - result.append(", favoriteEditor: "); - result.append(favoriteEditor); - result.append(')'); - return result.toString(); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void setPageIdentifier(Object newPageIdentifier) { - - if (newPageIdentifier instanceof EObject) { - setEmfPageIdentifier((EObject) newPageIdentifier); - return; - } - - // if null, unset all - if (newPageIdentifier == null && getEmfPageIdentifier() != null) { - setEmfPageIdentifier(null); - } - - // By default, consider newPageIdentifier as an Object - setObjectPageIdentifier(newPageIdentifier); - - } - - /** - * - * - * - * @generated - */ - @Override - public Object getObjectPageIdentifier() { - return objectPageIdentifier; - } - - /** - * - * - * - * @generated - */ - @Override - public void setObjectPageIdentifier(Object newObjectPageIdentifier) { - Object oldObjectPageIdentifier = objectPageIdentifier; - objectPageIdentifier = newObjectPageIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER, oldObjectPageIdentifier, objectPageIdentifier)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public String getFavoriteEditor() { - return favoriteEditor; - } - - /** - * - * - * - * @generated - */ - @Override - public void setFavoriteEditor(String newFavoriteEditor) { - String oldFavoriteEditor = favoriteEditor; - favoriteEditor = newFavoriteEditor; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__FAVORITE_EDITOR, oldFavoriteEditor, favoriteEditor)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public TabFolder getParent() { - if (eContainerFeatureID() != DiPackage.PAGE_REF__PARENT) { - return null; - } - return (TabFolder) eInternalContainer(); - } - - /** - * - * - * - * @generated - */ - public NotificationChain basicSetParent(TabFolder newParent, NotificationChain msgs) { - msgs = eBasicSetContainer((InternalEObject) newParent, DiPackage.PAGE_REF__PARENT, msgs); - return msgs; - } - - /** - * - * - * - * @generated - */ - @Override - public void setParent(TabFolder newParent) { - if (newParent != eInternalContainer() || (eContainerFeatureID() != DiPackage.PAGE_REF__PARENT && newParent != null)) { - if (EcoreUtil.isAncestor(this, newParent)) { - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - } - NotificationChain msgs = null; - if (eInternalContainer() != null) { - msgs = eBasicRemoveFromContainer(msgs); - } - if (newParent != null) { - msgs = ((InternalEObject) newParent).eInverseAdd(this, DiPackage.TAB_FOLDER__CHILDREN, TabFolder.class, msgs); - } - msgs = basicSetParent(newParent, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__PARENT, newParent, newParent)); - } - } - -} // PageRefImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java deleted file mode 100644 index a7dcfb9b351..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java +++ /dev/null @@ -1,191 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; - -/** - * - * An implementation of the model object 'Panel Parent'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl#getChildren Children}
  • - *
- * - * @generated - */ -public abstract class PanelParentImpl extends EObjectImpl implements PanelParent { - - /** - * The cached value of the '{@link #getChildren() Children}' containment reference list. - * - * - * - * @see #getChildren() - * @generated - * @ordered - */ - protected EList children; - - /** - * - * - * - * @generated - */ - protected PanelParentImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.PANEL_PARENT; - } - - /** - * - * - * - * @generated - */ - @Override - public EList getChildren() { - if (children == null) { - children = new EObjectContainmentWithInverseEList(AbstractPanel.class, this, DiPackage.PANEL_PARENT__CHILDREN, DiPackage.ABSTRACT_PANEL__PARENT); - } - return children; - } - - /** - * - * - * - * @generated - */ - @Override - public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - return getChildren(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - getChildren().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - return children != null && !children.isEmpty(); - } - return super.eIsSet(featureID); - } - -} // PanelParentImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java deleted file mode 100644 index 0b3c46eb30a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; - -/** - * - * An implementation of the model object 'Position'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl#getX X}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl#getY Y}
  • - *
- * - * @generated - */ -public class PositionImpl extends EObjectImpl implements Position { - - /** - * The default value of the '{@link #getX() X}' attribute. - * - * - * - * @see #getX() - * @generated - * @ordered - */ - protected static final int X_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getX() X}' attribute. - * - * - * - * @see #getX() - * @generated - * @ordered - */ - protected int x = X_EDEFAULT; - - /** - * The default value of the '{@link #getY() Y}' attribute. - * - * - * - * @see #getY() - * @generated - * @ordered - */ - protected static final int Y_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getY() Y}' attribute. - * - * - * - * @see #getY() - * @generated - * @ordered - */ - protected int y = Y_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected PositionImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.POSITION; - } - - /** - * - * - * - * @generated - */ - @Override - public int getX() { - return x; - } - - /** - * - * - * - * @generated - */ - @Override - public void setX(int newX) { - int oldX = x; - x = newX; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.POSITION__X, oldX, x)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public int getY() { - return y; - } - - /** - * - * - * - * @generated - */ - @Override - public void setY(int newY) { - int oldY = y; - y = newY; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.POSITION__Y, oldY, y)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.POSITION__X: - return getX(); - case DiPackage.POSITION__Y: - return getY(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.POSITION__X: - setX((Integer) newValue); - return; - case DiPackage.POSITION__Y: - setY((Integer) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.POSITION__X: - setX(X_EDEFAULT); - return; - case DiPackage.POSITION__Y: - setY(Y_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.POSITION__X: - return x != X_EDEFAULT; - case DiPackage.POSITION__Y: - return y != Y_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (x: "); - result.append(x); - result.append(", y: "); - result.append(y); - result.append(')'); - return result.toString(); - } - -} // PositionImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java deleted file mode 100644 index 4a3c7dcc10c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java +++ /dev/null @@ -1,864 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; -import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch; -import org.eclipse.papyrus.infra.core.sashwindows.di.util.PageRemovalValidator; -import org.eclipse.swt.SWT; - -/** - * - * An implementation of the model object 'Sash Model'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#getWindows Windows}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#getCurrentSelection Current Selection}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#isRestoreActivePage Restore Active Page}
  • - *
- * - * @generated - */ -public class SashModelImpl extends EObjectImpl implements SashModel { - - /** - * The cached value of the '{@link #getWindows() Windows}' containment reference list. - * - * - * - * @see #getWindows() - * @generated - * @ordered - */ - protected EList windows; - - /** - * The cached value of the '{@link #getCurrentSelection() Current Selection}' reference. - * - * - * - * @see #getCurrentSelection() - * @generated - * @ordered - */ - protected TabFolder currentSelection; - - /** - * The default value of the '{@link #isRestoreActivePage() Restore Active Page}' attribute. - * - * - * - * @see #isRestoreActivePage() - * @generated - * @ordered - */ - protected static final boolean RESTORE_ACTIVE_PAGE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isRestoreActivePage() Restore Active Page}' attribute. - * - * - * - * @see #isRestoreActivePage() - * @generated - * @ordered - */ - protected boolean restoreActivePage = RESTORE_ACTIVE_PAGE_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected SashModelImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.SASH_MODEL; - } - - /** - * - * - * - * @generated - */ - @Override - public EList getWindows() { - if (windows == null) { - windows = new EObjectContainmentEList(Window.class, this, DiPackage.SASH_MODEL__WINDOWS); - } - return windows; - } - - /** - * - * - * - * @generated - */ - @Override - public TabFolder getCurrentSelection() { - if (currentSelection != null && currentSelection.eIsProxy()) { - InternalEObject oldCurrentSelection = (InternalEObject) currentSelection; - currentSelection = (TabFolder) eResolveProxy(oldCurrentSelection); - if (currentSelection != oldCurrentSelection) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.SASH_MODEL__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); - } - } - } - return currentSelection; - } - - /** - * - * - * - * @generated - */ - public TabFolder basicGetCurrentSelection() { - return currentSelection; - } - - /** - * - * - * - * @generated - */ - @Override - public void setCurrentSelection(TabFolder newCurrentSelection) { - TabFolder oldCurrentSelection = currentSelection; - currentSelection = newCurrentSelection; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_MODEL__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public boolean isRestoreActivePage() { - return restoreActivePage; - } - - /** - * - * - * - * @generated - */ - @Override - public void setRestoreActivePage(boolean newRestoreActivePage) { - boolean oldRestoreActivePage = restoreActivePage; - restoreActivePage = newRestoreActivePage; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE, oldRestoreActivePage, restoreActivePage)); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(Object pageIdentifier) { - getCurrentSelection().addPage(pageIdentifier); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(TabFolder folder, Object pageIdentifier) { - // if(folder==null) { - // // Use first folder - // folder = getFirstFolder(); - // } - folder.addPage(pageIdentifier); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(TabFolder folder, PageRef pageRef) { - folder.addPage(pageRef); - } - - /** - * Get the first folder in the model. - * Return null if no folder exist. - * - * @return - */ - // public TabFolder getFirstFolder() { - // - // } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removePage(Object pageIdentifier) { - PageRef pageRef = lookupPage(pageIdentifier); - if ((pageRef == null) || !PageRemovalValidator.getInstance(this).canRemovePage(pageRef)) { - return; - } - - // Get the folder containing the page - TabFolder folder = pageRef.getParent(); - // Remove the page - folder.getChildren().remove(pageRef); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removePageAndEmptyFolder(Object pageIdentifier) { - PageRef pageRef; - - PageRemovalValidator validator = PageRemovalValidator.getInstance(this); - for (pageRef = lookupPage(pageIdentifier); (pageRef != null) && validator.canRemovePage(pageRef); pageRef = lookupPage(pageIdentifier)) { - removeAndEmptyFolder(pageRef); - } - - } - - void removeAndEmptyFolder(PageRef pageRef) { - // Get the folder containing the page - TabFolder folder = pageRef.getParent(); - // Remove the page - folder.getChildren().remove(pageRef); - // Remove parent if empty - removeEmptyFolder(folder); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void setCurrentSelectionSilently(TabFolder selection) { - currentSelection = selection; - } - - /** - * - * - * - * @generated NOT - */ - @Override - public PageRef lookupPage(final Object pageIdentifier) { - - // Create appropriate visitor. - DiSwitch visitor = new DiSwitch() { - - /** - * Iterate over windows - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashModel(org.eclipse.papyrus.infra.core.sashwindows.di.SashModel) - * - * @param object - * @return - */ - @Override - public PageRef caseSashModel(SashModel object) { - PageRef res = null; - for (Window window : object.getWindows()) { - res = this.doSwitch(window); - if (res != null) { - return res; - } - } - - return super.caseSashModel(object); - } - - /** - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window) - * - * @param object - * @return - */ - @Override - public PageRef caseWindow(Window window) { - - AbstractPanel panel = window.getPanel(); - if (panel == null) { - return null; - } - - - PageRef res = this.doSwitch(panel); - if (res != null) { - return res; - } - - return super.caseWindow(window); - } - - /** - * Iterate over children - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashPanel(org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel) - * - * @param object - * @return - */ - @Override - public PageRef caseSashPanel(SashPanel object) { - PageRef res = null; - for (AbstractPanel panel : object.getChildren()) { - res = this.doSwitch(panel); - if (res != null) { - return res; - } - } - - return super.caseSashPanel(object); - } - - /** - * Iterate over PageRef - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseTabFolder(org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder) - * - * @param object - * @return - */ - @Override - public PageRef caseTabFolder(TabFolder object) { - for (PageRef pageRef : object.getChildren()) { - - if (pageRef.isForIdentifier(pageIdentifier)) { - return pageRef; - } - } - - return super.caseTabFolder(object); - } - - }; - - // Do lookup - PageRef res = visitor.doSwitch(this); - - return res; - } - - /** - * - * - * TODO Add method to metamodel - * - * @generated NOT - */ - @Override - public TabFolder lookupFirstFolder() { - - // Create appropriate visitor. - DiSwitch visitor = new DiSwitch() { - - /** - * Iterate over windows - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashModel(org.eclipse.papyrus.infra.core.sashwindows.di.SashModel) - * - * @param object - * @return - */ - @Override - public TabFolder caseSashModel(SashModel object) { - TabFolder res = null; - for (Window window : object.getWindows()) { - res = this.doSwitch(window); - if (res != null) { - return res; - } - } - - return super.caseSashModel(object); - } - - /** - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window) - * - * @param object - * @return - */ - @Override - public TabFolder caseWindow(Window window) { - - AbstractPanel panel = window.getPanel(); - if (panel == null) { - return null; - } - - - TabFolder res = this.doSwitch(panel); - if (res != null) { - return res; - } - - return super.caseWindow(window); - } - - /** - * Iterate over children - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashPanel(org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel) - * - * @param object - * @return - */ - @Override - public TabFolder caseSashPanel(SashPanel object) { - TabFolder res = null; - for (AbstractPanel panel : object.getChildren()) { - res = this.doSwitch(panel); - if (res != null) { - return res; - } - } - - return super.caseSashPanel(object); - } - - /** - * Iterate over PageRef - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseTabFolder(org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder) - * - * @param object - * @return - */ - @Override - public TabFolder caseTabFolder(TabFolder object) { - return object; - } - - }; - - // Do lookup - TabFolder res = visitor.doSwitch(this); - - return res; - } - - /** - * - * - * TODO Add method to metamodel - * - * @generated NOT - */ - @Override - public Window lookupFirstWindow() { - - List list = getWindows(); - if (list.size() == 0) { - return null; - } - - return list.get(0); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder, int targetIndex) { - - - // Check if we move all pages of srcFolder - if (srcIndex == -1) { - // move all - List srcChildrens = srcParentFolder.getChildren(); - List targetChildrens = targetParentFolder.getChildren(); - // while(srcChildrens.size() > 0) { - // PageRef pageRef = srcChildrens.remove(0); - // targetChildrens.add(pageRef); - // } - - if (targetIndex < 0 || targetIndex >= targetChildrens.size()) { - // Index is out of bounds. Move at the end. - targetChildrens.addAll(srcChildrens); - } else { - // index is in bounds. Move at index. - targetChildrens.addAll(targetIndex, srcChildrens); - } - return; - } - - // Move only one - PageRef pageRef = srcParentFolder.getChildren().remove(srcIndex); - - List targetChildrens = targetParentFolder.getChildren(); - // Check if out of target range. - if (targetIndex < 0 || targetIndex > targetChildrens.size()) { - targetChildrens.add(pageRef); - } else { - targetChildrens.add(targetIndex, pageRef); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void insertFolder(TabFolder folderToInsert, TabFolder refFolder, int side) { - - // Get the parent under which the sash will be inserted - PanelParent refParent = refFolder.getParent(); - - SashPanel newSash; - int direction; - - // Compute sash direction - if (side == SWT.LEFT || side == SWT.RIGHT) { - direction = SWT.HORIZONTAL; - } else { - direction = SWT.VERTICAL; - } - // Create sash - newSash = DiFactory.eINSTANCE.createSashPanel(); - // Insert in parent. Should be done before setting childrens, otherwise, the child can't be - // replaced as it will not belong to parent anymore. - refParent.replaceChild(refFolder, newSash); - - if (side == SWT.LEFT || side == SWT.UP) { // insert left - newSash.setChildren(folderToInsert, refFolder, direction); - } else { - newSash.setChildren(refFolder, folderToInsert, direction); - } - - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder) { - - // Check if we move all pages of srcFolder - if (srcIndex == -1) { - // move all - List srcChildrens = srcParentFolder.getChildren(); - List targetChildrens = targetParentFolder.getChildren(); - while (srcChildrens.size() > 0) { - PageRef pageRef = srcChildrens.remove(0); - targetChildrens.add(pageRef); - } - return; - } - - // Move only one page - PageRef pageRef = srcParentFolder.getChildren().remove(srcIndex); - List targetChildrens = targetParentFolder.getChildren(); - // Check if out of target range. - targetChildrens.add(pageRef); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removeEmptyFolder(TabFolder folder) { - - EList children = folder.getChildren(); - - // Check if empty - if (children.size() > 0) { - return; - } - - PanelParent parent = folder.getParent(); - // Forbid removing of the last folder - if (parent instanceof Window) { - return; - } - - // Parent is a sash. Ask it to remove the child and itself - ((SashPanel) parent).delete(folder); - // adjust current selection if the old folder was the currentSelection - if (getCurrentSelection() == folder) { - setCurrentSelectionSilently(lookupFirstFolder()); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removeAllPages() { - Collection pagesToRemove = getAllPages(); - int originalCount = pagesToRemove.size(); - pagesToRemove = PageRemovalValidator.getInstance(this).filterRemovablePages(pagesToRemove); - - if (pagesToRemove.size() < originalCount) { - // Do it the hard way - pagesToRemove.forEach(this::removeAndEmptyFolder); - } else { - // Get a the first window and a folder. - // Clear the folder and set it as the root folder. - // This disguard all other folder and pages ... - Window firstWindow = lookupFirstWindow(); - TabFolder folder = lookupFirstFolder(); - - folder.getChildren().clear(); - firstWindow.setPanel(folder); - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removeOtherPages(Object pageIdentifier) { - PageRef page = lookupPage(pageIdentifier); - - Collection pagesToRemove = getAllPages(); - pagesToRemove.remove(page); - int originalCount = pagesToRemove.size(); - pagesToRemove = PageRemovalValidator.getInstance(this).filterRemovablePages(pagesToRemove); - - if (pagesToRemove.size() < originalCount) { - // Do it the hard way - pagesToRemove.forEach(this::removeAndEmptyFolder); - } else { - // Get a the first window and a folder. - // Clear the folder and set it as the root folder. - // This disguard all other folder and pages ... - Window firstWindow = lookupFirstWindow(); - TabFolder folder = lookupFirstFolder(); - - folder.getChildren().clear(); - if (page != null) { - folder.getChildren().add(page); - } - firstWindow.setPanel(folder); - } - } - - private Collection getAllPages() { - Collection result = new ArrayList<>(); - - eAllContents().forEachRemaining(next -> { - if (next instanceof PageRef) { - result.add((PageRef) next); - } - }); - - return result; - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.SASH_MODEL__WINDOWS: - return ((InternalEList) getWindows()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.SASH_MODEL__WINDOWS: - return getWindows(); - case DiPackage.SASH_MODEL__CURRENT_SELECTION: - if (resolve) { - return getCurrentSelection(); - } - return basicGetCurrentSelection(); - case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: - return isRestoreActivePage(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.SASH_MODEL__WINDOWS: - getWindows().clear(); - getWindows().addAll((Collection) newValue); - return; - case DiPackage.SASH_MODEL__CURRENT_SELECTION: - setCurrentSelection((TabFolder) newValue); - return; - case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: - setRestoreActivePage((Boolean) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.SASH_MODEL__WINDOWS: - getWindows().clear(); - return; - case DiPackage.SASH_MODEL__CURRENT_SELECTION: - setCurrentSelection((TabFolder) null); - return; - case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: - setRestoreActivePage(RESTORE_ACTIVE_PAGE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.SASH_MODEL__WINDOWS: - return windows != null && !windows.isEmpty(); - case DiPackage.SASH_MODEL__CURRENT_SELECTION: - return currentSelection != null; - case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: - return restoreActivePage != RESTORE_ACTIVE_PAGE_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (restoreActivePage: "); - result.append(restoreActivePage); - result.append(')'); - return result.toString(); - } - -} // SashModelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java deleted file mode 100644 index 50e1037fd6e..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java +++ /dev/null @@ -1,419 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; - -/** - * - * An implementation of the model object 'Sash Panel'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getChildren Children}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getSashPosition Sash Position}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getDirection Direction}
  • - *
- * - * @generated - */ -public class SashPanelImpl extends AbstractPanelImpl implements SashPanel { - - /** - * The cached value of the '{@link #getChildren() Children}' containment reference list. - * - * - * - * @see #getChildren() - * @generated - * @ordered - */ - protected EList children; - - /** - * The default value of the '{@link #getSashPosition() Sash Position}' attribute. - * - * - * - * @see #getSashPosition() - * @generated - * @ordered - */ - protected static final float SASH_POSITION_EDEFAULT = 0.0F; - - /** - * The cached value of the '{@link #getSashPosition() Sash Position}' attribute. - * - * - * - * @see #getSashPosition() - * @generated - * @ordered - */ - protected float sashPosition = SASH_POSITION_EDEFAULT; - - /** - * The default value of the '{@link #getDirection() Direction}' attribute. - * - * - * - * @see #getDirection() - * @generated - * @ordered - */ - protected static final int DIRECTION_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getDirection() Direction}' attribute. - * - * - * - * @see #getDirection() - * @generated - * @ordered - */ - protected int direction = DIRECTION_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected SashPanelImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.SASH_PANEL; - } - - /** - * - * - * - * @generated - */ - @Override - public EList getChildren() { - if (children == null) { - children = new EObjectContainmentWithInverseEList(AbstractPanel.class, this, DiPackage.SASH_PANEL__CHILDREN, DiPackage.ABSTRACT_PANEL__PARENT); - } - return children; - } - - /** - * - * - * - * @generated - */ - @Override - public float getSashPosition() { - return sashPosition; - } - - /** - * - * - * - * @generated - */ - @Override - public void setSashPosition(float newSashPosition) { - float oldSashPosition = sashPosition; - sashPosition = newSashPosition; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_PANEL__SASH_POSITION, oldSashPosition, sashPosition)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public int getDirection() { - return direction; - } - - /** - * - * - * - * @generated - */ - @Override - public void setDirection(int newDirection) { - int oldDirection = direction; - direction = newDirection; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_PANEL__DIRECTION, oldDirection, direction)); - } - } - - /** - * - * - * - * - * @generated NOT - */ - @Override - public void setChildren(AbstractPanel leftChild, AbstractPanel rightChild, int direction) { - setDirection(direction); - List children = getChildren(); - - if (children.size() == 0) { - children.add(leftChild); - children.add(rightChild); - - } else { - children.set(0, leftChild); - children.set(1, rightChild); - } - - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void delete(AbstractPanel childToDelete) { - // Get the other child - EList children = getChildren(); - AbstractPanel otherChild = (childToDelete == children.get(0) ? children.get(1) : children.get(0)); - - PanelParent parent = getParent(); - // Change parent - // otherChild.setParent( parent ); - parent.replaceChild(this, otherChild); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - return getChildren(); - case DiPackage.SASH_PANEL__SASH_POSITION: - return getSashPosition(); - case DiPackage.SASH_PANEL__DIRECTION: - return getDirection(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection) newValue); - return; - case DiPackage.SASH_PANEL__SASH_POSITION: - setSashPosition((Float) newValue); - return; - case DiPackage.SASH_PANEL__DIRECTION: - setDirection((Integer) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - getChildren().clear(); - return; - case DiPackage.SASH_PANEL__SASH_POSITION: - setSashPosition(SASH_POSITION_EDEFAULT); - return; - case DiPackage.SASH_PANEL__DIRECTION: - setDirection(DIRECTION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.SASH_PANEL__CHILDREN: - return children != null && !children.isEmpty(); - case DiPackage.SASH_PANEL__SASH_POSITION: - return sashPosition != SASH_POSITION_EDEFAULT; - case DiPackage.SASH_PANEL__DIRECTION: - return direction != DIRECTION_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { - if (baseClass == PanelParent.class) { - switch (derivedFeatureID) { - case DiPackage.SASH_PANEL__CHILDREN: - return DiPackage.PANEL_PARENT__CHILDREN; - default: - return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * - * - * - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { - if (baseClass == PanelParent.class) { - switch (baseFeatureID) { - case DiPackage.PANEL_PARENT__CHILDREN: - return DiPackage.SASH_PANEL__CHILDREN; - default: - return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (sashPosition: "); - result.append(sashPosition); - result.append(", direction: "); - result.append(direction); - result.append(')'); - return result.toString(); - } - - /** - * - * Set both ends (parent and child). - * - * - * @generated NOT - */ - @Override - public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { - - int index = getChildren().indexOf(oldChild); - if (index >= 0) { - // do replace - getChildren().set(index, newChild); - newChild.setParent(this); - } else { - throw new IndexOutOfBoundsException("Child '" + oldChild + "' not found in sash. Can't replace it."); - } - } - -} // SashPanelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java deleted file mode 100644 index 5662ffda7f5..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java +++ /dev/null @@ -1,280 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; - -/** - * - * An implementation of the model object 'Sash Windows Mngr'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl#getPageList Page List}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl#getSashModel Sash Model}
  • - *
- * - * @generated - */ -public class SashWindowsMngrImpl extends EObjectImpl implements SashWindowsMngr { - - /** - * The cached value of the '{@link #getPageList() Page List}' containment reference. - * - * - * - * @see #getPageList() - * @generated - * @ordered - */ - protected PageList pageList; - - /** - * The cached value of the '{@link #getSashModel() Sash Model}' containment reference. - * - * - * - * @see #getSashModel() - * @generated - * @ordered - */ - protected SashModel sashModel; - - /** - * - * - * - * @generated - */ - protected SashWindowsMngrImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.SASH_WINDOWS_MNGR; - } - - /** - * - * - * - * @generated - */ - @Override - public PageList getPageList() { - return pageList; - } - - /** - * - * - * - * @generated - */ - public NotificationChain basicSetPageList(PageList newPageList, NotificationChain msgs) { - PageList oldPageList = pageList; - pageList = newPageList; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, oldPageList, newPageList); - if (msgs == null) { - msgs = notification; - } else { - msgs.add(notification); - } - } - return msgs; - } - - /** - * - * - * - * @generated - */ - @Override - public void setPageList(PageList newPageList) { - if (newPageList != pageList) { - NotificationChain msgs = null; - if (pageList != null) { - msgs = ((InternalEObject) pageList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, null, msgs); - } - if (newPageList != null) { - msgs = ((InternalEObject) newPageList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, null, msgs); - } - msgs = basicSetPageList(newPageList, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, newPageList, newPageList)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public SashModel getSashModel() { - return sashModel; - } - - /** - * - * - * - * @generated - */ - public NotificationChain basicSetSashModel(SashModel newSashModel, NotificationChain msgs) { - SashModel oldSashModel = sashModel; - sashModel = newSashModel; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, oldSashModel, newSashModel); - if (msgs == null) { - msgs = notification; - } else { - msgs.add(notification); - } - } - return msgs; - } - - /** - * - * - * - * @generated - */ - @Override - public void setSashModel(SashModel newSashModel) { - if (newSashModel != sashModel) { - NotificationChain msgs = null; - if (sashModel != null) { - msgs = ((InternalEObject) sashModel).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, null, msgs); - } - if (newSashModel != null) { - msgs = ((InternalEObject) newSashModel).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, null, msgs); - } - msgs = basicSetSashModel(newSashModel, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, newSashModel, newSashModel)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: - return basicSetPageList(null, msgs); - case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: - return basicSetSashModel(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: - return getPageList(); - case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: - return getSashModel(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: - setPageList((PageList) newValue); - return; - case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: - setSashModel((SashModel) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: - setPageList((PageList) null); - return; - case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: - setSashModel((SashModel) null); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: - return pageList != null; - case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: - return sashModel != null; - } - return super.eIsSet(featureID); - } - -} // SashWindowsMngrImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java deleted file mode 100644 index f916681a88c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; - -/** - * - * An implementation of the model object 'Size'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl#getWidth Width}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl#getLength Length}
  • - *
- * - * @generated - */ -public class SizeImpl extends EObjectImpl implements Size { - - /** - * The default value of the '{@link #getWidth() Width}' attribute. - * - * - * - * @see #getWidth() - * @generated - * @ordered - */ - protected static final int WIDTH_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getWidth() Width}' attribute. - * - * - * - * @see #getWidth() - * @generated - * @ordered - */ - protected int width = WIDTH_EDEFAULT; - - /** - * The default value of the '{@link #getLength() Length}' attribute. - * - * - * - * @see #getLength() - * @generated - * @ordered - */ - protected static final int LENGTH_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getLength() Length}' attribute. - * - * - * - * @see #getLength() - * @generated - * @ordered - */ - protected int length = LENGTH_EDEFAULT; - - /** - * - * - * - * @generated - */ - protected SizeImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.SIZE; - } - - /** - * - * - * - * @generated - */ - @Override - public int getWidth() { - return width; - } - - /** - * - * - * - * @generated - */ - @Override - public void setWidth(int newWidth) { - int oldWidth = width; - width = newWidth; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SIZE__WIDTH, oldWidth, width)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public int getLength() { - return length; - } - - /** - * - * - * - * @generated - */ - @Override - public void setLength(int newLength) { - int oldLength = length; - length = newLength; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SIZE__LENGTH, oldLength, length)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.SIZE__WIDTH: - return getWidth(); - case DiPackage.SIZE__LENGTH: - return getLength(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.SIZE__WIDTH: - setWidth((Integer) newValue); - return; - case DiPackage.SIZE__LENGTH: - setLength((Integer) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.SIZE__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case DiPackage.SIZE__LENGTH: - setLength(LENGTH_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.SIZE__WIDTH: - return width != WIDTH_EDEFAULT; - case DiPackage.SIZE__LENGTH: - return length != LENGTH_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (width: "); - result.append(width); - result.append(", length: "); - result.append(length); - result.append(')'); - return result.toString(); - } - -} // SizeImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java deleted file mode 100644 index f7ee51e8a5f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.uml2.common.util.SubsetSupersetEObjectContainmentWithInverseEList; - -/** - * - * An implementation of the model object 'Tab Folder'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl#getChildren Children}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl#getCurrentSelection Current Selection}
  • - *
- * - * @generated - */ -public class TabFolderImpl extends AbstractPanelImpl implements TabFolder { - - /** - * The cached value of the '{@link #getChildren() Children}' containment reference list. - * - * - * - * @see #getChildren() - * @generated - * @ordered - */ - protected EList children; - - /** - * The cached value of the '{@link #getCurrentSelection() Current Selection}' reference. - * - * - * - * @see #getCurrentSelection() - * @generated - * @ordered - */ - protected PageRef currentSelection; - - /** - * - * - * - * @generated - */ - protected TabFolderImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.TAB_FOLDER; - } - - /** - * - * - * - * @generated - */ - @Override - public EList getChildren() { - if (children == null) { - children = new SubsetSupersetEObjectContainmentWithInverseEList(PageRef.class, this, DiPackage.TAB_FOLDER__CHILDREN, null, CHILDREN_ESUBSETS, DiPackage.PAGE_REF__PARENT); - } - return children; - } - - /** - * The array of subset feature identifiers for the '{@link #getChildren() Children}' containment reference list. - * - * - * - * @see #getChildren() - * @generated - * @ordered - */ - protected static final int[] CHILDREN_ESUBSETS = new int[] { DiPackage.TAB_FOLDER__CURRENT_SELECTION }; - - /** - * - * - * - * @generated - */ - @Override - public PageRef getCurrentSelection() { - if (currentSelection != null && currentSelection.eIsProxy()) { - InternalEObject oldCurrentSelection = (InternalEObject) currentSelection; - currentSelection = (PageRef) eResolveProxy(oldCurrentSelection); - if (currentSelection != oldCurrentSelection) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.TAB_FOLDER__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); - } - } - } - return currentSelection; - } - - /** - * - * - * - * @generated - */ - public PageRef basicGetCurrentSelection() { - return currentSelection; - } - - /** - * - * - * - * @generated - */ - @Override - public void setCurrentSelection(PageRef newCurrentSelection) { - PageRef oldCurrentSelection = currentSelection; - currentSelection = newCurrentSelection; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.TAB_FOLDER__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); - } - Resource.Internal eInternalResource = eInternalResource(); - if (eInternalResource == null || !eInternalResource.isLoading()) { - if (newCurrentSelection != null) { - EList children = getChildren(); - if (!children.contains(newCurrentSelection)) { - children.add(newCurrentSelection); - } - } - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(Object pageIdentifier) { - PageRef newPage = DiFactory.eINSTANCE.createPageRef(); - newPage.setPageIdentifier(pageIdentifier); - getChildren().add(newPage); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(int index, Object pageIdentifier) { - PageRef newPage = DiFactory.eINSTANCE.createPageRef(); - newPage.setPageIdentifier(pageIdentifier); - getChildren().add(index, newPage); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void addPage(PageRef pageRef) { - getChildren().add(pageRef); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void removePage(int pageIndex) { - getChildren().remove(pageIndex); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - return getChildren(); - case DiPackage.TAB_FOLDER__CURRENT_SELECTION: - if (resolve) { - return getCurrentSelection(); - } - return basicGetCurrentSelection(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection) newValue); - return; - case DiPackage.TAB_FOLDER__CURRENT_SELECTION: - setCurrentSelection((PageRef) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - getChildren().clear(); - return; - case DiPackage.TAB_FOLDER__CURRENT_SELECTION: - setCurrentSelection((PageRef) null); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.TAB_FOLDER__CHILDREN: - return children != null && !children.isEmpty(); - case DiPackage.TAB_FOLDER__CURRENT_SELECTION: - return currentSelection != null; - } - return super.eIsSet(featureID); - } - - /** - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#movePage(int, int) - * - * @param oldIndex - * @param newIndex - * @generated NOT - */ - @Override - public void movePage(int oldIndex, int newIndex) { - int listSize = getChildren().size(); - if (newIndex >= listSize) { - newIndex = listSize - 1; - } - if (newIndex < 0) { - newIndex = 0; - } - - if (oldIndex == newIndex) { - return; - } - - if (listSize == 0) { - return; - } - - - getChildren().move(newIndex, oldIndex); - } - -} // TabFolderImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java deleted file mode 100644 index 67dd0027ffc..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java +++ /dev/null @@ -1,316 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; - -/** - * - * An implementation of the model object 'Window'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getPosition Position}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getSize Size}
  • - *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getPanel Panel}
  • - *
- * - * @generated - */ -public class WindowImpl extends PanelParentImpl implements Window { - - /** - * The cached value of the '{@link #getPosition() Position}' reference. - * - * - * - * @see #getPosition() - * @generated - * @ordered - */ - protected Position position; - - /** - * The cached value of the '{@link #getSize() Size}' reference. - * - * - * - * @see #getSize() - * @generated - * @ordered - */ - protected Size size; - - /** - * - * - * - * @generated - */ - protected WindowImpl() { - super(); - } - - /** - * - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return DiPackage.Literals.WINDOW; - } - - /** - * - * - * - * @generated - */ - @Override - public Position getPosition() { - if (position != null && position.eIsProxy()) { - InternalEObject oldPosition = (InternalEObject) position; - position = (Position) eResolveProxy(oldPosition); - if (position != oldPosition) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.WINDOW__POSITION, oldPosition, position)); - } - } - } - return position; - } - - /** - * - * - * - * @generated - */ - public Position basicGetPosition() { - return position; - } - - /** - * - * - * - * @generated - */ - @Override - public void setPosition(Position newPosition) { - Position oldPosition = position; - position = newPosition; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.WINDOW__POSITION, oldPosition, position)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Size getSize() { - if (size != null && size.eIsProxy()) { - InternalEObject oldSize = (InternalEObject) size; - size = (Size) eResolveProxy(oldSize); - if (size != oldSize) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.WINDOW__SIZE, oldSize, size)); - } - } - } - return size; - } - - /** - * - * - * - * @generated - */ - public Size basicGetSize() { - return size; - } - - /** - * - * - * - * @generated - */ - @Override - public void setSize(Size newSize) { - Size oldSize = size; - size = newSize; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.WINDOW__SIZE, oldSize, size)); - } - } - - /** - * - * - * - * @generated - */ - @Override - public AbstractPanel getPanel() { - AbstractPanel panel = basicGetPanel(); - return panel != null && panel.eIsProxy() ? (AbstractPanel) eResolveProxy((InternalEObject) panel) : panel; - } - - /** - * - * - * - * @generated NOT - */ - public AbstractPanel basicGetPanel() { - EList list = getChildren(); - if (list.size() > 0) { - return list.get(0); - } else { - return null; - } - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void setPanel(AbstractPanel newPanel) { - EList list = getChildren(); - if (list.size() > 0) { - list.set(0, newPanel); - } else { - list.add(newPanel); - } - } - - /** - * - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case DiPackage.WINDOW__POSITION: - if (resolve) { - return getPosition(); - } - return basicGetPosition(); - case DiPackage.WINDOW__SIZE: - if (resolve) { - return getSize(); - } - return basicGetSize(); - case DiPackage.WINDOW__PANEL: - if (resolve) { - return getPanel(); - } - return basicGetPanel(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case DiPackage.WINDOW__POSITION: - setPosition((Position) newValue); - return; - case DiPackage.WINDOW__SIZE: - setSize((Size) newValue); - return; - case DiPackage.WINDOW__PANEL: - setPanel((AbstractPanel) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case DiPackage.WINDOW__POSITION: - setPosition((Position) null); - return; - case DiPackage.WINDOW__SIZE: - setSize((Size) null); - return; - case DiPackage.WINDOW__PANEL: - setPanel((AbstractPanel) null); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case DiPackage.WINDOW__POSITION: - return position != null; - case DiPackage.WINDOW__SIZE: - return size != null; - case DiPackage.WINDOW__PANEL: - return basicGetPanel() != null; - } - return super.eIsSet(featureID); - } - - /** - * - * - * - * @generated NOT - */ - @Override - public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { - setPanel(newChild); - } - - -} // WindowImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java deleted file mode 100644 index bda023bb7b0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import java.util.Collection; - -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; - -/** - * A composition of two or more {@link PageRemovalValidator}s. - */ -class CompositePageRemovalValidator implements PageRemovalValidator { - - private final PageRemovalValidator one; - private final PageRemovalValidator two; - - CompositePageRemovalValidator(PageRemovalValidator one, PageRemovalValidator two) { - super(); - - this.one = one; - this.two = two; - } - - @Override - public boolean canRemovePage(PageRef page) { - return one.canRemovePage(page) && two.canRemovePage(page); - } - - @Override - public Collection filterRemovablePages(Collection pages) { - return two.filterRemovablePages(one.filterRemovablePages(pages)); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java deleted file mode 100644 index 3b8b07f0bb3..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java +++ /dev/null @@ -1,363 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; - -/** - * - * The Adapter Factory for the model. - * It provides an adapter createXXX method for each class of the model. - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage - * @generated - */ -public class DiAdapterFactory extends AdapterFactoryImpl { - - /** - * The cached model package. - * - * - * - * @generated - */ - protected static DiPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * - * - * - * @generated - */ - public DiAdapterFactory() { - if (modelPackage == null) { - modelPackage = DiPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * - * This implementation returns true if the object is either the model's package or is an instance object of the model. - * - * - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject) object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the createXXX methods. - * - * - * - * @generated - */ - protected DiSwitch modelSwitch = new DiSwitch() { - @Override - public Adapter caseSashModel(SashModel object) { - return createSashModelAdapter(); - } - - @Override - public Adapter caseWindow(Window object) { - return createWindowAdapter(); - } - - @Override - public Adapter casePanelParent(PanelParent object) { - return createPanelParentAdapter(); - } - - @Override - public Adapter caseAbstractPanel(AbstractPanel object) { - return createAbstractPanelAdapter(); - } - - @Override - public Adapter casePosition(Position object) { - return createPositionAdapter(); - } - - @Override - public Adapter caseSize(Size object) { - return createSizeAdapter(); - } - - @Override - public Adapter caseTabFolder(TabFolder object) { - return createTabFolderAdapter(); - } - - @Override - public Adapter casePageRef(PageRef object) { - return createPageRefAdapter(); - } - - @Override - public Adapter caseSashPanel(SashPanel object) { - return createSashPanelAdapter(); - } - - @Override - public Adapter caseAbstractPage(AbstractPage object) { - return createAbstractPageAdapter(); - } - - @Override - public Adapter casePageList(PageList object) { - return createPageListAdapter(); - } - - @Override - public Adapter caseSashWindowsMngr(SashWindowsMngr object) { - return createSashWindowsMngrAdapter(); - } - - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the target. - * - * - * - * @param target - * the object to adapt. - * @return the adapter for the target. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject) target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel Sash Model}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel - * @generated - */ - public Adapter createSashModelAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window Window}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window - * @generated - */ - public Adapter createWindowAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent Panel Parent}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent - * @generated - */ - public Adapter createPanelParentAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel Abstract Panel}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel - * @generated - */ - public Adapter createAbstractPanelAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position Position}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position - * @generated - */ - public Adapter createPositionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size Size}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size - * @generated - */ - public Adapter createSizeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder Tab Folder}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder - * @generated - */ - public Adapter createTabFolderAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef Page Ref}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef - * @generated - */ - public Adapter createPageRefAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel Sash Panel}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel - * @generated - */ - public Adapter createSashPanelAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage Abstract Page}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage - * @generated - */ - public Adapter createAbstractPageAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList Page List}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList - * @generated - */ - public Adapter createPageListAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr Sash Windows Mngr}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * - * @return the new adapter. - * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr - * @generated - */ - public Adapter createSashWindowsMngrAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * - * This default implementation returns null. - * - * - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} // DiAdapterFactory diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java deleted file mode 100644 index a8375cd7e1c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * - * The Resource Factory associated with the package. - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiResourceImpl - * @generated - */ -public class DiResourceFactoryImpl extends ResourceFactoryImpl { - /** - * Creates an instance of the resource factory. - * - * - * - * @generated - */ - public DiResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * - * - * - * @generated - */ - @Override - public Resource createResource(URI uri) { - XMLResource result = new DiResourceImpl(uri); - return result; - } - -} // DiResourceFactoryImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java deleted file mode 100644 index 51737b0f9e3..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; - -/** - * - * The Resource associated with the package. - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiResourceFactoryImpl - * @generated - */ -public class DiResourceImpl extends XMIResourceImpl { - /** - * Creates an instance of the resource. - * - * - * - * @param uri - * the URI of the new resource. - * @generated - */ - public DiResourceImpl(URI uri) { - super(uri); - } - -} // DiResourceImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java deleted file mode 100644 index 2c1ff1c3213..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java +++ /dev/null @@ -1,424 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.util.Switch; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; -import org.eclipse.papyrus.infra.core.sashwindows.di.Position; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.Size; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; - -/** - * - * The Switch for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the caseXXX method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * - * - * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage - * @generated - */ -public class DiSwitch extends Switch { - - /** - * The cached model package - * - * - * - * @generated - */ - protected static DiPackage modelPackage; - - /** - * Creates an instance of the switch. - * - * - * - * @generated - */ - public DiSwitch() { - if (modelPackage == null) { - modelPackage = DiPackage.eINSTANCE; - } - } - - /** - * Checks whether this is a switch for the given package. - * - * - * - * @param ePackage - * the package in question. - * @return whether this is a switch for the given package. - * @generated - */ - @Override - protected boolean isSwitchFor(EPackage ePackage) { - return ePackage == modelPackage; - } - - /** - * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. - * - * - * - * @return the first non-null result returned by a caseXXX call. - * @generated - */ - @Override - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case DiPackage.SASH_MODEL: { - SashModel sashModel = (SashModel) theEObject; - T result = caseSashModel(sashModel); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.WINDOW: { - Window window = (Window) theEObject; - T result = caseWindow(window); - if (result == null) { - result = casePanelParent(window); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.PANEL_PARENT: { - PanelParent panelParent = (PanelParent) theEObject; - T result = casePanelParent(panelParent); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.ABSTRACT_PANEL: { - AbstractPanel abstractPanel = (AbstractPanel) theEObject; - T result = caseAbstractPanel(abstractPanel); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.POSITION: { - Position position = (Position) theEObject; - T result = casePosition(position); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.SIZE: { - Size size = (Size) theEObject; - T result = caseSize(size); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.TAB_FOLDER: { - TabFolder tabFolder = (TabFolder) theEObject; - T result = caseTabFolder(tabFolder); - if (result == null) { - result = caseAbstractPanel(tabFolder); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.PAGE_REF: { - PageRef pageRef = (PageRef) theEObject; - T result = casePageRef(pageRef); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.SASH_PANEL: { - SashPanel sashPanel = (SashPanel) theEObject; - T result = caseSashPanel(sashPanel); - if (result == null) { - result = caseAbstractPanel(sashPanel); - } - if (result == null) { - result = casePanelParent(sashPanel); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.ABSTRACT_PAGE: { - AbstractPage abstractPage = (AbstractPage) theEObject; - T result = caseAbstractPage(abstractPage); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.PAGE_LIST: { - PageList pageList = (PageList) theEObject; - T result = casePageList(pageList); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case DiPackage.SASH_WINDOWS_MNGR: { - SashWindowsMngr sashWindowsMngr = (SashWindowsMngr) theEObject; - T result = caseSashWindowsMngr(sashWindowsMngr); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - default: - return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of 'Sash Model'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Sash Model'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSashModel(SashModel object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Window'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Window'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseWindow(Window object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Panel Parent'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Panel Parent'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T casePanelParent(PanelParent object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Abstract Panel'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Abstract Panel'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAbstractPanel(AbstractPanel object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Position'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Position'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T casePosition(Position object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Size'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Size'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSize(Size object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Tab Folder'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Tab Folder'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTabFolder(TabFolder object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Page Ref'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Page Ref'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T casePageRef(PageRef object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Sash Panel'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Sash Panel'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSashPanel(SashPanel object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Abstract Page'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Abstract Page'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAbstractPage(AbstractPage object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Page List'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Page List'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T casePageList(PageList object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Sash Windows Mngr'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'Sash Windows Mngr'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSashWindowsMngr(SashWindowsMngr object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'EObject'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of 'EObject'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - @Override - public T defaultCase(EObject object) { - return null; - } - -} // DiSwitch diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java deleted file mode 100644 index 3d165182e00..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java +++ /dev/null @@ -1,206 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 CEA LIST & LIFL - * - * - * 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Emilien Perico emilien.perico@atosorigin.com - add methods to manage di resource - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.Window; -import org.eclipse.papyrus.infra.core.sashwindows.di.exception.SashEditorException; - - -/** - * Set of utility methods - * - * @author dumoulin - */ -public class DiUtils { - - /** - * Create a default SashModel with one window and one folder. - * Set the current folder. - * - * @param diResource - * @return - */ - static public SashModel createDefaultSashModel() { - - // SashModel - SashModel sashModel = DiFactory.eINSTANCE.createSashModel(); - Window window = DiFactory.eINSTANCE.createWindow(); - sashModel.getWindows().add(window); - - TabFolder folder = DiFactory.eINSTANCE.createTabFolder(); - window.setPanel(folder); - // Default folder - sashModel.setCurrentSelectionSilently(folder); - - return sashModel; - } - - /** - * Create a default SashWindowsMngr with one PageLit and one default SashModel. - * Set the current folder. - * - * @param diResource - * @return - */ - static public SashWindowsMngr createDefaultSashWindowsMngr() { - SashWindowsMngr model; - - model = DiFactory.eINSTANCE.createSashWindowsMngr(); - - // SashModel - SashModel layout = createDefaultSashModel(); - - model.setSashModel(layout); - return model; - } - - /** - * Lookup for the SashModel object in the resource. - * - * @param diResource - * @return The {@link DiSashModel} or null if not found. - */ - static public SashWindowsMngr lookupSashWindowsMngr(Resource diResource) { - - for (Object node : diResource.getContents()) { - if (node instanceof SashWindowsMngr) { - return (SashWindowsMngr) node; - } - } - return null; - } - - /** - * Lookup for the current selection TabFolder object in the resource. - * - * @param diResource - * @return The {@link TabFolder} or null if not found. - */ - static public TabFolder lookupCurrentTabFolderSelection(Resource diResource) { - SashWindowsMngr lookupSashWindowsMngr = lookupSashWindowsMngr(diResource); - if (lookupSashWindowsMngr != null) { - SashModel sashModel = lookupSashWindowsMngr.getSashModel(); - if (sashModel != null) { - return sashModel.getCurrentSelection(); - } - } - return null; - } - - /** - * Gets the page reference of the specified eObject - * - * @param diResource - * @param eObject - * - * @return the page ref of eObject, null if not found - * TODO This method use too low level mechanism for its implementation. Consider to move it in a - * more appropriate class. Furthermore, some similar methods already exist. Can't we use them - * instead ? - * - * @deprecated Should use IPageMngr instead. - */ - @Deprecated - static public PageRef getPageRef(Resource diResource, EObject eObject) { - SashWindowsMngr windowsMngr = lookupSashWindowsMngr(diResource); - if (windowsMngr != null && windowsMngr.getPageList() != null) { - - for (PageRef pageRef : windowsMngr.getPageList().getAvailablePage()) { - - EObject emfPageIdentifier = pageRef.getEmfPageIdentifier(); - if (eObject != null && eObject.equals(emfPageIdentifier)) { - return pageRef; - } - } - } - return null; - } - - /** - * Adds page to the page list of the sash windows manager - * - * @param diResource - * @param pageRef - * @throws SashEditorException - * TODO This method use too low level mechanism for its implementation. Consider to move it in a - * more appropriate class. Furthermore, some similar methods already exist. Can't we use them - * instead ? - * @deprecated Should use IPageMngr instead. - */ - @Deprecated - static public void addPageToPageList(Resource diResource, PageRef pageRef) throws SashEditorException { - // Do nothing. The page list is not used anymore - } - - /** - * Adds page to the page list of the sash windows manager. - * - * @param pageRef - * @param windowsMngr - * @throws SashEditorException - * TODO This method use too low level mechanism for its implementation. Consider to move it in a - * more appropriate class. Furthermore, some similar methods already exist. Can't we use them - * instead ? - * - * @deprecated Should use IPageMngr instead. - */ - @Deprecated - static public void addPageToPageList(SashWindowsMngr windowsMngr, PageRef pageRef) throws SashEditorException { - // Do nothing. The page list is not used anymore - } - - /** - * Adds page to tab folder. - * - * @param windowsMngr - * @param pageRef - * @throws SashEditorException - * TODO This method use too low level mechanism for its implementation. Consider to move it in a - * more appropriate class. Furthermore, some similar methods already exist. Can't we use them - * instead ? - * - * @deprecated Should use IPageMngr instead. - */ - @Deprecated - static public void addPageToTabFolder(SashWindowsMngr windowsMngr, PageRef pageRef) throws SashEditorException { - - // Check parameters - if (pageRef == null || pageRef.getPageIdentifier() == null) { - throw new SashEditorException("Unable to add the page to the tab folder: parameters are null"); - } - - SashModel sashModel = windowsMngr.getSashModel(); - if (sashModel == null) { - throw new SashEditorException("Unable to add the page to the tab folder: can't find SashModel"); - } - - // Get the currently active folder in order to add the page. - TabFolder tabFolder = sashModel.getCurrentSelection(); - if (tabFolder == null) { - throw new SashEditorException("Unable to add the page to the tab folder: No active folder"); - } - - tabFolder.addPage(pageRef.getPageIdentifier()); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java deleted file mode 100644 index 13746ad2f59..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sashwindows.di.util; - -import java.util.Collection; -import java.util.stream.Collectors; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; - -/** - * A protocol for an adapter that can be attached to the Sash model to validate - * the closing of pages. - */ -@FunctionalInterface -public interface PageRemovalValidator { - /** A validator that always permits removing the page. */ - PageRemovalValidator ALWAYS_REMOVE = new PageRemovalValidator() { - - @Override - public boolean canRemovePage(PageRef page) { - return true; - } - - @Override - public Collection filterRemovablePages(Collection pages) { - return pages; - } - }; - - /** - * Queries whether the given page may be closed. - * - * @param page - * the page to be closed - * - * @return whether the page may be closed - */ - boolean canRemovePage(PageRef page); - - /** - * Filters a set of pages to be closed, returning those that actually may be closed. - * This accounts for the possibility where a page may be closeable on its own, - * but not if some other pages are also to be closed. - * - * @param pages - * a collection of pages to be closed - * - * @return the subset (possibly all or none) of the pages that may be closed - */ - default Collection filterRemovablePages(Collection pages) { - return pages.stream().filter(this::canRemovePage).collect(Collectors.toList()); - } - - /** - * Composes myself with an{@code other} removal validator. - * - * @param other - * another removal validator - * - * @return a removal validator that applies my filtering and the {@code other}'s, both - */ - default PageRemovalValidator compose(PageRemovalValidator other) { - return new CompositePageRemovalValidator(this, other); - } - - /** - * Obtains the page removal validator for the given {@code notifier}. - * - * @param notifier - * an element of (usually) the Sash model - * - * @return the appropriate removal validator, never {@code null} (though perhaps the - * {@link #ALWAYS_REMOVE} instance) - */ - static PageRemovalValidator getInstance(Notifier notifier) { - return notifier.eAdapters().stream() - .filter(PageRemovalValidator.class::isInstance).map(PageRemovalValidator.class::cast) - .reduce(PageRemovalValidator::compose) - .orElse(ALWAYS_REMOVE); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF index 969c4d16bae..b30c3ac802c 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF @@ -1,11 +1,9 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.core.sasheditor, org.eclipse.papyrus.infra.core.sasheditor.contentprovider, - org.eclipse.papyrus.infra.core.sasheditor.contentprovider.service, org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple, org.eclipse.papyrus.infra.core.sasheditor.editor, org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor, - org.eclipse.papyrus.infra.core.sasheditor.editor.gef, org.eclipse.papyrus.infra.core.sasheditor.internal, org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy, org.eclipse.papyrus.infra.core.sasheditor.multipage.editor, @@ -21,7 +19,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.e4.core.contexts;bundle-version="1.0.0";resolution:=optional, org.eclipse.e4.ui.model.workbench;bundle-version="0.10.0";resolution:=optional, org.eclipse.core.expressions;bundle-version="3.4.300", - org.eclipse.gef;bundle-version="3.8.1", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageManager.java deleted file mode 100644 index 717d04d8845..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageManager.java +++ /dev/null @@ -1,165 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754 - * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 415638 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sasheditor.contentprovider; - -import java.util.List; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.service.ILocalPageService; -import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; - - -/** - * Interface providing method to manage pages in the Sash Windows system. - * This interface can be provided by ContentProvider whishing to provide a standard - * way to manage pages. This interface is not mandatory for the Sasheditor. - * This interface provide basic access to the Sash Windows system. - * It is intended to be used from the application in order to interact with the ContentProvider. Then, - * the {@link SashWindowsContainer} will refresh its views. - * - * - * @author dumoulin - */ -public interface IPageManager extends IPageMngr { - - /** - * Reload the Diagram - * This used when a resource is reloaded, the related diagrams are reloaded as well - * - * @see org.eclipse.papyrus.infra.services.controlmode.listener.LoadResourceSnippet - * - * @param pageIdentifier - * Identifier of the page to reload - */ - public void reloadPage(Object pageIdentifier); - - /** - * Close the page corresponding to the identifier. - * The identifier is removed from the Sash Windows, but not from the list of pages. - * - * If the page is open more than once on the current Sash windows, only - * one instance will be closed. - * - * @param pageIdentifier - * The object identifying the page - * - * - * @see {@link #closeAllOpenedPages(Object)} - */ - @Override - public void closePage(Object pageIdentifier); - - - /** - * Close all opened pages. - * - */ - @Override - public void closeAllOpenedPages(); - - /** - * Close all opened pages except the one provided as parameter. - * - * @param pageIdentifier - */ - @Override - public void closeOtherPages(Object pageIdentifier); - - /** - * Open a Page corresponding to the identifier. If the page is not in the list of pages, add it. - * The identifier is first added to the current folder model. Then the Sash Windows should react and - * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the - * SWT page. - * - * @param page - * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This - * identifier is stored in the sash model. - * It should be a reference on a EMF object identifying the page. - */ - @Override - public void openPage(Object pageIdentifier); - - /** - * Open a Page corresponding to the identifier. - * The identifier is first added to the current folder model. Then the Sash Windows should react and - * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the - * SWT page. - * - * The specified EditorID will be propagated to the {@link IPageModelFactory} to open the right editor - * - * @param page - * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This - * identifier is stored in the sash model. - * It should be a reference on a EMF object identifying the page. - */ - default void openPage(Object pageIdentifier, String editorID) { - openPage(pageIdentifier); - } - - /** - * Return all available page identifiers (open and closed pages). - * - * @return List of registered page identifiers. - */ - @Override - public List allPages(); - - /** - * Gets the local pages of a main model. - * - * @param mainModel - * the main model - * @param service - * the service to determine what is a local page - * @return the local pages - */ - public List allLocalPages(ILocalPageService service); - - /** - * Return true if a page is open for the specified pageIdentifier. - * - * @param diagram - * @return - */ - @Override - public boolean isOpen(Object pageIdentifier); - - /** - * Remove all pages used to render the specified pageIndentifier. - * If the pageIdentifier has more than one page rendering it, each of these - * pages are closed. - * - * @param pageIdentifier - */ - public void closeAllOpenedPages(Object pageIdentifier); - - /** - * Select the first page used to render the specified pageIdentifier. - * Do nothing if this page identifier is not rendered. - * - * @param pageIdentifier - */ - public void selectPage(Object pageIdentifier); - - /** - * Get the open pages associated to the passed Object - * - * @param uri - * URI of the Object from which we want the associated open pages - * @return List of Pages identifier of the related object'URI - */ - public List getAssociatedPages(Object uri); - - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java deleted file mode 100644 index 91e674901c7..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java +++ /dev/null @@ -1,114 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 CEA LIST & LIFL - * - * - * 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sasheditor.contentprovider; - -import java.util.List; - -import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; - - -/** - * Interface providing method to manage pages in the Sash Windows system. - * This interface can be provided by ContentProvider whishing to provide a standard - * way to manage pages. This interface is not mandatory for the Sasheditor. - * This interface provide basic access to the Sash Windows system. - * It is intended to be used from the application in order to interact with the ContentProvider. Then, - * the {@link SashWindowsContainer} will refresh its views. - * - * - * @author dumoulin - * - * @deprecated Use IPageManager instead - */ -@Deprecated -public interface IPageMngr { - - /** - * Add a Page identifier to the list of pages, do not open it. - * - * @param page - * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This - * identifier is stored in the sash model. - * It should be a reference on a EMF object identifying the page. - * @deprecated The pages are now computed dynamically - */ - @Deprecated - public void addPage(Object pageIdentifier); - - /** - * Remove the page from the SashWindows system and from the list of page. - * The page will not be available anymore. - * - * @param pageIdentifier - * The object identifying the page - * - * @deprecated The pages are now computed dynamically. Use {@link IPageManager#closeAllOpenedPages(Object)} instead - */ - @Deprecated - public void removePage(Object pageIdentifier); - - /** - * Close the page corresponding to the identifier. - * The identifier is removed from the Sash Windows, but not from the list of pages. - * - * @param pageIdentifier - * The object identifying the page - */ - public void closePage(Object pageIdentifier); - - - /** - * Close all opened pages. - * - */ - public void closeAllOpenedPages(); - - /** - * Close all opened pages except the one provided as parameter. - * - * @param pageIdentifier - */ - public void closeOtherPages(Object pageIdentifier); - - /** - * Open a Page corresponding to the identifier. If the page is not in the list of pages, add it. - * The identifier is first added to the current folder model. Then the Sash Windows should react and - * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the - * SWT page. - * If - * - * @param page - * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This - * identifier is stored in the sash model. - * It should be a reference on a EMF object identifying the page. - */ - public void openPage(Object pageIdentifier); - - /** - * Return all available page identifiers (open and closed pages). - * - * @return List of registered page identifiers. - */ - public List allPages(); - - /** - * Return true if a page is open for the specified pageIdentifier. - * - * @param diagram - * @return - */ - public boolean isOpen(Object pageIdentifier); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/AbstractLocalPageService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/AbstractLocalPageService.java deleted file mode 100644 index 7f68f7d4163..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/AbstractLocalPageService.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.service; - - -/** - * Basic implementation of the local page service which contains the root element that contains pages. - */ -public abstract class AbstractLocalPageService implements ILocalPageService { - - /** The root element. */ - protected Object rootElement = null; - - /** - * Constructor. - * - */ - public AbstractLocalPageService(Object rootElement) { - this.rootElement = rootElement; - } - - - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/ILocalPageService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/ILocalPageService.java deleted file mode 100644 index 1bdb5cd4183..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/service/ILocalPageService.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Pascual (ALL4TEC) gabriel.pascual - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.service; - - -/** - * Service for PageManager to determine local page. - * - * @author Gabriel Pascual - * - */ -public interface ILocalPageService { - - - /** - * Checks if is local page. - * - * @param content - * the content - * @return true, if is local page - */ - boolean isLocalPage(Object content); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java deleted file mode 100644 index db58846b49e..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.sasheditor.editor.gef; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; - - -/** - * Provide methods and services needed for Gef Editors. - * This class is intended to be used as a delegate inside classes providing MultiDiagramEditor. - * - * @author dumoulin - * - */ -public class MultiDiagramEditorGefDelegate { - - /** The registry holding actions associated to the main editor */ - protected ActionRegistry actionRegistry; - - /** Synchronizer object */ - // private MultiPageSelectionSynchronizer synchronizer; - - /** List of listeners on SelectionChanged event */ - private List selectionListeners = new ArrayList(1); - - - /** - * This method should be called by the containing class. - */ - public void dispose() { - selectionListeners.clear(); - if (actionRegistry != null) { - actionRegistry.dispose(); - } - } - - - /** - * Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered. - * - * @param listener - * a selection changed listener - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionListeners.add(listener); - } - - /** - * Lazily creates and returns the action registry. - * - * @return the action registry - */ - public ActionRegistry getActionRegistry() { - if (actionRegistry == null) { - actionRegistry = new ActionRegistry(); - } - return actionRegistry; - } - - // /** - // * Returns the selection synchronizer object. The synchronizer can be used to sync the selection of 2 or more EditPartViewers. - // * - // * @return the syncrhonizer - // */ - // public MultiPageSelectionSynchronizer getSelectionSynchronizer() { - // if (synchronizer == null) { - // synchronizer = new MultiPageSelectionSynchronizer(); - // // Hook this editor. - // // synchronizer.addViewer(this); - // } - // return synchronizer; - // } - - /** - * Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered. - * - * @param listener - * the selection changed listener to be removed - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionListeners.remove(listener); - } - - /** - * Sets the current selection for this selection provider. - * - * @param selection - * the new selection - */ - public void setSelection(ISelection selection) { - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.classpath b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.classpath new file mode 100644 index 00000000000..50aae142c50 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.project b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.project new file mode 100644 index 00000000000..1efb06ad197 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.infra.core.sashwindows.di + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..4e7d0584e0b --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.infra.core.sashwindows.di, + org.eclipse.papyrus.infra.core.sashwindows.di.exception, + org.eclipse.papyrus.infra.core.sashwindows.di.impl, + org.eclipse.papyrus.infra.core.sashwindows.di.service, + org.eclipse.papyrus.infra.core.sashwindows.di.util +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", + org.eclipse.emf.ecore.xmi;bundle-version="2.5.0";visibility:=reexport, + org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.uml2.common;visibility:=reexport, + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0" +Bundle-Vendor: %providerName +Bundle-Version: 1.2.0.qualifier +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sashwindows.di;singleton:=true diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/about.html b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/about.html new file mode 100644 index 00000000000..dd3c089a94c --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

November 14, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/build.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/build.properties new file mode 100644 index 00000000000..700accc4834 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/build.properties @@ -0,0 +1,9 @@ +# +#Mon Sep 12 09:30:11 CEST 2011 +output..=bin/ +bin.includes=.,model/,META-INF/,plugin.xml,plugin.properties,about.html +jars.compile.order=. +src.includes = about.html +source.. = src-gen/,\ + src/ +bin..=bin/ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/di.ecore b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/di.ecore new file mode 100644 index 00000000000..fe18fc920bd --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/di.ecore @@ -0,0 +1,218 @@ + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di new file mode 100644 index 00000000000..aaa346654af --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di2 b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di2 new file mode 100644 index 00000000000..487e44caa67 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.di2 @@ -0,0 +1,862 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 810:142 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 228:672 + 1167:672 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 301:34 + 914:35 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 58:578 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 116:278 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.genmodel b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.genmodel new file mode 100644 index 00000000000..df767c77bd6 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.genmodel @@ -0,0 +1,192 @@ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + sashwindowsdi.uml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.notation b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.notation new file mode 100644 index 00000000000..a2058c1d7fc --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.notation @@ -0,0 +1,1256 @@ + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.uml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.uml new file mode 100644 index 00000000000..5d8586393bd --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/model/sashwindowsdi.uml @@ -0,0 +1,612 @@ + + + + + + + + + Root node of the model describing the sash windows, panels and pages. +A SashModel can have several windows containing panels separated by sashes. Such panels can be folders +containing pages. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lookup the pageRef identified by the pageIdentifier. +Return the pageRef or null if not found. +Lookup in the entire SashModel structure. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove all pages from the model. Only left one empty top level folder. + + + + + Remove pages other than the one specified from the model. Intermediate folders are also removed. + + + + + + + + + + + + Get the first available window. + + + + + + + + + + + + Lookup the first available folder. + + + + + + + + + + + + + + + + + + + + + Set the current selection without firing a changedEvent. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Redefine children. + + + + + + + + + + + + + + + + + Position of the sash in the panel. The position is in percent. The value should be between 0 and 100. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pageIdentifier can be a plain JavaObject or an EObject. +They are not stored in the same place. + + + + + + + + + + Storage to store Identifier that are not EObject. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Replace the specified child by the new value. +Don't need to be implemented in TabFolder. +Used to insert a new SashPanel. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + resource=XMI + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.properties new file mode 100644 index 00000000000..3182ee7584c --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = Papyrus Sashwindows DI Model +providerName=Eclipse Modeling Project diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.xml new file mode 100644 index 00000000000..d8efcf0f1eb --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/plugin.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml new file mode 100644 index 00000000000..8e67e56cd32 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + org.eclipse.papyrus.releng + org.eclipse.papyrus + 1.2.0-SNAPSHOT + ../../../../releng/main + + org.eclipse.papyrus.infra.core.sashwindows.di + org.eclipse.papyrus + 1.2.0-SNAPSHOT + eclipse-plugin + \ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java new file mode 100644 index 00000000000..7076494cce6 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPage.java @@ -0,0 +1,57 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Abstract Page'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPage() + * @model + * @generated + */ +public interface AbstractPage extends EObject { + + /** + * Returns the value of the 'Page Identifier' attribute. + * + *

+ * If the meaning of the 'Page Identifier' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Page Identifier' attribute. + * @see #setPageIdentifier(Object) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPage_PageIdentifier() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" ordered="false" + * @generated + */ + Object getPageIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}' attribute. + * + * + * + * @param value + * the new value of the 'Page Identifier' attribute. + * @see #getPageIdentifier() + * @generated + */ + void setPageIdentifier(Object value); + +} // AbstractPage diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java new file mode 100644 index 00000000000..ee55b20eba8 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/AbstractPanel.java @@ -0,0 +1,58 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Abstract Panel'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPanel() + * @model abstract="true" + * @generated + */ +public interface AbstractPanel extends EObject { + + /** + * Returns the value of the 'Parent' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}'. + * + *

+ * If the meaning of the 'Parent' container reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Parent' container reference. + * @see #setParent(PanelParent) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getAbstractPanel_Parent() + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren + * @model opposite="children" required="true" transient="false" ordered="false" + * @generated + */ + PanelParent getParent(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}' container reference. + * + * + * + * @param value + * the new value of the 'Parent' container reference. + * @see #getParent() + * @generated + */ + void setParent(PanelParent value); +} // AbstractPanel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java new file mode 100644 index 00000000000..db536b70467 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java @@ -0,0 +1,142 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage + * @generated + */ +public interface DiFactory extends EFactory { + + /** + * The singleton instance of the factory. + * + * + * + * @generated + */ + DiFactory eINSTANCE = org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiFactoryImpl.init(); + + /** + * Returns a new object of class 'Sash Model'. + * + * + * + * @return a new object of class 'Sash Model'. + * @generated + */ + SashModel createSashModel(); + + /** + * Returns a new object of class 'Window'. + * + * + * + * @return a new object of class 'Window'. + * @generated + */ + Window createWindow(); + + /** + * Returns a new object of class 'Position'. + * + * + * + * @return a new object of class 'Position'. + * @generated + */ + Position createPosition(); + + /** + * Returns a new object of class 'Size'. + * + * + * + * @return a new object of class 'Size'. + * @generated + */ + Size createSize(); + + /** + * Returns a new object of class 'Tab Folder'. + * + * + * + * @return a new object of class 'Tab Folder'. + * @generated + */ + TabFolder createTabFolder(); + + /** + * Returns a new object of class 'Page Ref'. + * + * + * + * @return a new object of class 'Page Ref'. + * @generated + */ + PageRef createPageRef(); + + /** + * Returns a new object of class 'Sash Panel'. + * + * + * + * @return a new object of class 'Sash Panel'. + * @generated + */ + SashPanel createSashPanel(); + + /** + * Returns a new object of class 'Abstract Page'. + * + * + * + * @return a new object of class 'Abstract Page'. + * @generated + */ + AbstractPage createAbstractPage(); + + /** + * Returns a new object of class 'Page List'. + * + * + * + * @return a new object of class 'Page List'. + * @generated + */ + @Deprecated + PageList createPageList(); + + /** + * Returns a new object of class 'Sash Windows Mngr'. + * + * + * + * @return a new object of class 'Sash Windows Mngr'. + * @generated + */ + SashWindowsMngr createSashWindowsMngr(); + + /** + * Returns the package supported by this factory. + * + * + * + * @return the package supported by this factory. + * @generated + */ + DiPackage getDiPackage(); + +} // DiFactory diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java new file mode 100644 index 00000000000..dfd6a0b5ec6 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java @@ -0,0 +1,1571 @@ +/***************************************************************************** + * Copyright (c) 2011, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory + * @model kind="package" + * @generated + */ +public interface DiPackage extends EPackage { + + /** + * The package name. + * + * + * + * @generated + */ + String eNAME = "di"; + + /** + * The package namespace URI. + * + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/papyrus/0.7.0/sashdi"; + + /** + * The package namespace name. + * + * + * + * @generated + */ + String eNS_PREFIX = "di"; + + /** + * The singleton instance of the package. + * + * + * + * @generated + */ + DiPackage eINSTANCE = org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl Sash Model}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashModel() + * @generated + */ + int SASH_MODEL = 0; + + /** + * The feature id for the 'Windows' containment reference list. + * + * + * + * @generated + * @ordered + */ + int SASH_MODEL__WINDOWS = 0; + + /** + * The feature id for the 'Current Selection' reference. + * + * + * + * @generated + * @ordered + */ + int SASH_MODEL__CURRENT_SELECTION = 1; + + /** + * The feature id for the 'Restore Active Page' attribute. + * + * + * + * @generated + * @ordered + */ + int SASH_MODEL__RESTORE_ACTIVE_PAGE = 2; + + /** + * The number of structural features of the 'Sash Model' class. + * + * + * + * @generated + * @ordered + */ + int SASH_MODEL_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl Panel Parent}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPanelParent() + * @generated + */ + int PANEL_PARENT = 2; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * + * @generated + * @ordered + */ + int PANEL_PARENT__CHILDREN = 0; + + /** + * The number of structural features of the 'Panel Parent' class. + * + * + * + * @generated + * @ordered + */ + int PANEL_PARENT_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl Window}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getWindow() + * @generated + */ + int WINDOW = 1; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * + * @generated + * @ordered + */ + int WINDOW__CHILDREN = PANEL_PARENT__CHILDREN; + + /** + * The feature id for the 'Position' reference. + * + * + * + * @generated + * @ordered + */ + int WINDOW__POSITION = PANEL_PARENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Size' reference. + * + * + * + * @generated + * @ordered + */ + int WINDOW__SIZE = PANEL_PARENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Panel' reference. + * + * + * + * @generated + * @ordered + */ + int WINDOW__PANEL = PANEL_PARENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Window' class. + * + * + * + * @generated + * @ordered + */ + int WINDOW_FEATURE_COUNT = PANEL_PARENT_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl Abstract Panel}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPanel() + * @generated + */ + int ABSTRACT_PANEL = 3; + + /** + * The feature id for the 'Parent' container reference. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_PANEL__PARENT = 0; + + /** + * The number of structural features of the 'Abstract Panel' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_PANEL_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl Position}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPosition() + * @generated + */ + int POSITION = 4; + + /** + * The feature id for the 'X' attribute. + * + * + * + * @generated + * @ordered + */ + int POSITION__X = 0; + + /** + * The feature id for the 'Y' attribute. + * + * + * + * @generated + * @ordered + */ + int POSITION__Y = 1; + + /** + * The number of structural features of the 'Position' class. + * + * + * + * @generated + * @ordered + */ + int POSITION_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl Size}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSize() + * @generated + */ + int SIZE = 5; + + /** + * The feature id for the 'Width' attribute. + * + * + * + * @generated + * @ordered + */ + int SIZE__WIDTH = 0; + + /** + * The feature id for the 'Length' attribute. + * + * + * + * @generated + * @ordered + */ + int SIZE__LENGTH = 1; + + /** + * The number of structural features of the 'Size' class. + * + * + * + * @generated + * @ordered + */ + int SIZE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl Tab Folder}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getTabFolder() + * @generated + */ + int TAB_FOLDER = 6; + + /** + * The feature id for the 'Parent' container reference. + * + * + * + * @generated + * @ordered + */ + int TAB_FOLDER__PARENT = ABSTRACT_PANEL__PARENT; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * + * @generated + * @ordered + */ + int TAB_FOLDER__CHILDREN = ABSTRACT_PANEL_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Current Selection' reference. + * + * + * + * @generated + * @ordered + */ + int TAB_FOLDER__CURRENT_SELECTION = ABSTRACT_PANEL_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Tab Folder' class. + * + * + * + * @generated + * @ordered + */ + int TAB_FOLDER_FEATURE_COUNT = ABSTRACT_PANEL_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl Page Ref}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageRef() + * @generated + */ + int PAGE_REF = 7; + + /** + * The feature id for the 'Emf Page Identifier' reference. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF__EMF_PAGE_IDENTIFIER = 0; + + /** + * The feature id for the 'Page Identifier' attribute. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF__PAGE_IDENTIFIER = 1; + + /** + * The feature id for the 'Object Page Identifier' attribute. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF__OBJECT_PAGE_IDENTIFIER = 2; + + /** + * The feature id for the 'Favorite Editor' attribute. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF__FAVORITE_EDITOR = 3; + + /** + * The feature id for the 'Parent' container reference. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF__PARENT = 4; + + /** + * The number of structural features of the 'Page Ref' class. + * + * + * + * @generated + * @ordered + */ + int PAGE_REF_FEATURE_COUNT = 5; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl Sash Panel}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashPanel() + * @generated + */ + int SASH_PANEL = 8; + + /** + * The feature id for the 'Parent' container reference. + * + * + * + * @generated + * @ordered + */ + int SASH_PANEL__PARENT = ABSTRACT_PANEL__PARENT; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * + * @generated + * @ordered + */ + int SASH_PANEL__CHILDREN = ABSTRACT_PANEL_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Sash Position' attribute. + * + * + * + * @generated + * @ordered + */ + int SASH_PANEL__SASH_POSITION = ABSTRACT_PANEL_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Direction' attribute. + * + * + * + * @generated + * @ordered + */ + int SASH_PANEL__DIRECTION = ABSTRACT_PANEL_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Sash Panel' class. + * + * + * + * @generated + * @ordered + */ + int SASH_PANEL_FEATURE_COUNT = ABSTRACT_PANEL_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl Abstract Page}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPage() + * @generated + */ + int ABSTRACT_PAGE = 9; + + /** + * The feature id for the 'Page Identifier' attribute. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_PAGE__PAGE_IDENTIFIER = 0; + + /** + * The number of structural features of the 'Abstract Page' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_PAGE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl Page List}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList() + * @generated + */ + @Deprecated + int PAGE_LIST = 10; + + /** + * The feature id for the 'Available Page' containment reference list. + * + * + * + * @generated + * @ordered + */ + @Deprecated + int PAGE_LIST__AVAILABLE_PAGE = 0; + + /** + * The number of structural features of the 'Page List' class. + * + * + * + * @generated + * @ordered + */ + int PAGE_LIST_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl Sash Windows Mngr}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashWindowsMngr() + * @generated + */ + int SASH_WINDOWS_MNGR = 11; + + /** + * The feature id for the 'Page List' containment reference. + * + * + * + * @generated + * @ordered + */ + int SASH_WINDOWS_MNGR__PAGE_LIST = 0; + + /** + * The feature id for the 'Sash Model' containment reference. + * + * + * + * @generated + * @ordered + */ + int SASH_WINDOWS_MNGR__SASH_MODEL = 1; + + /** + * The number of structural features of the 'Sash Windows Mngr' class. + * + * + * + * @generated + * @ordered + */ + int SASH_WINDOWS_MNGR_FEATURE_COUNT = 2; + + /** + * The meta object id for the 'int' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getint() + * @generated + */ + int INT = 12; + + /** + * The meta object id for the 'Java Object' data type. + * + * + * + * @see java.lang.Object + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getJavaObject() + * @generated + */ + int JAVA_OBJECT = 13; + + /** + * The meta object id for the 'Float' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getFloat() + * @generated + */ + int FLOAT = 15; + + /** + * The meta object id for the 'boolean' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getboolean() + * @generated + */ + int BOOLEAN = 14; + + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel Sash Model}'. + * + * + * + * @return the meta object for class 'Sash Model'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel + * @generated + */ + EClass getSashModel(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows Windows}'. + * + * + * + * @return the meta object for the containment reference list 'Windows'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows() + * @see #getSashModel() + * @generated + */ + EReference getSashModel_Windows(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}'. + * + * + * + * @return the meta object for the reference 'Current Selection'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection() + * @see #getSashModel() + * @generated + */ + EReference getSashModel_CurrentSelection(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}'. + * + * + * + * @return the meta object for the attribute 'Restore Active Page'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage() + * @see #getSashModel() + * @generated + */ + EAttribute getSashModel_RestoreActivePage(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window Window}'. + * + * + * + * @return the meta object for class 'Window'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window + * @generated + */ + EClass getWindow(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}'. + * + * + * + * @return the meta object for the reference 'Position'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition() + * @see #getWindow() + * @generated + */ + EReference getWindow_Position(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}'. + * + * + * + * @return the meta object for the reference 'Size'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize() + * @see #getWindow() + * @generated + */ + EReference getWindow_Size(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}'. + * + * + * + * @return the meta object for the reference 'Panel'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel() + * @see #getWindow() + * @generated + */ + EReference getWindow_Panel(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent Panel Parent}'. + * + * + * + * @return the meta object for class 'Panel Parent'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent + * @generated + */ + EClass getPanelParent(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}'. + * + * + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren() + * @see #getPanelParent() + * @generated + */ + EReference getPanelParent_Children(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel Abstract Panel}'. + * + * + * + * @return the meta object for class 'Abstract Panel'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel + * @generated + */ + EClass getAbstractPanel(); + + /** + * Returns the meta object for the container reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}'. + * + * + * + * @return the meta object for the container reference 'Parent'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent() + * @see #getAbstractPanel() + * @generated + */ + EReference getAbstractPanel_Parent(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position Position}'. + * + * + * + * @return the meta object for class 'Position'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position + * @generated + */ + EClass getPosition(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}'. + * + * + * + * @return the meta object for the attribute 'X'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX() + * @see #getPosition() + * @generated + */ + EAttribute getPosition_X(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}'. + * + * + * + * @return the meta object for the attribute 'Y'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY() + * @see #getPosition() + * @generated + */ + EAttribute getPosition_Y(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size Size}'. + * + * + * + * @return the meta object for class 'Size'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size + * @generated + */ + EClass getSize(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}'. + * + * + * + * @return the meta object for the attribute 'Width'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth() + * @see #getSize() + * @generated + */ + EAttribute getSize_Width(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}'. + * + * + * + * @return the meta object for the attribute 'Length'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength() + * @see #getSize() + * @generated + */ + EAttribute getSize_Length(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder Tab Folder}'. + * + * + * + * @return the meta object for class 'Tab Folder'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder + * @generated + */ + EClass getTabFolder(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}'. + * + * + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren() + * @see #getTabFolder() + * @generated + */ + EReference getTabFolder_Children(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}'. + * + * + * + * @return the meta object for the reference 'Current Selection'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection() + * @see #getTabFolder() + * @generated + */ + EReference getTabFolder_CurrentSelection(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef Page Ref}'. + * + * + * + * @return the meta object for class 'Page Ref'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef + * @generated + */ + EClass getPageRef(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}'. + * + * + * + * @return the meta object for the reference 'Emf Page Identifier'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier() + * @see #getPageRef() + * @generated + */ + EReference getPageRef_EmfPageIdentifier(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}'. + * + * + * + * @return the meta object for the attribute 'Page Identifier'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier() + * @see #getPageRef() + * @generated + */ + EAttribute getPageRef_PageIdentifier(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}'. + * + * + * + * @return the meta object for the attribute 'Object Page Identifier'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier() + * @see #getPageRef() + * @generated + */ + EAttribute getPageRef_ObjectPageIdentifier(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}'. + * + * + * + * @return the meta object for the attribute 'Favorite Editor'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor() + * @see #getPageRef() + * @generated + */ + EAttribute getPageRef_FavoriteEditor(); + + /** + * Returns the meta object for the container reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}'. + * + * + * + * @return the meta object for the container reference 'Parent'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent() + * @see #getPageRef() + * @generated + */ + EReference getPageRef_Parent(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel Sash Panel}'. + * + * + * + * @return the meta object for class 'Sash Panel'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel + * @generated + */ + EClass getSashPanel(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}'. + * + * + * + * @return the meta object for the attribute 'Sash Position'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition() + * @see #getSashPanel() + * @generated + */ + EAttribute getSashPanel_SashPosition(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}'. + * + * + * + * @return the meta object for the attribute 'Direction'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection() + * @see #getSashPanel() + * @generated + */ + EAttribute getSashPanel_Direction(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage Abstract Page}'. + * + * + * + * @return the meta object for class 'Abstract Page'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage + * @generated + */ + EClass getAbstractPage(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier Page Identifier}'. + * + * + * + * @return the meta object for the attribute 'Page Identifier'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage#getPageIdentifier() + * @see #getAbstractPage() + * @generated + */ + EAttribute getAbstractPage_PageIdentifier(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList Page List}'. + * + * + * + * @return the meta object for class 'Page List'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList + * @generated + */ + @Deprecated + EClass getPageList(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage Available Page}'. + * + * + * + * @return the meta object for the containment reference list 'Available Page'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage() + * @see #getPageList() + * @generated + */ + @Deprecated + EReference getPageList_AvailablePage(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr Sash Windows Mngr}'. + * + * + * + * @return the meta object for class 'Sash Windows Mngr'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr + * @generated + */ + EClass getSashWindowsMngr(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}'. + * + * + * + * @return the meta object for the containment reference 'Page List'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList() + * @see #getSashWindowsMngr() + * @generated + */ + @Deprecated + EReference getSashWindowsMngr_PageList(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}'. + * + * + * + * @return the meta object for the containment reference 'Sash Model'. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel() + * @see #getSashWindowsMngr() + * @generated + */ + EReference getSashWindowsMngr_SashModel(); + + /** + * Returns the meta object for data type 'int'. + * + * + * + * @return the meta object for data type 'int'. + * @model instanceClass="int" + * annotation="http://www.eclipse.org/uml2/2.0.0/UML originalName='Integer'" + * @generated + */ + EDataType getint(); + + /** + * Returns the meta object for data type '{@link java.lang.Object Java Object}'. + * + * + * + * @return the meta object for data type 'Java Object'. + * @see java.lang.Object + * @model instanceClass="java.lang.Object" + * @generated + */ + EDataType getJavaObject(); + + /** + * Returns the meta object for data type 'Float'. + * + * + * + * @return the meta object for data type 'Float'. + * @model instanceClass="float" + * @generated + */ + EDataType getFloat(); + + /** + * Returns the meta object for data type 'boolean'. + * + * + * + * @return the meta object for data type 'boolean'. + * @model instanceClass="boolean" + * @generated + */ + EDataType getboolean(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + DiFactory getDiFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * + * @generated + */ + interface Literals { + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl Sash Model}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashModel() + * @generated + */ + EClass SASH_MODEL = eINSTANCE.getSashModel(); + + /** + * The meta object literal for the 'Windows' containment reference list feature. + * + * + * + * @generated + */ + EReference SASH_MODEL__WINDOWS = eINSTANCE.getSashModel_Windows(); + + /** + * The meta object literal for the 'Current Selection' reference feature. + * + * + * + * @generated + */ + EReference SASH_MODEL__CURRENT_SELECTION = eINSTANCE.getSashModel_CurrentSelection(); + + /** + * The meta object literal for the 'Restore Active Page' attribute feature. + * + * + * + * @generated + */ + EAttribute SASH_MODEL__RESTORE_ACTIVE_PAGE = eINSTANCE.getSashModel_RestoreActivePage(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl Window}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getWindow() + * @generated + */ + EClass WINDOW = eINSTANCE.getWindow(); + + /** + * The meta object literal for the 'Position' reference feature. + * + * + * + * @generated + */ + EReference WINDOW__POSITION = eINSTANCE.getWindow_Position(); + + /** + * The meta object literal for the 'Size' reference feature. + * + * + * + * @generated + */ + EReference WINDOW__SIZE = eINSTANCE.getWindow_Size(); + + /** + * The meta object literal for the 'Panel' reference feature. + * + * + * + * @generated + */ + EReference WINDOW__PANEL = eINSTANCE.getWindow_Panel(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl Panel Parent}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPanelParent() + * @generated + */ + EClass PANEL_PARENT = eINSTANCE.getPanelParent(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * + * @generated + */ + EReference PANEL_PARENT__CHILDREN = eINSTANCE.getPanelParent_Children(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl Abstract Panel}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPanel() + * @generated + */ + EClass ABSTRACT_PANEL = eINSTANCE.getAbstractPanel(); + + /** + * The meta object literal for the 'Parent' container reference feature. + * + * + * + * @generated + */ + EReference ABSTRACT_PANEL__PARENT = eINSTANCE.getAbstractPanel_Parent(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl Position}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPosition() + * @generated + */ + EClass POSITION = eINSTANCE.getPosition(); + + /** + * The meta object literal for the 'X' attribute feature. + * + * + * + * @generated + */ + EAttribute POSITION__X = eINSTANCE.getPosition_X(); + + /** + * The meta object literal for the 'Y' attribute feature. + * + * + * + * @generated + */ + EAttribute POSITION__Y = eINSTANCE.getPosition_Y(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl Size}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSize() + * @generated + */ + EClass SIZE = eINSTANCE.getSize(); + + /** + * The meta object literal for the 'Width' attribute feature. + * + * + * + * @generated + */ + EAttribute SIZE__WIDTH = eINSTANCE.getSize_Width(); + + /** + * The meta object literal for the 'Length' attribute feature. + * + * + * + * @generated + */ + EAttribute SIZE__LENGTH = eINSTANCE.getSize_Length(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl Tab Folder}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getTabFolder() + * @generated + */ + EClass TAB_FOLDER = eINSTANCE.getTabFolder(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * + * @generated + */ + EReference TAB_FOLDER__CHILDREN = eINSTANCE.getTabFolder_Children(); + + /** + * The meta object literal for the 'Current Selection' reference feature. + * + * + * + * @generated + */ + EReference TAB_FOLDER__CURRENT_SELECTION = eINSTANCE.getTabFolder_CurrentSelection(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl Page Ref}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageRef() + * @generated + */ + EClass PAGE_REF = eINSTANCE.getPageRef(); + + /** + * The meta object literal for the 'Emf Page Identifier' reference feature. + * + * + * + * @generated + */ + EReference PAGE_REF__EMF_PAGE_IDENTIFIER = eINSTANCE.getPageRef_EmfPageIdentifier(); + + /** + * The meta object literal for the 'Page Identifier' attribute feature. + * + * + * + * @generated + */ + EAttribute PAGE_REF__PAGE_IDENTIFIER = eINSTANCE.getPageRef_PageIdentifier(); + + /** + * The meta object literal for the 'Object Page Identifier' attribute feature. + * + * + * + * @generated + */ + EAttribute PAGE_REF__OBJECT_PAGE_IDENTIFIER = eINSTANCE.getPageRef_ObjectPageIdentifier(); + + /** + * The meta object literal for the 'Favorite Editor' attribute feature. + * + * + * + * @generated + */ + EAttribute PAGE_REF__FAVORITE_EDITOR = eINSTANCE.getPageRef_FavoriteEditor(); + + /** + * The meta object literal for the 'Parent' container reference feature. + * + * + * + * @generated + */ + EReference PAGE_REF__PARENT = eINSTANCE.getPageRef_Parent(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl Sash Panel}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashPanel() + * @generated + */ + EClass SASH_PANEL = eINSTANCE.getSashPanel(); + + /** + * The meta object literal for the 'Sash Position' attribute feature. + * + * + * + * @generated + */ + EAttribute SASH_PANEL__SASH_POSITION = eINSTANCE.getSashPanel_SashPosition(); + + /** + * The meta object literal for the 'Direction' attribute feature. + * + * + * + * @generated + */ + EAttribute SASH_PANEL__DIRECTION = eINSTANCE.getSashPanel_Direction(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl Abstract Page}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getAbstractPage() + * @generated + */ + EClass ABSTRACT_PAGE = eINSTANCE.getAbstractPage(); + + /** + * The meta object literal for the 'Page Identifier' attribute feature. + * + * + * + * @generated + */ + EAttribute ABSTRACT_PAGE__PAGE_IDENTIFIER = eINSTANCE.getAbstractPage_PageIdentifier(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl Page List}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList() + * @generated + */ + @Deprecated + EClass PAGE_LIST = eINSTANCE.getPageList(); + + /** + * The meta object literal for the 'Available Page' containment reference list feature. + * + * + * + * @generated + */ + @Deprecated + EReference PAGE_LIST__AVAILABLE_PAGE = eINSTANCE.getPageList_AvailablePage(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl Sash Windows Mngr}' class. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getSashWindowsMngr() + * @generated + */ + EClass SASH_WINDOWS_MNGR = eINSTANCE.getSashWindowsMngr(); + + /** + * The meta object literal for the 'Page List' containment reference feature. + * + * + * + * @generated + */ + @Deprecated + EReference SASH_WINDOWS_MNGR__PAGE_LIST = eINSTANCE.getSashWindowsMngr_PageList(); + + /** + * The meta object literal for the 'Sash Model' containment reference feature. + * + * + * + * @generated + */ + EReference SASH_WINDOWS_MNGR__SASH_MODEL = eINSTANCE.getSashWindowsMngr_SashModel(); + + /** + * The meta object literal for the 'int' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getint() + * @generated + */ + EDataType INT = eINSTANCE.getint(); + + /** + * The meta object literal for the 'Java Object' data type. + * + * + * + * @see java.lang.Object + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getJavaObject() + * @generated + */ + EDataType JAVA_OBJECT = eINSTANCE.getJavaObject(); + + /** + * The meta object literal for the 'Float' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getFloat() + * @generated + */ + EDataType FLOAT = eINSTANCE.getFloat(); + + /** + * The meta object literal for the 'boolean' data type. + * + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getboolean() + * @generated + */ + EDataType BOOLEAN = eINSTANCE.getboolean(); + + } + +} // DiPackage diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java new file mode 100644 index 00000000000..6af3354aed1 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java @@ -0,0 +1,65 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Page List'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList#getAvailablePage Available Page}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageList() + * @model + * @generated + */ +@Deprecated +public interface PageList extends EObject { + + /** + * Returns the value of the 'Available Page' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef}. + * + *

+ * If the meaning of the 'Available Page' containment reference list isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Available Page' containment reference list. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageList_AvailablePage() + * @model containment="true" ordered="false" + * @generated + */ + EList getAvailablePage(); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void addPage(Object pageIdentifier); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void removePage(Object pageIdentifier); + +} // PageList diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java new file mode 100644 index 00000000000..4820610dea4 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PageRef.java @@ -0,0 +1,186 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Page Ref'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef() + * @model + * @generated + */ +public interface PageRef extends EObject { + + /** + * Returns the value of the 'Emf Page Identifier' reference. + * + *

+ * If the meaning of the 'Emf Page Identifier' reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Emf Page Identifier' reference. + * @see #setEmfPageIdentifier(EObject) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_EmfPageIdentifier() + * @model required="true" ordered="false" + * @generated + */ + EObject getEmfPageIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getEmfPageIdentifier Emf Page Identifier}' reference. + * + * + * + * @param value + * the new value of the 'Emf Page Identifier' reference. + * @see #getEmfPageIdentifier() + * @generated + */ + void setEmfPageIdentifier(EObject value); + + /** + * Returns the value of the 'Page Identifier' attribute. + * + * + * + * pageIdentifier can be a plain JavaObject or an EObject. + * They are not stored in the same place. + * + * + * @return the value of the 'Page Identifier' attribute. + * @see #setPageIdentifier(Object) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_PageIdentifier() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" transient="true" volatile="true" derived="true" ordered="false" + * @generated + */ + Object getPageIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getPageIdentifier Page Identifier}' attribute. + * + * + * + * @param value + * the new value of the 'Page Identifier' attribute. + * @see #getPageIdentifier() + * @generated + */ + void setPageIdentifier(Object value); + + /** + * Returns the value of the 'Object Page Identifier' attribute. + * + * + * + * Storage to store Identifier that are not EObject. + * + * + * @return the value of the 'Object Page Identifier' attribute. + * @see #setObjectPageIdentifier(Object) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_ObjectPageIdentifier() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" required="true" ordered="false" + * @generated + */ + Object getObjectPageIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getObjectPageIdentifier Object Page Identifier}' attribute. + * + * + * + * @param value + * the new value of the 'Object Page Identifier' attribute. + * @see #getObjectPageIdentifier() + * @generated + */ + void setObjectPageIdentifier(Object value); + + /** + * Returns the value of the 'Favorite Editor' attribute. + * + *

+ * If the meaning of the 'Favorite Editor' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Favorite Editor' attribute. + * @see #setFavoriteEditor(String) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_FavoriteEditor() + * @model dataType="org.eclipse.uml2.types.String" ordered="false" + * @generated + */ + String getFavoriteEditor(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getFavoriteEditor Favorite Editor}' attribute. + * + * + * + * @param value + * the new value of the 'Favorite Editor' attribute. + * @see #getFavoriteEditor() + * @generated + */ + void setFavoriteEditor(String value); + + /** + * Returns the value of the 'Parent' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}'. + * + *

+ * If the meaning of the 'Parent' container reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Parent' container reference. + * @see #setParent(TabFolder) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPageRef_Parent() + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren + * @model opposite="children" transient="false" ordered="false" + * @generated + */ + TabFolder getParent(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}' container reference. + * + * + * + * @param value + * the new value of the 'Parent' container reference. + * @see #getParent() + * @generated + */ + void setParent(TabFolder value); + + /** + * + * + * + * @model dataType="org.eclipse.papyrus.infra.core.sashwindows.di.boolean" required="true" ordered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + boolean isForIdentifier(Object pageIdentifier); + +} // PageRef diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java new file mode 100644 index 00000000000..22fbe90e30c --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/PanelParent.java @@ -0,0 +1,62 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Panel Parent'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent#getChildren Children}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPanelParent() + * @model abstract="true" + * @generated + */ +public interface PanelParent extends EObject { + + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel}. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent Parent}'. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPanelParent_Children() + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel#getParent + * @model opposite="parent" containment="true" lower="2" upper="2" ordered="false" + * @generated + */ + EList getChildren(); + + /** + * + * + * + * Replace the specified child by the new value. + * Don't need to be implemented in TabFolder. + * Used to insert a new SashPanel. + * + * + * @model oldChildRequired="true" oldChildOrdered="false" newChildRequired="true" newChildOrdered="false" + * @generated + */ + void replaceChild(AbstractPanel oldChild, AbstractPanel newChild); + +} // PanelParent diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java new file mode 100644 index 00000000000..349d0ad3556 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Position.java @@ -0,0 +1,86 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Position'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition() + * @model + * @generated + */ +public interface Position extends EObject { + + /** + * Returns the value of the 'X' attribute. + * + *

+ * If the meaning of the 'X' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'X' attribute. + * @see #setX(int) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition_X() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" + * @generated + */ + int getX(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getX X}' attribute. + * + * + * + * @param value + * the new value of the 'X' attribute. + * @see #getX() + * @generated + */ + void setX(int value); + + /** + * Returns the value of the 'Y' attribute. + * + *

+ * If the meaning of the 'Y' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Y' attribute. + * @see #setY(int) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getPosition_Y() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" + * @generated + */ + int getY(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position#getY Y}' attribute. + * + * + * + * @param value + * the new value of the 'Y' attribute. + * @see #getY() + * @generated + */ + void setY(int value); + +} // Position diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java new file mode 100644 index 00000000000..e22c9c9cc73 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashModel.java @@ -0,0 +1,272 @@ +/***************************************************************************** + * Copyright (c) 2011, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Sash Model'. + * + * + * + * Root node of the model describing the sash windows, panels and pages. + * A SashModel can have several windows containing panels separated by sashes. Such panels can be folders + * containing pages. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getWindows Windows}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel() + * @model + * @generated + */ +public interface SashModel extends EObject { + + /** + * Returns the value of the 'Windows' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window}. + * + *

+ * If the meaning of the 'Windows' containment reference list isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Windows' containment reference list. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_Windows() + * @model containment="true" ordered="false" + * @generated + */ + EList getWindows(); + + /** + * Returns the value of the 'Current Selection' reference. + * + *

+ * If the meaning of the 'Current Selection' reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Current Selection' reference. + * @see #setCurrentSelection(TabFolder) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_CurrentSelection() + * @model required="true" ordered="false" + * @generated + */ + TabFolder getCurrentSelection(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#getCurrentSelection Current Selection}' reference. + * + * + * + * @param value + * the new value of the 'Current Selection' reference. + * @see #getCurrentSelection() + * @generated + */ + void setCurrentSelection(TabFolder value); + + /** + * Returns the value of the 'Restore Active Page' attribute. + * + *

+ * If the meaning of the 'Restore Active Page' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Restore Active Page' attribute. + * @see #setRestoreActivePage(boolean) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashModel_RestoreActivePage() + * @model dataType="org.eclipse.papyrus.infra.core.sashwindows.di.boolean" required="true" ordered="false" + * @generated + */ + boolean isRestoreActivePage(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel#isRestoreActivePage Restore Active Page}' attribute. + * + * + * + * @param value + * the new value of the 'Restore Active Page' attribute. + * @see #isRestoreActivePage() + * @generated + */ + void setRestoreActivePage(boolean value); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + @Deprecated + void addPage(Object pageIdentifier); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void removePage(Object pageIdentifier); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void removePageAndEmptyFolder(Object pageIdentifier); + + /** + * + * + * + * @model selectionRequired="true" selectionOrdered="false" + * @generated + */ + void setCurrentSelectionSilently(TabFolder selection); + + /** + * + * + * + * @model folderRequired="true" folderOrdered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void addPage(TabFolder folder, Object pageIdentifier); + + /** + * + * + * + * @model folderRequired="true" folderOrdered="false" pageRefRequired="true" pageRefOrdered="false" + * @generated + */ + void addPage(TabFolder folder, PageRef pageRef); + + /** + * + * + * + * Lookup the pageRef identified by the pageIdentifier. + * Return the pageRef or null if not found. + * Lookup in the entire SashModel structure. + * + * + * @model required="true" ordered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + PageRef lookupPage(Object pageIdentifier); + + /** + * + * + * + * @model srcParentFolderRequired="true" srcParentFolderOrdered="false" srcIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" srcIndexRequired="true" srcIndexOrdered="false" targetParentFolderRequired="true" targetParentFolderOrdered="false" + * targetIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" targetIndexRequired="true" targetIndexOrdered="false" + * @generated + */ + void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder, int targetIndex); + + /** + * + * + * + * @model folderToInsertRequired="true" folderToInsertOrdered="false" refFolderRequired="true" refFolderOrdered="false" refFolderSideDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" refFolderSideRequired="true" refFolderSideOrdered="false" + * @generated + */ + void insertFolder(TabFolder folderToInsert, TabFolder refFolder, int refFolderSide); + + /** + * + * + * + * @model srcParentFolderRequired="true" srcParentFolderOrdered="false" srcIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" srcIndexRequired="true" srcIndexOrdered="false" targetParentFolderRequired="true" targetParentFolderOrdered="false" + * @generated + */ + void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder); + + /** + * + * + * + * @model folderRequired="true" folderOrdered="false" + * @generated + */ + void removeEmptyFolder(TabFolder folder); + + /** + * + * + * + * Remove all pages from the model. Only left one empty top level folder. + * + * + * @model + * @generated + */ + void removeAllPages(); + + /** + * + * + * + * Remove pages other than the one specified from the model. Intermediate folders are also removed. + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void removeOtherPages(Object pageIdentifier); + + /** + * + * + * + * Get the first available window. + * + * + * @model required="true" ordered="false" + * @generated + */ + Window lookupFirstWindow(); + + /** + * + * + * + * Lookup the first available folder. + * + * + * @model required="true" ordered="false" + * @generated + */ + TabFolder lookupFirstFolder(); + +} // SashModel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java new file mode 100644 index 00000000000..9edc29f262c --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashPanel.java @@ -0,0 +1,103 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + + +/** + * + * A representation of the model object 'Sash Panel'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel() + * @model + * @generated + */ +public interface SashPanel extends AbstractPanel, PanelParent { + + /** + * Returns the value of the 'Sash Position' attribute. + * + * + * + * Position of the sash in the panel. The position is in percent. The value should be between 0 and 100. + * + * + * @return the value of the 'Sash Position' attribute. + * @see #setSashPosition(float) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel_SashPosition() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.Float" required="true" ordered="false" + * @generated + */ + float getSashPosition(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getSashPosition Sash Position}' attribute. + * + * + * + * @param value + * the new value of the 'Sash Position' attribute. + * @see #getSashPosition() + * @generated + */ + void setSashPosition(float value); + + /** + * Returns the value of the 'Direction' attribute. + * + *

+ * If the meaning of the 'Direction' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Direction' attribute. + * @see #setDirection(int) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashPanel_Direction() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" + * @generated + */ + int getDirection(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel#getDirection Direction}' attribute. + * + * + * + * @param value + * the new value of the 'Direction' attribute. + * @see #getDirection() + * @generated + */ + void setDirection(int value); + + /** + * + * + * + * @model leftChildRequired="true" leftChildOrdered="false" rightChildRequired="true" rightChildOrdered="false" directionDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" directionRequired="true" directionOrdered="false" + * @generated + */ + void setChildren(AbstractPanel leftChild, AbstractPanel rightChild, int direction); + + /** + * + * + * + * @model childToDeleteRequired="true" childToDeleteOrdered="false" + * @generated + */ + void delete(AbstractPanel childToDelete); + +} // SashPanel diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java new file mode 100644 index 00000000000..502de0b6954 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java @@ -0,0 +1,88 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Sash Windows Mngr'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr() + * @model + * @generated + */ +public interface SashWindowsMngr extends EObject { + + /** + * Returns the value of the 'Page List' containment reference. + * + *

+ * If the meaning of the 'Page List' containment reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Page List' containment reference. + * @see #setPageList(PageList) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_PageList() + * @model containment="true" required="true" ordered="false" + * @generated + */ + @Deprecated + PageList getPageList(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList Page List}' containment reference. + * + * + * + * @param value + * the new value of the 'Page List' containment reference. + * @see #getPageList() + * @generated + */ + @Deprecated + void setPageList(PageList value); + + /** + * Returns the value of the 'Sash Model' containment reference. + * + *

+ * If the meaning of the 'Sash Model' containment reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Sash Model' containment reference. + * @see #setSashModel(SashModel) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_SashModel() + * @model containment="true" required="true" ordered="false" + * @generated + */ + SashModel getSashModel(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel Sash Model}' containment reference. + * + * + * + * @param value + * the new value of the 'Sash Model' containment reference. + * @see #getSashModel() + * @generated + */ + void setSashModel(SashModel value); + +} // SashWindowsMngr diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java new file mode 100644 index 00000000000..df09beece88 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Size.java @@ -0,0 +1,86 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Size'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize() + * @model + * @generated + */ +public interface Size extends EObject { + + /** + * Returns the value of the 'Width' attribute. + * + *

+ * If the meaning of the 'Width' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Width' attribute. + * @see #setWidth(int) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize_Width() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" + * @generated + */ + int getWidth(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getWidth Width}' attribute. + * + * + * + * @param value + * the new value of the 'Width' attribute. + * @see #getWidth() + * @generated + */ + void setWidth(int value); + + /** + * Returns the value of the 'Length' attribute. + * + *

+ * If the meaning of the 'Length' attribute isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Length' attribute. + * @see #setLength(int) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSize_Length() + * @model unique="false" dataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" required="true" ordered="false" + * @generated + */ + int getLength(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size#getLength Length}' attribute. + * + * + * + * @param value + * the new value of the 'Length' attribute. + * @see #getLength() + * @generated + */ + void setLength(int value); + +} // Size diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java new file mode 100644 index 00000000000..4f23a2bb492 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/TabFolder.java @@ -0,0 +1,135 @@ +/***************************************************************************** + * Copyright (c) 2011, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Tab Folder'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren Children}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder() + * @model + * @generated + */ +public interface TabFolder extends AbstractPanel { + + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef}. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent Parent}'. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder_Children() + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef#getParent + * @model opposite="parent" containment="true" ordered="false" + * @generated + */ + EList getChildren(); + + /** + * Returns the value of the 'Current Selection' reference. + *

+ * This feature subsets the following features: + *

+ *
    + *
  • '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getChildren() Children}'
  • + *
+ * + *

+ * If the meaning of the 'Current Selection' reference isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Current Selection' reference. + * @see #setCurrentSelection(PageRef) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getTabFolder_CurrentSelection() + * @model ordered="false" + * @generated + */ + PageRef getCurrentSelection(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#getCurrentSelection Current Selection}' reference. + * + * + * + * @param value + * the new value of the 'Current Selection' reference. + * @see #getCurrentSelection() + * @generated + */ + void setCurrentSelection(PageRef value); + + /** + * + * + * + * @model oldIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" oldIndexRequired="true" oldIndexOrdered="false" newIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" newIndexRequired="true" newIndexOrdered="false" + * @generated + */ + void movePage(int oldIndex, int newIndex); + + /** + * + * + * + * @model pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void addPage(Object pageIdentifier); + + /** + * + * + * + * @model pageIndexDataType="org.eclipse.papyrus.infra.core.sashwindows.di.int" pageIndexRequired="true" pageIndexOrdered="false" + * @generated + */ + void removePage(int pageIndex); + + /** + * + * + * + * @model indexDataType="org.eclipse.uml2.types.Integer" indexRequired="true" indexOrdered="false" pageIdentifierDataType="org.eclipse.papyrus.infra.core.sashwindows.di.JavaObject" pageIdentifierRequired="true" pageIdentifierOrdered="false" + * @generated + */ + void addPage(int index, Object pageIdentifier); + + /** + * + * + * + * @model pageRefRequired="true" pageRefOrdered="false" + * @generated + */ + void addPage(PageRef pageRef); + +} // TabFolder diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java new file mode 100644 index 00000000000..bda2c3c6e99 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/Window.java @@ -0,0 +1,114 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di; + + +/** + * + * A representation of the model object 'Window'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}
  • + *
+ * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow() + * @model + * @generated + */ +public interface Window extends PanelParent { + + /** + * Returns the value of the 'Position' reference. + * + *

+ * If the meaning of the 'Position' reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Position' reference. + * @see #setPosition(Position) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Position() + * @model required="true" ordered="false" + * @generated + */ + Position getPosition(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPosition Position}' reference. + * + * + * + * @param value + * the new value of the 'Position' reference. + * @see #getPosition() + * @generated + */ + void setPosition(Position value); + + /** + * Returns the value of the 'Size' reference. + * + *

+ * If the meaning of the 'Size' reference isn't clear, there really should be more of a description here... + *

+ * + * + * @return the value of the 'Size' reference. + * @see #setSize(Size) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Size() + * @model required="true" ordered="false" + * @generated + */ + Size getSize(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getSize Size}' reference. + * + * + * + * @param value + * the new value of the 'Size' reference. + * @see #getSize() + * @generated + */ + void setSize(Size value); + + /** + * Returns the value of the 'Panel' reference. + * + * + * + * Redefine children. + * + * + * @return the value of the 'Panel' reference. + * @see #setPanel(AbstractPanel) + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getWindow_Panel() + * @model required="true" transient="true" volatile="true" derived="true" ordered="false" + * @generated + */ + AbstractPanel getPanel(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window#getPanel Panel}' reference. + * + * + * + * @param value + * the new value of the 'Panel' reference. + * @see #getPanel() + * @generated + */ + void setPanel(AbstractPanel value); + +} // Window diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java new file mode 100644 index 00000000000..87a518566d3 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/exception/SashEditorException.java @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di.exception; + + +/** + * Exception for the Sash editor system + * + * @author eperico + */ +public class SashEditorException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new sash editor exception. + */ + public SashEditorException() { + } + + /** + * @param message + */ + public SashEditorException(String message) { + super(message); + } + + /** + * @param cause + */ + public SashEditorException(Throwable cause) { + super(cause); + } + + /** + * @param message + * @param cause + */ + public SashEditorException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java new file mode 100644 index 00000000000..153d2741eec --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPageImpl.java @@ -0,0 +1,181 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; + +/** + * + * An implementation of the model object 'Abstract Page'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPageImpl#getPageIdentifier Page Identifier}
  • + *
+ * + * @generated + */ +public class AbstractPageImpl extends EObjectImpl implements AbstractPage { + + /** + * The default value of the '{@link #getPageIdentifier() Page Identifier}' attribute. + * + * + * + * @see #getPageIdentifier() + * @generated + * @ordered + */ + protected static final Object PAGE_IDENTIFIER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getPageIdentifier() Page Identifier}' attribute. + * + * + * + * @see #getPageIdentifier() + * @generated + * @ordered + */ + protected Object pageIdentifier = PAGE_IDENTIFIER_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected AbstractPageImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.ABSTRACT_PAGE; + } + + /** + * + * + * + * @generated + */ + @Override + public Object getPageIdentifier() { + return pageIdentifier; + } + + /** + * + * + * + * @generated + */ + @Override + public void setPageIdentifier(Object newPageIdentifier) { + Object oldPageIdentifier = pageIdentifier; + pageIdentifier = newPageIdentifier; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER, oldPageIdentifier, pageIdentifier)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: + return getPageIdentifier(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: + setPageIdentifier(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: + setPageIdentifier(PAGE_IDENTIFIER_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.ABSTRACT_PAGE__PAGE_IDENTIFIER: + return PAGE_IDENTIFIER_EDEFAULT == null ? pageIdentifier != null : !PAGE_IDENTIFIER_EDEFAULT.equals(pageIdentifier); + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (pageIdentifier: "); + result.append(pageIdentifier); + result.append(')'); + return result.toString(); + } + +} // AbstractPageImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java new file mode 100644 index 00000000000..becd969f16d --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/AbstractPanelImpl.java @@ -0,0 +1,219 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; + +/** + * + * An implementation of the model object 'Abstract Panel'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.AbstractPanelImpl#getParent Parent}
  • + *
+ * + * @generated + */ +public abstract class AbstractPanelImpl extends EObjectImpl implements AbstractPanel { + + /** + * + * + * + * @generated + */ + protected AbstractPanelImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.ABSTRACT_PANEL; + } + + /** + * + * + * + * @generated + */ + @Override + public PanelParent getParent() { + if (eContainerFeatureID() != DiPackage.ABSTRACT_PANEL__PARENT) { + return null; + } + return (PanelParent) eInternalContainer(); + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetParent(PanelParent newParent, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject) newParent, DiPackage.ABSTRACT_PANEL__PARENT, msgs); + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setParent(PanelParent newParent) { + if (newParent != eInternalContainer() || (eContainerFeatureID() != DiPackage.ABSTRACT_PANEL__PARENT && newParent != null)) { + if (EcoreUtil.isAncestor(this, newParent)) { + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + } + NotificationChain msgs = null; + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + if (newParent != null) { + msgs = ((InternalEObject) newParent).eInverseAdd(this, DiPackage.PANEL_PARENT__CHILDREN, PanelParent.class, msgs); + } + msgs = basicSetParent(newParent, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.ABSTRACT_PANEL__PARENT, newParent, newParent)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + return basicSetParent((PanelParent) otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + return basicSetParent(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case DiPackage.ABSTRACT_PANEL__PARENT: + return eInternalContainer().eInverseRemove(this, DiPackage.PANEL_PARENT__CHILDREN, PanelParent.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + return getParent(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + setParent((PanelParent) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + setParent((PanelParent) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.ABSTRACT_PANEL__PARENT: + return getParent() != null; + } + return super.eIsSet(featureID); + } + +} // AbstractPanelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java new file mode 100644 index 00000000000..6aee6d71261 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java @@ -0,0 +1,387 @@ +/***************************************************************************** + * Copyright (c) 2009, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation (assumed) + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; + +/** + * + * An implementation of the model Factory. + * + * + * @generated + */ +public class DiFactoryImpl extends EFactoryImpl implements DiFactory { + + /** + * Creates the default factory implementation. + * + * + * + * @generated + */ + public static DiFactory init() { + try { + DiFactory theDiFactory = (DiFactory) EPackage.Registry.INSTANCE.getEFactory(DiPackage.eNS_URI); + if (theDiFactory != null) { + return theDiFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new DiFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * + * @generated + */ + public DiFactoryImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case DiPackage.SASH_MODEL: + return createSashModel(); + case DiPackage.WINDOW: + return createWindow(); + case DiPackage.POSITION: + return createPosition(); + case DiPackage.SIZE: + return createSize(); + case DiPackage.TAB_FOLDER: + return createTabFolder(); + case DiPackage.PAGE_REF: + return createPageRef(); + case DiPackage.SASH_PANEL: + return createSashPanel(); + case DiPackage.ABSTRACT_PAGE: + return createAbstractPage(); + case DiPackage.PAGE_LIST: + return createPageList(); + case DiPackage.SASH_WINDOWS_MNGR: + return createSashWindowsMngr(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case DiPackage.INT: + return createintFromString(eDataType, initialValue); + case DiPackage.JAVA_OBJECT: + return createJavaObjectFromString(eDataType, initialValue); + case DiPackage.BOOLEAN: + return createbooleanFromString(eDataType, initialValue); + case DiPackage.FLOAT: + return createFloatFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case DiPackage.INT: + return convertintToString(eDataType, instanceValue); + case DiPackage.JAVA_OBJECT: + return convertJavaObjectToString(eDataType, instanceValue); + case DiPackage.BOOLEAN: + return convertbooleanToString(eDataType, instanceValue); + case DiPackage.FLOAT: + return convertFloatToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * + * @generated + */ + @Override + public SashModel createSashModel() { + SashModelImpl sashModel = new SashModelImpl(); + return sashModel; + } + + /** + * + * + * + * @generated + */ + @Override + public Window createWindow() { + WindowImpl window = new WindowImpl(); + return window; + } + + /** + * + * + * + * @generated + */ + @Override + public Position createPosition() { + PositionImpl position = new PositionImpl(); + return position; + } + + /** + * + * + * + * @generated + */ + @Override + public Size createSize() { + SizeImpl size = new SizeImpl(); + return size; + } + + /** + * + * + * + * @generated + */ + @Override + public TabFolder createTabFolder() { + TabFolderImpl tabFolder = new TabFolderImpl(); + return tabFolder; + } + + /** + * + * + * + * @generated + */ + @Override + public PageRef createPageRef() { + PageRefImpl pageRef = new PageRefImpl(); + return pageRef; + } + + /** + * + * + * + * @generated + */ + @Override + public SashPanel createSashPanel() { + SashPanelImpl sashPanel = new SashPanelImpl(); + return sashPanel; + } + + /** + * + * + * + * @generated + */ + @Override + public AbstractPage createAbstractPage() { + AbstractPageImpl abstractPage = new AbstractPageImpl(); + return abstractPage; + } + + /** + * + * + * + * @generated + */ + @Override + public PageList createPageList() { + PageListImpl pageList = new PageListImpl(); + return pageList; + } + + /** + * + * + * + * @generated + */ + @Override + public SashWindowsMngr createSashWindowsMngr() { + SashWindowsMngrImpl sashWindowsMngr = new SashWindowsMngrImpl(); + return sashWindowsMngr; + } + + /** + * + * + * + * @generated + */ + public Integer createintFromString(EDataType eDataType, String initialValue) { + return (Integer) super.createFromString(eDataType, initialValue); + } + + /** + * + * + * + * @generated + */ + public String convertintToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * + * + * + * @generated NOT + */ + public Object createJavaObjectFromString(EDataType eDataType, String initialValue) { + Object result = null; + + try { + result = super.createFromString(eDataType, initialValue); + } catch (IllegalArgumentException e) { + // Not deserialized as a Java object? Then just return the string value (or null) + if (initialValue != null) { + result = initialValue.intern(); + } + } + + return result; + } + + /** + * + * + * + * @generated + */ + public String convertJavaObjectToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * + * + * + * @generated + */ + public Float createFloatFromString(EDataType eDataType, String initialValue) { + return (Float) super.createFromString(eDataType, initialValue); + } + + /** + * + * + * + * @generated + */ + public String convertFloatToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * + * + * + * @generated + */ + public Boolean createbooleanFromString(EDataType eDataType, String initialValue) { + return (Boolean) super.createFromString(eDataType, initialValue); + } + + /** + * + * + * + * @generated + */ + public String convertbooleanToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * + * + * + * @generated + */ + @Override + public DiPackage getDiPackage() { + return (DiPackage) getEPackage(); + } + + /** + * + * + * + * @deprecated + * @generated + */ + @Deprecated + public static DiPackage getPackage() { + return DiPackage.eINSTANCE; + } + +} // DiFactoryImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java new file mode 100644 index 00000000000..90b134c448a --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java @@ -0,0 +1,1044 @@ +/***************************************************************************** + * Copyright (c) 2011, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; +import org.eclipse.uml2.types.TypesPackage; + +/** + * + * An implementation of the model Package. + * + * + * @generated + */ +public class DiPackageImpl extends EPackageImpl implements DiPackage { + + /** + * + * + * + * @generated + */ + private EClass sashModelEClass = null; + + /** + * + * + * + * @generated + */ + private EClass windowEClass = null; + + /** + * + * + * + * @generated + */ + private EClass panelParentEClass = null; + + /** + * + * + * + * @generated + */ + private EClass abstractPanelEClass = null; + + /** + * + * + * + * @generated + */ + private EClass positionEClass = null; + + /** + * + * + * + * @generated + */ + private EClass sizeEClass = null; + + /** + * + * + * + * @generated + */ + private EClass tabFolderEClass = null; + + /** + * + * + * + * @generated + */ + private EClass pageRefEClass = null; + + /** + * + * + * + * @generated + */ + private EClass sashPanelEClass = null; + + /** + * + * + * + * @generated + */ + private EClass abstractPageEClass = null; + + /** + * + * + * + * @generated + */ + private EClass pageListEClass = null; + + /** + * + * + * + * @generated + */ + private EClass sashWindowsMngrEClass = null; + + /** + * + * + * + * @generated + */ + private EDataType intEDataType = null; + + /** + * + * + * + * @generated + */ + private EDataType javaObjectEDataType = null; + + /** + * + * + * + * @generated + */ + private EDataType floatEDataType = null; + + /** + * + * + * + * @generated + */ + private EDataType booleanEDataType = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

+ * Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#eNS_URI + * @see #init() + * @generated + */ + private DiPackageImpl() { + super(eNS_URI, DiFactory.eINSTANCE); + } + + /** + * + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

+ * This method is used to initialize {@link DiPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static DiPackage init() { + if (isInited) { + return (DiPackage) EPackage.Registry.INSTANCE.getEPackage(DiPackage.eNS_URI); + } + + // Obtain or create and register package + DiPackageImpl theDiPackage = (DiPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DiPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DiPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + TypesPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theDiPackage.createPackageContents(); + + // Initialize created meta-data + theDiPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theDiPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(DiPackage.eNS_URI, theDiPackage); + return theDiPackage; + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getSashModel() { + return sashModelEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getSashModel_Windows() { + return (EReference) sashModelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getSashModel_CurrentSelection() { + return (EReference) sashModelEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getSashModel_RestoreActivePage() { + return (EAttribute) sashModelEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getWindow() { + return windowEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getWindow_Position() { + return (EReference) windowEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getWindow_Size() { + return (EReference) windowEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getWindow_Panel() { + return (EReference) windowEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getPanelParent() { + return panelParentEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getPanelParent_Children() { + return (EReference) panelParentEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getAbstractPanel() { + return abstractPanelEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getAbstractPanel_Parent() { + return (EReference) abstractPanelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getPosition() { + return positionEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getPosition_X() { + return (EAttribute) positionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getPosition_Y() { + return (EAttribute) positionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getSize() { + return sizeEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getSize_Width() { + return (EAttribute) sizeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getSize_Length() { + return (EAttribute) sizeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getTabFolder() { + return tabFolderEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getTabFolder_Children() { + return (EReference) tabFolderEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getTabFolder_CurrentSelection() { + return (EReference) tabFolderEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getPageRef() { + return pageRefEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getPageRef_EmfPageIdentifier() { + return (EReference) pageRefEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getPageRef_PageIdentifier() { + return (EAttribute) pageRefEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getPageRef_ObjectPageIdentifier() { + return (EAttribute) pageRefEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getPageRef_FavoriteEditor() { + return (EAttribute) pageRefEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getPageRef_Parent() { + return (EReference) pageRefEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getSashPanel() { + return sashPanelEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getSashPanel_SashPosition() { + return (EAttribute) sashPanelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getSashPanel_Direction() { + return (EAttribute) sashPanelEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getAbstractPage() { + return abstractPageEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getAbstractPage_PageIdentifier() { + return (EAttribute) abstractPageEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getPageList() { + return pageListEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getPageList_AvailablePage() { + return (EReference) pageListEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getSashWindowsMngr() { + return sashWindowsMngrEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getSashWindowsMngr_PageList() { + return (EReference) sashWindowsMngrEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getSashWindowsMngr_SashModel() { + return (EReference) sashWindowsMngrEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EDataType getint() { + return intEDataType; + } + + /** + * + * + * + * @generated + */ + @Override + public EDataType getJavaObject() { + return javaObjectEDataType; + } + + /** + * + * + * + * @generated + */ + @Override + public EDataType getFloat() { + return floatEDataType; + } + + /** + * + * + * + * @generated + */ + @Override + public EDataType getboolean() { + return booleanEDataType; + } + + /** + * + * + * + * @generated + */ + @Override + public DiFactory getDiFactory() { + return (DiFactory) getEFactoryInstance(); + } + + /** + * + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) { + return; + } + isCreated = true; + + // Create classes and their features + sashModelEClass = createEClass(SASH_MODEL); + createEReference(sashModelEClass, SASH_MODEL__WINDOWS); + createEReference(sashModelEClass, SASH_MODEL__CURRENT_SELECTION); + createEAttribute(sashModelEClass, SASH_MODEL__RESTORE_ACTIVE_PAGE); + + windowEClass = createEClass(WINDOW); + createEReference(windowEClass, WINDOW__POSITION); + createEReference(windowEClass, WINDOW__SIZE); + createEReference(windowEClass, WINDOW__PANEL); + + panelParentEClass = createEClass(PANEL_PARENT); + createEReference(panelParentEClass, PANEL_PARENT__CHILDREN); + + abstractPanelEClass = createEClass(ABSTRACT_PANEL); + createEReference(abstractPanelEClass, ABSTRACT_PANEL__PARENT); + + positionEClass = createEClass(POSITION); + createEAttribute(positionEClass, POSITION__X); + createEAttribute(positionEClass, POSITION__Y); + + sizeEClass = createEClass(SIZE); + createEAttribute(sizeEClass, SIZE__WIDTH); + createEAttribute(sizeEClass, SIZE__LENGTH); + + tabFolderEClass = createEClass(TAB_FOLDER); + createEReference(tabFolderEClass, TAB_FOLDER__CHILDREN); + createEReference(tabFolderEClass, TAB_FOLDER__CURRENT_SELECTION); + + pageRefEClass = createEClass(PAGE_REF); + createEReference(pageRefEClass, PAGE_REF__EMF_PAGE_IDENTIFIER); + createEAttribute(pageRefEClass, PAGE_REF__PAGE_IDENTIFIER); + createEAttribute(pageRefEClass, PAGE_REF__OBJECT_PAGE_IDENTIFIER); + createEAttribute(pageRefEClass, PAGE_REF__FAVORITE_EDITOR); + createEReference(pageRefEClass, PAGE_REF__PARENT); + + sashPanelEClass = createEClass(SASH_PANEL); + createEAttribute(sashPanelEClass, SASH_PANEL__SASH_POSITION); + createEAttribute(sashPanelEClass, SASH_PANEL__DIRECTION); + + abstractPageEClass = createEClass(ABSTRACT_PAGE); + createEAttribute(abstractPageEClass, ABSTRACT_PAGE__PAGE_IDENTIFIER); + + pageListEClass = createEClass(PAGE_LIST); + createEReference(pageListEClass, PAGE_LIST__AVAILABLE_PAGE); + + sashWindowsMngrEClass = createEClass(SASH_WINDOWS_MNGR); + createEReference(sashWindowsMngrEClass, SASH_WINDOWS_MNGR__PAGE_LIST); + createEReference(sashWindowsMngrEClass, SASH_WINDOWS_MNGR__SASH_MODEL); + + // Create data types + intEDataType = createEDataType(INT); + javaObjectEDataType = createEDataType(JAVA_OBJECT); + booleanEDataType = createEDataType(BOOLEAN); + floatEDataType = createEDataType(FLOAT); + } + + /** + * + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) { + return; + } + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + TypesPackage theTypesPackage = (TypesPackage) EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI); + EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + windowEClass.getESuperTypes().add(this.getPanelParent()); + tabFolderEClass.getESuperTypes().add(this.getAbstractPanel()); + sashPanelEClass.getESuperTypes().add(this.getAbstractPanel()); + sashPanelEClass.getESuperTypes().add(this.getPanelParent()); + + // Initialize classes and features; add operations and parameters + initEClass(sashModelEClass, SashModel.class, "SashModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSashModel_Windows(), this.getWindow(), null, "windows", null, 0, -1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEReference(getSashModel_CurrentSelection(), this.getTabFolder(), null, "currentSelection", null, 1, 1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + initEAttribute(getSashModel_RestoreActivePage(), this.getboolean(), "restoreActivePage", null, 1, 1, SashModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + EOperation op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, this.getPageRef(), "lookupPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "srcParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "srcIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "targetParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "targetIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "insertFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "folderToInsert", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "refFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "refFolderSide", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "srcParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "srcIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "targetParentFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "removeEmptyFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); + + addEOperation(sashModelEClass, null, "removeAllPages", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "removeOtherPages", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + addEOperation(sashModelEClass, this.getWindow(), "lookupFirstWindow", 1, 1, IS_UNIQUE, !IS_ORDERED); + + addEOperation(sashModelEClass, this.getTabFolder(), "lookupFirstFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "removePageAndEmptyFolder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "setCurrentSelectionSilently", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "selection", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashModelEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getTabFolder(), "folder", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getPageRef(), "pageRef", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(windowEClass, Window.class, "Window", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getWindow_Position(), this.getPosition(), null, "position", null, 1, 1, Window.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEReference(getWindow_Size(), this.getSize(), null, "size", null, 1, 1, Window.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEReference(getWindow_Panel(), this.getAbstractPanel(), null, "panel", null, 1, 1, Window.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, IS_DERIVED, !IS_ORDERED); + + initEClass(panelParentEClass, PanelParent.class, "PanelParent", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPanelParent_Children(), this.getAbstractPanel(), this.getAbstractPanel_Parent(), "children", null, 2, 2, PanelParent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_DERIVED, !IS_ORDERED); + + op = addEOperation(panelParentEClass, null, "replaceChild", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getAbstractPanel(), "oldChild", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getAbstractPanel(), "newChild", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(abstractPanelEClass, AbstractPanel.class, "AbstractPanel", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAbstractPanel_Parent(), this.getPanelParent(), this.getPanelParent_Children(), "parent", null, 1, 1, AbstractPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, + !IS_DERIVED, !IS_ORDERED); + + initEClass(positionEClass, Position.class, "Position", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPosition_X(), this.getint(), "x", null, 1, 1, Position.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEAttribute(getPosition_Y(), this.getint(), "y", null, 1, 1, Position.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + initEClass(sizeEClass, Size.class, "Size", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getSize_Width(), this.getint(), "width", null, 1, 1, Size.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEAttribute(getSize_Length(), this.getint(), "length", null, 1, 1, Size.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + initEClass(tabFolderEClass, TabFolder.class, "TabFolder", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTabFolder_Children(), this.getPageRef(), this.getPageRef_Parent(), "children", null, 0, -1, TabFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + initEReference(getTabFolder_CurrentSelection(), this.getPageRef(), null, "currentSelection", null, 0, 1, TabFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + + op = addEOperation(tabFolderEClass, null, "movePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "oldIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "newIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(tabFolderEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "pageIndex", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, theTypesPackage.getInteger(), "index", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(tabFolderEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getPageRef(), "pageRef", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(pageRefEClass, PageRef.class, "PageRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPageRef_EmfPageIdentifier(), theEcorePackage.getEObject(), null, "emfPageIdentifier", null, 1, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + initEAttribute(getPageRef_PageIdentifier(), this.getJavaObject(), "pageIdentifier", null, 1, 1, PageRef.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, !IS_ORDERED); + initEAttribute(getPageRef_ObjectPageIdentifier(), this.getJavaObject(), "objectPageIdentifier", null, 1, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEAttribute(getPageRef_FavoriteEditor(), theTypesPackage.getString(), "favoriteEditor", null, 0, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEReference(getPageRef_Parent(), this.getTabFolder(), this.getTabFolder_Children(), "parent", null, 0, 1, PageRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + + op = addEOperation(pageRefEClass, this.getboolean(), "isForIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(sashPanelEClass, SashPanel.class, "SashPanel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getSashPanel_SashPosition(), this.getFloat(), "sashPosition", null, 1, 1, SashPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEAttribute(getSashPanel_Direction(), this.getint(), "direction", null, 1, 1, SashPanel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + op = addEOperation(sashPanelEClass, null, "setChildren", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getAbstractPanel(), "leftChild", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getAbstractPanel(), "rightChild", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getint(), "direction", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(sashPanelEClass, null, "delete", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getAbstractPanel(), "childToDelete", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(abstractPageEClass, AbstractPage.class, "AbstractPage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getAbstractPage_PageIdentifier(), this.getJavaObject(), "pageIdentifier", null, 1, 1, AbstractPage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + initEClass(pageListEClass, PageList.class, "PageList", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPageList_AvailablePage(), this.getPageRef(), null, "availablePage", null, 0, -1, PageList.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + op = addEOperation(pageListEClass, null, "addPage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + op = addEOperation(pageListEClass, null, "removePage", 1, 1, IS_UNIQUE, !IS_ORDERED); + addEParameter(op, this.getJavaObject(), "pageIdentifier", 1, 1, IS_UNIQUE, !IS_ORDERED); + + initEClass(sashWindowsMngrEClass, SashWindowsMngr.class, "SashWindowsMngr", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSashWindowsMngr_PageList(), this.getPageList(), null, "pageList", null, 1, 1, SashWindowsMngr.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEReference(getSashWindowsMngr_SashModel(), this.getSashModel(), null, "sashModel", null, 1, 1, SashWindowsMngr.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, + !IS_ORDERED); + + // Initialize data types + initEDataType(intEDataType, int.class, "int", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(javaObjectEDataType, Object.class, "JavaObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(booleanEDataType, boolean.class, "boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(floatEDataType, float.class, "Float", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // resource=XMI + createResourceXMIAnnotations(); + // http://www.eclipse.org/uml2/2.0.0/UML + createUMLAnnotations(); + // subsets + createSubsetsAnnotations(); + } + + /** + * Initializes the annotations for resource=XMI. + * + * + * + * @generated + */ + protected void createResourceXMIAnnotations() { + String source = "resource=XMI"; + addAnnotation(this, + source, + new String[] { + }); + } + + /** + * Initializes the annotations for http://www.eclipse.org/uml2/2.0.0/UML. + * + * + * + * @generated + */ + protected void createUMLAnnotations() { + String source = "http://www.eclipse.org/uml2/2.0.0/UML"; + addAnnotation(intEDataType, + source, + new String[] { + "originalName", "Integer" + }); + } + + /** + * Initializes the annotations for subsets. + * + * + * + * @generated + */ + protected void createSubsetsAnnotations() { + String source = "subsets"; + addAnnotation(getTabFolder_CurrentSelection(), + source, + new String[] { + }, + new URI[] { + URI.createURI(eNS_URI).appendFragment("//TabFolder/children") + }); + } + +} // DiPackageImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java new file mode 100644 index 00000000000..80162d963ee --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageListImpl.java @@ -0,0 +1,195 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; + +/** + * + * An implementation of the model object 'Page List'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageListImpl#getAvailablePage Available Page}
  • + *
+ * + * @generated + */ +public class PageListImpl extends EObjectImpl implements PageList { + + /** + * The cached value of the '{@link #getAvailablePage() Available Page}' containment reference list. + * + * + * + * @see #getAvailablePage() + * @generated + * @ordered + */ + protected EList availablePage; + + /** + * + * + * + * @generated + */ + protected PageListImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.PAGE_LIST; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getAvailablePage() { + if (availablePage == null) { + availablePage = new EObjectContainmentEList(PageRef.class, this, DiPackage.PAGE_LIST__AVAILABLE_PAGE); + } + return availablePage; + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(Object pageIdentifier) { + + PageRef pageRef = DiFactory.eINSTANCE.createPageRef(); + pageRef.setPageIdentifier(pageIdentifier); + getAvailablePage().add(pageRef); + + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removePage(Object pageIdentifier) { + for (PageRef pageRef : getAvailablePage()) { + + if (pageRef.isForIdentifier(pageIdentifier)) { + getAvailablePage().remove(pageRef); + return; + } + } + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.PAGE_LIST__AVAILABLE_PAGE: + return ((InternalEList) getAvailablePage()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.PAGE_LIST__AVAILABLE_PAGE: + return getAvailablePage(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.PAGE_LIST__AVAILABLE_PAGE: + getAvailablePage().clear(); + getAvailablePage().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.PAGE_LIST__AVAILABLE_PAGE: + getAvailablePage().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.PAGE_LIST__AVAILABLE_PAGE: + return availablePage != null && !availablePage.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // PageListImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java new file mode 100644 index 00000000000..7592c4f57a4 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java @@ -0,0 +1,507 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; + +/** + * + * An implementation of the model object 'Page Ref'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getEmfPageIdentifier Emf Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getPageIdentifier Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getObjectPageIdentifier Object Page Identifier}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getFavoriteEditor Favorite Editor}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getParent Parent}
  • + *
+ * + * @generated + */ +public class PageRefImpl extends EObjectImpl implements PageRef { + + /** + * The cached value of the '{@link #getEmfPageIdentifier() Emf Page Identifier}' reference. + * + * + * + * @see #getEmfPageIdentifier() + * @generated + * @ordered + */ + protected EObject emfPageIdentifier; + + /** + * The default value of the '{@link #getPageIdentifier() Page Identifier}' attribute. + * + * + * + * @see #getPageIdentifier() + * @generated + * @ordered + */ + protected static final Object PAGE_IDENTIFIER_EDEFAULT = null; + + /** + * The default value of the '{@link #getObjectPageIdentifier() Object Page Identifier}' attribute. + * + * + * + * @see #getObjectPageIdentifier() + * @generated + * @ordered + */ + protected static final Object OBJECT_PAGE_IDENTIFIER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getObjectPageIdentifier() Object Page Identifier}' attribute. + * + * + * + * @see #getObjectPageIdentifier() + * @generated + * @ordered + */ + protected Object objectPageIdentifier = OBJECT_PAGE_IDENTIFIER_EDEFAULT; + + /** + * The default value of the '{@link #getFavoriteEditor() Favorite Editor}' attribute. + * + * + * + * @see #getFavoriteEditor() + * @generated + * @ordered + */ + protected static final String FAVORITE_EDITOR_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFavoriteEditor() Favorite Editor}' attribute. + * + * + * + * @see #getFavoriteEditor() + * @generated + * @ordered + */ + protected String favoriteEditor = FAVORITE_EDITOR_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected PageRefImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.PAGE_REF; + } + + /** + * + * + * + * @generated + */ + @Override + public EObject getEmfPageIdentifier() { + if (emfPageIdentifier != null && emfPageIdentifier.eIsProxy()) { + InternalEObject oldEmfPageIdentifier = (InternalEObject) emfPageIdentifier; + emfPageIdentifier = eResolveProxy(oldEmfPageIdentifier); + if (emfPageIdentifier != oldEmfPageIdentifier) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER, oldEmfPageIdentifier, emfPageIdentifier)); + } + } + } + return emfPageIdentifier; + } + + /** + * + * + * + * @generated + */ + public EObject basicGetEmfPageIdentifier() { + return emfPageIdentifier; + } + + /** + * + * + * + * @generated + */ + @Override + public void setEmfPageIdentifier(EObject newEmfPageIdentifier) { + EObject oldEmfPageIdentifier = emfPageIdentifier; + emfPageIdentifier = newEmfPageIdentifier; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER, oldEmfPageIdentifier, emfPageIdentifier)); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public Object getPageIdentifier() { + Object res = getEmfPageIdentifier(); + + if (res != null) { + return res; + } else { + return getObjectPageIdentifier(); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public boolean isForIdentifier(Object pageIdentifier) { + // Avoid npe when there is an invalid "availablePage". See Bug 398712: Multiple issues with the PageManager + if (getPageIdentifier() == null) { + return false; + } + return getPageIdentifier().equals(pageIdentifier); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.PAGE_REF__PARENT: + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + return basicSetParent((TabFolder) otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.PAGE_REF__PARENT: + return basicSetParent(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case DiPackage.PAGE_REF__PARENT: + return eInternalContainer().eInverseRemove(this, DiPackage.TAB_FOLDER__CHILDREN, TabFolder.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: + if (resolve) { + return getEmfPageIdentifier(); + } + return basicGetEmfPageIdentifier(); + case DiPackage.PAGE_REF__PAGE_IDENTIFIER: + return getPageIdentifier(); + case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: + return getObjectPageIdentifier(); + case DiPackage.PAGE_REF__FAVORITE_EDITOR: + return getFavoriteEditor(); + case DiPackage.PAGE_REF__PARENT: + return getParent(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: + setEmfPageIdentifier((EObject) newValue); + return; + case DiPackage.PAGE_REF__PAGE_IDENTIFIER: + setPageIdentifier(newValue); + return; + case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: + setObjectPageIdentifier(newValue); + return; + case DiPackage.PAGE_REF__FAVORITE_EDITOR: + setFavoriteEditor((String) newValue); + return; + case DiPackage.PAGE_REF__PARENT: + setParent((TabFolder) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: + setEmfPageIdentifier((EObject) null); + return; + case DiPackage.PAGE_REF__PAGE_IDENTIFIER: + setPageIdentifier(PAGE_IDENTIFIER_EDEFAULT); + return; + case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: + setObjectPageIdentifier(OBJECT_PAGE_IDENTIFIER_EDEFAULT); + return; + case DiPackage.PAGE_REF__FAVORITE_EDITOR: + setFavoriteEditor(FAVORITE_EDITOR_EDEFAULT); + return; + case DiPackage.PAGE_REF__PARENT: + setParent((TabFolder) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.PAGE_REF__EMF_PAGE_IDENTIFIER: + return emfPageIdentifier != null; + case DiPackage.PAGE_REF__PAGE_IDENTIFIER: + return PAGE_IDENTIFIER_EDEFAULT == null ? getPageIdentifier() != null : !PAGE_IDENTIFIER_EDEFAULT.equals(getPageIdentifier()); + case DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER: + return OBJECT_PAGE_IDENTIFIER_EDEFAULT == null ? objectPageIdentifier != null : !OBJECT_PAGE_IDENTIFIER_EDEFAULT.equals(objectPageIdentifier); + case DiPackage.PAGE_REF__FAVORITE_EDITOR: + return FAVORITE_EDITOR_EDEFAULT == null ? favoriteEditor != null : !FAVORITE_EDITOR_EDEFAULT.equals(favoriteEditor); + case DiPackage.PAGE_REF__PARENT: + return getParent() != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (objectPageIdentifier: "); + result.append(objectPageIdentifier); + result.append(", favoriteEditor: "); + result.append(favoriteEditor); + result.append(')'); + return result.toString(); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void setPageIdentifier(Object newPageIdentifier) { + + if (newPageIdentifier instanceof EObject) { + setEmfPageIdentifier((EObject) newPageIdentifier); + return; + } + + // if null, unset all + if (newPageIdentifier == null && getEmfPageIdentifier() != null) { + setEmfPageIdentifier(null); + } + + // By default, consider newPageIdentifier as an Object + setObjectPageIdentifier(newPageIdentifier); + + } + + /** + * + * + * + * @generated + */ + @Override + public Object getObjectPageIdentifier() { + return objectPageIdentifier; + } + + /** + * + * + * + * @generated + */ + @Override + public void setObjectPageIdentifier(Object newObjectPageIdentifier) { + Object oldObjectPageIdentifier = objectPageIdentifier; + objectPageIdentifier = newObjectPageIdentifier; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__OBJECT_PAGE_IDENTIFIER, oldObjectPageIdentifier, objectPageIdentifier)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getFavoriteEditor() { + return favoriteEditor; + } + + /** + * + * + * + * @generated + */ + @Override + public void setFavoriteEditor(String newFavoriteEditor) { + String oldFavoriteEditor = favoriteEditor; + favoriteEditor = newFavoriteEditor; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__FAVORITE_EDITOR, oldFavoriteEditor, favoriteEditor)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public TabFolder getParent() { + if (eContainerFeatureID() != DiPackage.PAGE_REF__PARENT) { + return null; + } + return (TabFolder) eInternalContainer(); + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetParent(TabFolder newParent, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject) newParent, DiPackage.PAGE_REF__PARENT, msgs); + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setParent(TabFolder newParent) { + if (newParent != eInternalContainer() || (eContainerFeatureID() != DiPackage.PAGE_REF__PARENT && newParent != null)) { + if (EcoreUtil.isAncestor(this, newParent)) { + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + } + NotificationChain msgs = null; + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + if (newParent != null) { + msgs = ((InternalEObject) newParent).eInverseAdd(this, DiPackage.TAB_FOLDER__CHILDREN, TabFolder.class, msgs); + } + msgs = basicSetParent(newParent, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.PAGE_REF__PARENT, newParent, newParent)); + } + } + +} // PageRefImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java new file mode 100644 index 00000000000..35ca5cfcf07 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PanelParentImpl.java @@ -0,0 +1,191 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; + +/** + * + * An implementation of the model object 'Panel Parent'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PanelParentImpl#getChildren Children}
  • + *
+ * + * @generated + */ +public abstract class PanelParentImpl extends EObjectImpl implements PanelParent { + + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * + * @generated + */ + protected PanelParentImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.PANEL_PARENT; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getChildren() { + if (children == null) { + children = new EObjectContainmentWithInverseEList(AbstractPanel.class, this, DiPackage.PANEL_PARENT__CHILDREN, DiPackage.ABSTRACT_PANEL__PARENT); + } + return children; + } + + /** + * + * + * + * @generated + */ + @Override + public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + return getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + return children != null && !children.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // PanelParentImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java new file mode 100644 index 00000000000..6043e50c8b4 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PositionImpl.java @@ -0,0 +1,242 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; + +/** + * + * An implementation of the model object 'Position'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl#getX X}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PositionImpl#getY Y}
  • + *
+ * + * @generated + */ +public class PositionImpl extends EObjectImpl implements Position { + + /** + * The default value of the '{@link #getX() X}' attribute. + * + * + * + * @see #getX() + * @generated + * @ordered + */ + protected static final int X_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getX() X}' attribute. + * + * + * + * @see #getX() + * @generated + * @ordered + */ + protected int x = X_EDEFAULT; + + /** + * The default value of the '{@link #getY() Y}' attribute. + * + * + * + * @see #getY() + * @generated + * @ordered + */ + protected static final int Y_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getY() Y}' attribute. + * + * + * + * @see #getY() + * @generated + * @ordered + */ + protected int y = Y_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected PositionImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.POSITION; + } + + /** + * + * + * + * @generated + */ + @Override + public int getX() { + return x; + } + + /** + * + * + * + * @generated + */ + @Override + public void setX(int newX) { + int oldX = x; + x = newX; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.POSITION__X, oldX, x)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public int getY() { + return y; + } + + /** + * + * + * + * @generated + */ + @Override + public void setY(int newY) { + int oldY = y; + y = newY; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.POSITION__Y, oldY, y)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.POSITION__X: + return getX(); + case DiPackage.POSITION__Y: + return getY(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.POSITION__X: + setX((Integer) newValue); + return; + case DiPackage.POSITION__Y: + setY((Integer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.POSITION__X: + setX(X_EDEFAULT); + return; + case DiPackage.POSITION__Y: + setY(Y_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.POSITION__X: + return x != X_EDEFAULT; + case DiPackage.POSITION__Y: + return y != Y_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (x: "); + result.append(x); + result.append(", y: "); + result.append(y); + result.append(')'); + return result.toString(); + } + +} // PositionImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java new file mode 100644 index 00000000000..1ee2eba6960 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java @@ -0,0 +1,870 @@ +/***************************************************************************** + * Copyright (c) 2011, 2016 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; +import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch; +import org.eclipse.papyrus.infra.core.sashwindows.di.util.PageRemovalValidator; + +/** + * + * An implementation of the model object 'Sash Model'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#getWindows Windows}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#getCurrentSelection Current Selection}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashModelImpl#isRestoreActivePage Restore Active Page}
  • + *
+ * + * @generated + */ +public class SashModelImpl extends EObjectImpl implements SashModel { + + private static final int SWT_UP = 1 << 7; // from SWT.UP + private static final int SWT_HORIZONTAL = 1 << 8; // from SWT.HORIZONTAL + private static final int SWT_VERTICAL = 1 << 9; // from SWT.VERTICAL + private static final int SWT_LEFT = 1 << 14; // from SWT.LEFT + private static final int SWT_RIGHT = 1 << 17; // from SWT.RIGHT + + /** + * The cached value of the '{@link #getWindows() Windows}' containment reference list. + * + * + * + * @see #getWindows() + * @generated + * @ordered + */ + protected EList windows; + + /** + * The cached value of the '{@link #getCurrentSelection() Current Selection}' reference. + * + * + * + * @see #getCurrentSelection() + * @generated + * @ordered + */ + protected TabFolder currentSelection; + + /** + * The default value of the '{@link #isRestoreActivePage() Restore Active Page}' attribute. + * + * + * + * @see #isRestoreActivePage() + * @generated + * @ordered + */ + protected static final boolean RESTORE_ACTIVE_PAGE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isRestoreActivePage() Restore Active Page}' attribute. + * + * + * + * @see #isRestoreActivePage() + * @generated + * @ordered + */ + protected boolean restoreActivePage = RESTORE_ACTIVE_PAGE_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected SashModelImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.SASH_MODEL; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getWindows() { + if (windows == null) { + windows = new EObjectContainmentEList(Window.class, this, DiPackage.SASH_MODEL__WINDOWS); + } + return windows; + } + + /** + * + * + * + * @generated + */ + @Override + public TabFolder getCurrentSelection() { + if (currentSelection != null && currentSelection.eIsProxy()) { + InternalEObject oldCurrentSelection = (InternalEObject) currentSelection; + currentSelection = (TabFolder) eResolveProxy(oldCurrentSelection); + if (currentSelection != oldCurrentSelection) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.SASH_MODEL__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); + } + } + } + return currentSelection; + } + + /** + * + * + * + * @generated + */ + public TabFolder basicGetCurrentSelection() { + return currentSelection; + } + + /** + * + * + * + * @generated + */ + @Override + public void setCurrentSelection(TabFolder newCurrentSelection) { + TabFolder oldCurrentSelection = currentSelection; + currentSelection = newCurrentSelection; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_MODEL__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isRestoreActivePage() { + return restoreActivePage; + } + + /** + * + * + * + * @generated + */ + @Override + public void setRestoreActivePage(boolean newRestoreActivePage) { + boolean oldRestoreActivePage = restoreActivePage; + restoreActivePage = newRestoreActivePage; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE, oldRestoreActivePage, restoreActivePage)); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(Object pageIdentifier) { + getCurrentSelection().addPage(pageIdentifier); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(TabFolder folder, Object pageIdentifier) { + // if(folder==null) { + // // Use first folder + // folder = getFirstFolder(); + // } + folder.addPage(pageIdentifier); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(TabFolder folder, PageRef pageRef) { + folder.addPage(pageRef); + } + + /** + * Get the first folder in the model. + * Return null if no folder exist. + * + * @return + */ + // public TabFolder getFirstFolder() { + // + // } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removePage(Object pageIdentifier) { + PageRef pageRef = lookupPage(pageIdentifier); + if ((pageRef == null) || !PageRemovalValidator.getInstance(this).canRemovePage(pageRef)) { + return; + } + + // Get the folder containing the page + TabFolder folder = pageRef.getParent(); + // Remove the page + folder.getChildren().remove(pageRef); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removePageAndEmptyFolder(Object pageIdentifier) { + PageRef pageRef; + + PageRemovalValidator validator = PageRemovalValidator.getInstance(this); + for (pageRef = lookupPage(pageIdentifier); (pageRef != null) && validator.canRemovePage(pageRef); pageRef = lookupPage(pageIdentifier)) { + removeAndEmptyFolder(pageRef); + } + + } + + void removeAndEmptyFolder(PageRef pageRef) { + // Get the folder containing the page + TabFolder folder = pageRef.getParent(); + // Remove the page + folder.getChildren().remove(pageRef); + // Remove parent if empty + removeEmptyFolder(folder); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void setCurrentSelectionSilently(TabFolder selection) { + currentSelection = selection; + } + + /** + * + * + * + * @generated NOT + */ + @Override + public PageRef lookupPage(final Object pageIdentifier) { + + // Create appropriate visitor. + DiSwitch visitor = new DiSwitch() { + + /** + * Iterate over windows + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashModel(org.eclipse.papyrus.infra.core.sashwindows.di.SashModel) + * + * @param object + * @return + */ + @Override + public PageRef caseSashModel(SashModel object) { + PageRef res = null; + for (Window window : object.getWindows()) { + res = this.doSwitch(window); + if (res != null) { + return res; + } + } + + return super.caseSashModel(object); + } + + /** + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window) + * + * @param object + * @return + */ + @Override + public PageRef caseWindow(Window window) { + + AbstractPanel panel = window.getPanel(); + if (panel == null) { + return null; + } + + + PageRef res = this.doSwitch(panel); + if (res != null) { + return res; + } + + return super.caseWindow(window); + } + + /** + * Iterate over children + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashPanel(org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel) + * + * @param object + * @return + */ + @Override + public PageRef caseSashPanel(SashPanel object) { + PageRef res = null; + for (AbstractPanel panel : object.getChildren()) { + res = this.doSwitch(panel); + if (res != null) { + return res; + } + } + + return super.caseSashPanel(object); + } + + /** + * Iterate over PageRef + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseTabFolder(org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder) + * + * @param object + * @return + */ + @Override + public PageRef caseTabFolder(TabFolder object) { + for (PageRef pageRef : object.getChildren()) { + + if (pageRef.isForIdentifier(pageIdentifier)) { + return pageRef; + } + } + + return super.caseTabFolder(object); + } + + }; + + // Do lookup + PageRef res = visitor.doSwitch(this); + + return res; + } + + /** + * + * + * TODO Add method to metamodel + * + * @generated NOT + */ + @Override + public TabFolder lookupFirstFolder() { + + // Create appropriate visitor. + DiSwitch visitor = new DiSwitch() { + + /** + * Iterate over windows + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashModel(org.eclipse.papyrus.infra.core.sashwindows.di.SashModel) + * + * @param object + * @return + */ + @Override + public TabFolder caseSashModel(SashModel object) { + TabFolder res = null; + for (Window window : object.getWindows()) { + res = this.doSwitch(window); + if (res != null) { + return res; + } + } + + return super.caseSashModel(object); + } + + /** + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window) + * + * @param object + * @return + */ + @Override + public TabFolder caseWindow(Window window) { + + AbstractPanel panel = window.getPanel(); + if (panel == null) { + return null; + } + + + TabFolder res = this.doSwitch(panel); + if (res != null) { + return res; + } + + return super.caseWindow(window); + } + + /** + * Iterate over children + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseSashPanel(org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel) + * + * @param object + * @return + */ + @Override + public TabFolder caseSashPanel(SashPanel object) { + TabFolder res = null; + for (AbstractPanel panel : object.getChildren()) { + res = this.doSwitch(panel); + if (res != null) { + return res; + } + } + + return super.caseSashPanel(object); + } + + /** + * Iterate over PageRef + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseTabFolder(org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder) + * + * @param object + * @return + */ + @Override + public TabFolder caseTabFolder(TabFolder object) { + return object; + } + + }; + + // Do lookup + TabFolder res = visitor.doSwitch(this); + + return res; + } + + /** + * + * + * TODO Add method to metamodel + * + * @generated NOT + */ + @Override + public Window lookupFirstWindow() { + + List list = getWindows(); + if (list.size() == 0) { + return null; + } + + return list.get(0); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder, int targetIndex) { + + + // Check if we move all pages of srcFolder + if (srcIndex == -1) { + // move all + List srcChildrens = srcParentFolder.getChildren(); + List targetChildrens = targetParentFolder.getChildren(); + // while(srcChildrens.size() > 0) { + // PageRef pageRef = srcChildrens.remove(0); + // targetChildrens.add(pageRef); + // } + + if (targetIndex < 0 || targetIndex >= targetChildrens.size()) { + // Index is out of bounds. Move at the end. + targetChildrens.addAll(srcChildrens); + } else { + // index is in bounds. Move at index. + targetChildrens.addAll(targetIndex, srcChildrens); + } + return; + } + + // Move only one + PageRef pageRef = srcParentFolder.getChildren().remove(srcIndex); + + List targetChildrens = targetParentFolder.getChildren(); + // Check if out of target range. + if (targetIndex < 0 || targetIndex > targetChildrens.size()) { + targetChildrens.add(pageRef); + } else { + targetChildrens.add(targetIndex, pageRef); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void insertFolder(TabFolder folderToInsert, TabFolder refFolder, int side) { + + // Get the parent under which the sash will be inserted + PanelParent refParent = refFolder.getParent(); + + SashPanel newSash; + int direction; + + // Compute sash direction + if (side == SWT_LEFT || side == SWT_RIGHT) { + direction = SWT_HORIZONTAL; + } else { + direction = SWT_VERTICAL; + } + // Create sash + newSash = DiFactory.eINSTANCE.createSashPanel(); + // Insert in parent. Should be done before setting childrens, otherwise, the child can't be + // replaced as it will not belong to parent anymore. + refParent.replaceChild(refFolder, newSash); + + if (side == SWT_LEFT || side == SWT_UP) { // insert left + newSash.setChildren(folderToInsert, refFolder, direction); + } else { + newSash.setChildren(refFolder, folderToInsert, direction); + } + + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder) { + + // Check if we move all pages of srcFolder + if (srcIndex == -1) { + // move all + List srcChildrens = srcParentFolder.getChildren(); + List targetChildrens = targetParentFolder.getChildren(); + while (srcChildrens.size() > 0) { + PageRef pageRef = srcChildrens.remove(0); + targetChildrens.add(pageRef); + } + return; + } + + // Move only one page + PageRef pageRef = srcParentFolder.getChildren().remove(srcIndex); + List targetChildrens = targetParentFolder.getChildren(); + // Check if out of target range. + targetChildrens.add(pageRef); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removeEmptyFolder(TabFolder folder) { + + EList children = folder.getChildren(); + + // Check if empty + if (children.size() > 0) { + return; + } + + PanelParent parent = folder.getParent(); + // Forbid removing of the last folder + if (parent instanceof Window) { + return; + } + + // Parent is a sash. Ask it to remove the child and itself + ((SashPanel) parent).delete(folder); + // adjust current selection if the old folder was the currentSelection + if (getCurrentSelection() == folder) { + setCurrentSelectionSilently(lookupFirstFolder()); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removeAllPages() { + Collection pagesToRemove = getAllPages(); + int originalCount = pagesToRemove.size(); + pagesToRemove = PageRemovalValidator.getInstance(this).filterRemovablePages(pagesToRemove); + + if (pagesToRemove.size() < originalCount) { + // Do it the hard way + pagesToRemove.forEach(this::removeAndEmptyFolder); + } else { + // Get a the first window and a folder. + // Clear the folder and set it as the root folder. + // This disguard all other folder and pages ... + Window firstWindow = lookupFirstWindow(); + TabFolder folder = lookupFirstFolder(); + + folder.getChildren().clear(); + firstWindow.setPanel(folder); + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removeOtherPages(Object pageIdentifier) { + PageRef page = lookupPage(pageIdentifier); + + Collection pagesToRemove = getAllPages(); + pagesToRemove.remove(page); + int originalCount = pagesToRemove.size(); + pagesToRemove = PageRemovalValidator.getInstance(this).filterRemovablePages(pagesToRemove); + + if (pagesToRemove.size() < originalCount) { + // Do it the hard way + pagesToRemove.forEach(this::removeAndEmptyFolder); + } else { + // Get a the first window and a folder. + // Clear the folder and set it as the root folder. + // This disguard all other folder and pages ... + Window firstWindow = lookupFirstWindow(); + TabFolder folder = lookupFirstFolder(); + + folder.getChildren().clear(); + if (page != null) { + folder.getChildren().add(page); + } + firstWindow.setPanel(folder); + } + } + + private Collection getAllPages() { + Collection result = new ArrayList<>(); + + eAllContents().forEachRemaining(next -> { + if (next instanceof PageRef) { + result.add((PageRef) next); + } + }); + + return result; + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.SASH_MODEL__WINDOWS: + return ((InternalEList) getWindows()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.SASH_MODEL__WINDOWS: + return getWindows(); + case DiPackage.SASH_MODEL__CURRENT_SELECTION: + if (resolve) { + return getCurrentSelection(); + } + return basicGetCurrentSelection(); + case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: + return isRestoreActivePage(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.SASH_MODEL__WINDOWS: + getWindows().clear(); + getWindows().addAll((Collection) newValue); + return; + case DiPackage.SASH_MODEL__CURRENT_SELECTION: + setCurrentSelection((TabFolder) newValue); + return; + case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: + setRestoreActivePage((Boolean) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.SASH_MODEL__WINDOWS: + getWindows().clear(); + return; + case DiPackage.SASH_MODEL__CURRENT_SELECTION: + setCurrentSelection((TabFolder) null); + return; + case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: + setRestoreActivePage(RESTORE_ACTIVE_PAGE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.SASH_MODEL__WINDOWS: + return windows != null && !windows.isEmpty(); + case DiPackage.SASH_MODEL__CURRENT_SELECTION: + return currentSelection != null; + case DiPackage.SASH_MODEL__RESTORE_ACTIVE_PAGE: + return restoreActivePage != RESTORE_ACTIVE_PAGE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (restoreActivePage: "); + result.append(restoreActivePage); + result.append(')'); + return result.toString(); + } + +} // SashModelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java new file mode 100644 index 00000000000..d484e7b013a --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashPanelImpl.java @@ -0,0 +1,419 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; + +/** + * + * An implementation of the model object 'Sash Panel'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getChildren Children}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getSashPosition Sash Position}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashPanelImpl#getDirection Direction}
  • + *
+ * + * @generated + */ +public class SashPanelImpl extends AbstractPanelImpl implements SashPanel { + + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * The default value of the '{@link #getSashPosition() Sash Position}' attribute. + * + * + * + * @see #getSashPosition() + * @generated + * @ordered + */ + protected static final float SASH_POSITION_EDEFAULT = 0.0F; + + /** + * The cached value of the '{@link #getSashPosition() Sash Position}' attribute. + * + * + * + * @see #getSashPosition() + * @generated + * @ordered + */ + protected float sashPosition = SASH_POSITION_EDEFAULT; + + /** + * The default value of the '{@link #getDirection() Direction}' attribute. + * + * + * + * @see #getDirection() + * @generated + * @ordered + */ + protected static final int DIRECTION_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getDirection() Direction}' attribute. + * + * + * + * @see #getDirection() + * @generated + * @ordered + */ + protected int direction = DIRECTION_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected SashPanelImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.SASH_PANEL; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getChildren() { + if (children == null) { + children = new EObjectContainmentWithInverseEList(AbstractPanel.class, this, DiPackage.SASH_PANEL__CHILDREN, DiPackage.ABSTRACT_PANEL__PARENT); + } + return children; + } + + /** + * + * + * + * @generated + */ + @Override + public float getSashPosition() { + return sashPosition; + } + + /** + * + * + * + * @generated + */ + @Override + public void setSashPosition(float newSashPosition) { + float oldSashPosition = sashPosition; + sashPosition = newSashPosition; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_PANEL__SASH_POSITION, oldSashPosition, sashPosition)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public int getDirection() { + return direction; + } + + /** + * + * + * + * @generated + */ + @Override + public void setDirection(int newDirection) { + int oldDirection = direction; + direction = newDirection; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_PANEL__DIRECTION, oldDirection, direction)); + } + } + + /** + * + * + * + * + * @generated NOT + */ + @Override + public void setChildren(AbstractPanel leftChild, AbstractPanel rightChild, int direction) { + setDirection(direction); + List children = getChildren(); + + if (children.size() == 0) { + children.add(leftChild); + children.add(rightChild); + + } else { + children.set(0, leftChild); + children.set(1, rightChild); + } + + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void delete(AbstractPanel childToDelete) { + // Get the other child + EList children = getChildren(); + AbstractPanel otherChild = (childToDelete == children.get(0) ? children.get(1) : children.get(0)); + + PanelParent parent = getParent(); + // Change parent + // otherChild.setParent( parent ); + parent.replaceChild(this, otherChild); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + return getChildren(); + case DiPackage.SASH_PANEL__SASH_POSITION: + return getSashPosition(); + case DiPackage.SASH_PANEL__DIRECTION: + return getDirection(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection) newValue); + return; + case DiPackage.SASH_PANEL__SASH_POSITION: + setSashPosition((Float) newValue); + return; + case DiPackage.SASH_PANEL__DIRECTION: + setDirection((Integer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + getChildren().clear(); + return; + case DiPackage.SASH_PANEL__SASH_POSITION: + setSashPosition(SASH_POSITION_EDEFAULT); + return; + case DiPackage.SASH_PANEL__DIRECTION: + setDirection(DIRECTION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.SASH_PANEL__CHILDREN: + return children != null && !children.isEmpty(); + case DiPackage.SASH_PANEL__SASH_POSITION: + return sashPosition != SASH_POSITION_EDEFAULT; + case DiPackage.SASH_PANEL__DIRECTION: + return direction != DIRECTION_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { + if (baseClass == PanelParent.class) { + switch (derivedFeatureID) { + case DiPackage.SASH_PANEL__CHILDREN: + return DiPackage.PANEL_PARENT__CHILDREN; + default: + return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { + if (baseClass == PanelParent.class) { + switch (baseFeatureID) { + case DiPackage.PANEL_PARENT__CHILDREN: + return DiPackage.SASH_PANEL__CHILDREN; + default: + return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (sashPosition: "); + result.append(sashPosition); + result.append(", direction: "); + result.append(direction); + result.append(')'); + return result.toString(); + } + + /** + * + * Set both ends (parent and child). + * + * + * @generated NOT + */ + @Override + public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { + + int index = getChildren().indexOf(oldChild); + if (index >= 0) { + // do replace + getChildren().set(index, newChild); + newChild.setParent(this); + } else { + throw new IndexOutOfBoundsException("Child '" + oldChild + "' not found in sash. Can't replace it."); + } + } + +} // SashPanelImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java new file mode 100644 index 00000000000..97d9a4520de --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashWindowsMngrImpl.java @@ -0,0 +1,280 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; + +/** + * + * An implementation of the model object 'Sash Windows Mngr'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl#getPageList Page List}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SashWindowsMngrImpl#getSashModel Sash Model}
  • + *
+ * + * @generated + */ +public class SashWindowsMngrImpl extends EObjectImpl implements SashWindowsMngr { + + /** + * The cached value of the '{@link #getPageList() Page List}' containment reference. + * + * + * + * @see #getPageList() + * @generated + * @ordered + */ + protected PageList pageList; + + /** + * The cached value of the '{@link #getSashModel() Sash Model}' containment reference. + * + * + * + * @see #getSashModel() + * @generated + * @ordered + */ + protected SashModel sashModel; + + /** + * + * + * + * @generated + */ + protected SashWindowsMngrImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.SASH_WINDOWS_MNGR; + } + + /** + * + * + * + * @generated + */ + @Override + public PageList getPageList() { + return pageList; + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetPageList(PageList newPageList, NotificationChain msgs) { + PageList oldPageList = pageList; + pageList = newPageList; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, oldPageList, newPageList); + if (msgs == null) { + msgs = notification; + } else { + msgs.add(notification); + } + } + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setPageList(PageList newPageList) { + if (newPageList != pageList) { + NotificationChain msgs = null; + if (pageList != null) { + msgs = ((InternalEObject) pageList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, null, msgs); + } + if (newPageList != null) { + msgs = ((InternalEObject) newPageList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, null, msgs); + } + msgs = basicSetPageList(newPageList, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST, newPageList, newPageList)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public SashModel getSashModel() { + return sashModel; + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetSashModel(SashModel newSashModel, NotificationChain msgs) { + SashModel oldSashModel = sashModel; + sashModel = newSashModel; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, oldSashModel, newSashModel); + if (msgs == null) { + msgs = notification; + } else { + msgs.add(notification); + } + } + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setSashModel(SashModel newSashModel) { + if (newSashModel != sashModel) { + NotificationChain msgs = null; + if (sashModel != null) { + msgs = ((InternalEObject) sashModel).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, null, msgs); + } + if (newSashModel != null) { + msgs = ((InternalEObject) newSashModel).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, null, msgs); + } + msgs = basicSetSashModel(newSashModel, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL, newSashModel, newSashModel)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: + return basicSetPageList(null, msgs); + case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: + return basicSetSashModel(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: + return getPageList(); + case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: + return getSashModel(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: + setPageList((PageList) newValue); + return; + case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: + setSashModel((SashModel) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: + setPageList((PageList) null); + return; + case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: + setSashModel((SashModel) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.SASH_WINDOWS_MNGR__PAGE_LIST: + return pageList != null; + case DiPackage.SASH_WINDOWS_MNGR__SASH_MODEL: + return sashModel != null; + } + return super.eIsSet(featureID); + } + +} // SashWindowsMngrImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java new file mode 100644 index 00000000000..305fb0f0104 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SizeImpl.java @@ -0,0 +1,242 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; + +/** + * + * An implementation of the model object 'Size'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl#getWidth Width}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.SizeImpl#getLength Length}
  • + *
+ * + * @generated + */ +public class SizeImpl extends EObjectImpl implements Size { + + /** + * The default value of the '{@link #getWidth() Width}' attribute. + * + * + * + * @see #getWidth() + * @generated + * @ordered + */ + protected static final int WIDTH_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getWidth() Width}' attribute. + * + * + * + * @see #getWidth() + * @generated + * @ordered + */ + protected int width = WIDTH_EDEFAULT; + + /** + * The default value of the '{@link #getLength() Length}' attribute. + * + * + * + * @see #getLength() + * @generated + * @ordered + */ + protected static final int LENGTH_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getLength() Length}' attribute. + * + * + * + * @see #getLength() + * @generated + * @ordered + */ + protected int length = LENGTH_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected SizeImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.SIZE; + } + + /** + * + * + * + * @generated + */ + @Override + public int getWidth() { + return width; + } + + /** + * + * + * + * @generated + */ + @Override + public void setWidth(int newWidth) { + int oldWidth = width; + width = newWidth; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SIZE__WIDTH, oldWidth, width)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public int getLength() { + return length; + } + + /** + * + * + * + * @generated + */ + @Override + public void setLength(int newLength) { + int oldLength = length; + length = newLength; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.SIZE__LENGTH, oldLength, length)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.SIZE__WIDTH: + return getWidth(); + case DiPackage.SIZE__LENGTH: + return getLength(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.SIZE__WIDTH: + setWidth((Integer) newValue); + return; + case DiPackage.SIZE__LENGTH: + setLength((Integer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.SIZE__WIDTH: + setWidth(WIDTH_EDEFAULT); + return; + case DiPackage.SIZE__LENGTH: + setLength(LENGTH_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.SIZE__WIDTH: + return width != WIDTH_EDEFAULT; + case DiPackage.SIZE__LENGTH: + return length != LENGTH_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (width: "); + result.append(width); + result.append(", length: "); + result.append(length); + result.append(')'); + return result.toString(); + } + +} // SizeImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java new file mode 100644 index 00000000000..78b101351ab --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/TabFolderImpl.java @@ -0,0 +1,356 @@ +/***************************************************************************** + * Copyright (c) 2011, 2015 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.uml2.common.util.SubsetSupersetEObjectContainmentWithInverseEList; + +/** + * + * An implementation of the model object 'Tab Folder'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl#getChildren Children}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl#getCurrentSelection Current Selection}
  • + *
+ * + * @generated + */ +public class TabFolderImpl extends AbstractPanelImpl implements TabFolder { + + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * The cached value of the '{@link #getCurrentSelection() Current Selection}' reference. + * + * + * + * @see #getCurrentSelection() + * @generated + * @ordered + */ + protected PageRef currentSelection; + + /** + * + * + * + * @generated + */ + protected TabFolderImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.TAB_FOLDER; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getChildren() { + if (children == null) { + children = new SubsetSupersetEObjectContainmentWithInverseEList(PageRef.class, this, DiPackage.TAB_FOLDER__CHILDREN, null, CHILDREN_ESUBSETS, DiPackage.PAGE_REF__PARENT); + } + return children; + } + + /** + * The array of subset feature identifiers for the '{@link #getChildren() Children}' containment reference list. + * + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected static final int[] CHILDREN_ESUBSETS = new int[] { DiPackage.TAB_FOLDER__CURRENT_SELECTION }; + + /** + * + * + * + * @generated + */ + @Override + public PageRef getCurrentSelection() { + if (currentSelection != null && currentSelection.eIsProxy()) { + InternalEObject oldCurrentSelection = (InternalEObject) currentSelection; + currentSelection = (PageRef) eResolveProxy(oldCurrentSelection); + if (currentSelection != oldCurrentSelection) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.TAB_FOLDER__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); + } + } + } + return currentSelection; + } + + /** + * + * + * + * @generated + */ + public PageRef basicGetCurrentSelection() { + return currentSelection; + } + + /** + * + * + * + * @generated + */ + @Override + public void setCurrentSelection(PageRef newCurrentSelection) { + PageRef oldCurrentSelection = currentSelection; + currentSelection = newCurrentSelection; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.TAB_FOLDER__CURRENT_SELECTION, oldCurrentSelection, currentSelection)); + } + Resource.Internal eInternalResource = eInternalResource(); + if (eInternalResource == null || !eInternalResource.isLoading()) { + if (newCurrentSelection != null) { + EList children = getChildren(); + if (!children.contains(newCurrentSelection)) { + children.add(newCurrentSelection); + } + } + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(Object pageIdentifier) { + PageRef newPage = DiFactory.eINSTANCE.createPageRef(); + newPage.setPageIdentifier(pageIdentifier); + getChildren().add(newPage); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(int index, Object pageIdentifier) { + PageRef newPage = DiFactory.eINSTANCE.createPageRef(); + newPage.setPageIdentifier(pageIdentifier); + getChildren().add(index, newPage); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void addPage(PageRef pageRef) { + getChildren().add(pageRef); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void removePage(int pageIndex) { + getChildren().remove(pageIndex); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + return ((InternalEList) (InternalEList) getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + return getChildren(); + case DiPackage.TAB_FOLDER__CURRENT_SELECTION: + if (resolve) { + return getCurrentSelection(); + } + return basicGetCurrentSelection(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection) newValue); + return; + case DiPackage.TAB_FOLDER__CURRENT_SELECTION: + setCurrentSelection((PageRef) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + getChildren().clear(); + return; + case DiPackage.TAB_FOLDER__CURRENT_SELECTION: + setCurrentSelection((PageRef) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.TAB_FOLDER__CHILDREN: + return children != null && !children.isEmpty(); + case DiPackage.TAB_FOLDER__CURRENT_SELECTION: + return currentSelection != null; + } + return super.eIsSet(featureID); + } + + /** + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder#movePage(int, int) + * + * @param oldIndex + * @param newIndex + * @generated NOT + */ + @Override + public void movePage(int oldIndex, int newIndex) { + int listSize = getChildren().size(); + if (newIndex >= listSize) { + newIndex = listSize - 1; + } + if (newIndex < 0) { + newIndex = 0; + } + + if (oldIndex == newIndex) { + return; + } + + if (listSize == 0) { + return; + } + + + getChildren().move(newIndex, oldIndex); + } + +} // TabFolderImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java new file mode 100644 index 00000000000..b67a5cd0582 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/impl/WindowImpl.java @@ -0,0 +1,316 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; + +/** + * + * An implementation of the model object 'Window'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getPosition Position}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getSize Size}
  • + *
  • {@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.WindowImpl#getPanel Panel}
  • + *
+ * + * @generated + */ +public class WindowImpl extends PanelParentImpl implements Window { + + /** + * The cached value of the '{@link #getPosition() Position}' reference. + * + * + * + * @see #getPosition() + * @generated + * @ordered + */ + protected Position position; + + /** + * The cached value of the '{@link #getSize() Size}' reference. + * + * + * + * @see #getSize() + * @generated + * @ordered + */ + protected Size size; + + /** + * + * + * + * @generated + */ + protected WindowImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DiPackage.Literals.WINDOW; + } + + /** + * + * + * + * @generated + */ + @Override + public Position getPosition() { + if (position != null && position.eIsProxy()) { + InternalEObject oldPosition = (InternalEObject) position; + position = (Position) eResolveProxy(oldPosition); + if (position != oldPosition) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.WINDOW__POSITION, oldPosition, position)); + } + } + } + return position; + } + + /** + * + * + * + * @generated + */ + public Position basicGetPosition() { + return position; + } + + /** + * + * + * + * @generated + */ + @Override + public void setPosition(Position newPosition) { + Position oldPosition = position; + position = newPosition; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.WINDOW__POSITION, oldPosition, position)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Size getSize() { + if (size != null && size.eIsProxy()) { + InternalEObject oldSize = (InternalEObject) size; + size = (Size) eResolveProxy(oldSize); + if (size != oldSize) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiPackage.WINDOW__SIZE, oldSize, size)); + } + } + } + return size; + } + + /** + * + * + * + * @generated + */ + public Size basicGetSize() { + return size; + } + + /** + * + * + * + * @generated + */ + @Override + public void setSize(Size newSize) { + Size oldSize = size; + size = newSize; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.WINDOW__SIZE, oldSize, size)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public AbstractPanel getPanel() { + AbstractPanel panel = basicGetPanel(); + return panel != null && panel.eIsProxy() ? (AbstractPanel) eResolveProxy((InternalEObject) panel) : panel; + } + + /** + * + * + * + * @generated NOT + */ + public AbstractPanel basicGetPanel() { + EList list = getChildren(); + if (list.size() > 0) { + return list.get(0); + } else { + return null; + } + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void setPanel(AbstractPanel newPanel) { + EList list = getChildren(); + if (list.size() > 0) { + list.set(0, newPanel); + } else { + list.add(newPanel); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case DiPackage.WINDOW__POSITION: + if (resolve) { + return getPosition(); + } + return basicGetPosition(); + case DiPackage.WINDOW__SIZE: + if (resolve) { + return getSize(); + } + return basicGetSize(); + case DiPackage.WINDOW__PANEL: + if (resolve) { + return getPanel(); + } + return basicGetPanel(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case DiPackage.WINDOW__POSITION: + setPosition((Position) newValue); + return; + case DiPackage.WINDOW__SIZE: + setSize((Size) newValue); + return; + case DiPackage.WINDOW__PANEL: + setPanel((AbstractPanel) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DiPackage.WINDOW__POSITION: + setPosition((Position) null); + return; + case DiPackage.WINDOW__SIZE: + setSize((Size) null); + return; + case DiPackage.WINDOW__PANEL: + setPanel((AbstractPanel) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DiPackage.WINDOW__POSITION: + return position != null; + case DiPackage.WINDOW__SIZE: + return size != null; + case DiPackage.WINDOW__PANEL: + return basicGetPanel() != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated NOT + */ + @Override + public void replaceChild(AbstractPanel oldChild, AbstractPanel newChild) { + setPanel(newChild); + } + + +} // WindowImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java new file mode 100644 index 00000000000..afdb0e3da07 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiAdapterFactory.java @@ -0,0 +1,363 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage + * @generated + */ +public class DiAdapterFactory extends AdapterFactoryImpl { + + /** + * The cached model package. + * + * + * + * @generated + */ + protected static DiPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * + * @generated + */ + public DiAdapterFactory() { + if (modelPackage == null) { + modelPackage = DiPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * + * @generated + */ + protected DiSwitch modelSwitch = new DiSwitch() { + @Override + public Adapter caseSashModel(SashModel object) { + return createSashModelAdapter(); + } + + @Override + public Adapter caseWindow(Window object) { + return createWindowAdapter(); + } + + @Override + public Adapter casePanelParent(PanelParent object) { + return createPanelParentAdapter(); + } + + @Override + public Adapter caseAbstractPanel(AbstractPanel object) { + return createAbstractPanelAdapter(); + } + + @Override + public Adapter casePosition(Position object) { + return createPositionAdapter(); + } + + @Override + public Adapter caseSize(Size object) { + return createSizeAdapter(); + } + + @Override + public Adapter caseTabFolder(TabFolder object) { + return createTabFolderAdapter(); + } + + @Override + public Adapter casePageRef(PageRef object) { + return createPageRefAdapter(); + } + + @Override + public Adapter caseSashPanel(SashPanel object) { + return createSashPanelAdapter(); + } + + @Override + public Adapter caseAbstractPage(AbstractPage object) { + return createAbstractPageAdapter(); + } + + @Override + public Adapter casePageList(PageList object) { + return createPageListAdapter(); + } + + @Override + public Adapter caseSashWindowsMngr(SashWindowsMngr object) { + return createSashWindowsMngrAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * + * @param target + * the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject) target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashModel Sash Model}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashModel + * @generated + */ + public Adapter createSashModelAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Window Window}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Window + * @generated + */ + public Adapter createWindowAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent Panel Parent}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent + * @generated + */ + public Adapter createPanelParentAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel Abstract Panel}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel + * @generated + */ + public Adapter createAbstractPanelAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Position Position}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Position + * @generated + */ + public Adapter createPositionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.Size Size}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.Size + * @generated + */ + public Adapter createSizeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder Tab Folder}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder + * @generated + */ + public Adapter createTabFolderAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageRef Page Ref}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageRef + * @generated + */ + public Adapter createPageRefAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel Sash Panel}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel + * @generated + */ + public Adapter createSashPanelAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage Abstract Page}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage + * @generated + */ + public Adapter createAbstractPageAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.PageList Page List}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList + * @generated + */ + public Adapter createPageListAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr Sash Windows Mngr}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr + * @generated + */ + public Adapter createSashWindowsMngrAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} // DiAdapterFactory diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java new file mode 100644 index 00000000000..c90aebcb407 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceFactoryImpl.java @@ -0,0 +1,47 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.XMLResource; + +/** + * + * The Resource Factory associated with the package. + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiResourceImpl + * @generated + */ +public class DiResourceFactoryImpl extends ResourceFactoryImpl { + /** + * Creates an instance of the resource factory. + * + * + * + * @generated + */ + public DiResourceFactoryImpl() { + super(); + } + + /** + * Creates an instance of the resource. + * + * + * + * @generated + */ + @Override + public Resource createResource(URI uri) { + XMLResource result = new DiResourceImpl(uri); + return result; + } + +} // DiResourceFactoryImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java new file mode 100644 index 00000000000..a83026dd3cd --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiResourceImpl.java @@ -0,0 +1,34 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; + +/** + * + * The Resource associated with the package. + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiResourceFactoryImpl + * @generated + */ +public class DiResourceImpl extends XMIResourceImpl { + /** + * Creates an instance of the resource. + * + * + * + * @param uri + * the URI of the new resource. + * @generated + */ + public DiResourceImpl(URI uri) { + super(uri); + } + +} // DiResourceImpl diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java new file mode 100644 index 00000000000..6b9a49c3a8a --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src-gen/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiSwitch.java @@ -0,0 +1,424 @@ +/** + * + * + * + * $Id$ + */ +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent; +import org.eclipse.papyrus.infra.core.sashwindows.di.Position; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.Size; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage + * @generated + */ +public class DiSwitch extends Switch { + + /** + * The cached model package + * + * + * + * @generated + */ + protected static DiPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * + * @generated + */ + public DiSwitch() { + if (modelPackage == null) { + modelPackage = DiPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * + * @param ePackage + * the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case DiPackage.SASH_MODEL: { + SashModel sashModel = (SashModel) theEObject; + T result = caseSashModel(sashModel); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.WINDOW: { + Window window = (Window) theEObject; + T result = caseWindow(window); + if (result == null) { + result = casePanelParent(window); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.PANEL_PARENT: { + PanelParent panelParent = (PanelParent) theEObject; + T result = casePanelParent(panelParent); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.ABSTRACT_PANEL: { + AbstractPanel abstractPanel = (AbstractPanel) theEObject; + T result = caseAbstractPanel(abstractPanel); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.POSITION: { + Position position = (Position) theEObject; + T result = casePosition(position); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.SIZE: { + Size size = (Size) theEObject; + T result = caseSize(size); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.TAB_FOLDER: { + TabFolder tabFolder = (TabFolder) theEObject; + T result = caseTabFolder(tabFolder); + if (result == null) { + result = caseAbstractPanel(tabFolder); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.PAGE_REF: { + PageRef pageRef = (PageRef) theEObject; + T result = casePageRef(pageRef); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.SASH_PANEL: { + SashPanel sashPanel = (SashPanel) theEObject; + T result = caseSashPanel(sashPanel); + if (result == null) { + result = caseAbstractPanel(sashPanel); + } + if (result == null) { + result = casePanelParent(sashPanel); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.ABSTRACT_PAGE: { + AbstractPage abstractPage = (AbstractPage) theEObject; + T result = caseAbstractPage(abstractPage); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.PAGE_LIST: { + PageList pageList = (PageList) theEObject; + T result = casePageList(pageList); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DiPackage.SASH_WINDOWS_MNGR: { + SashWindowsMngr sashWindowsMngr = (SashWindowsMngr) theEObject; + T result = caseSashWindowsMngr(sashWindowsMngr); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Sash Model'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Sash Model'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSashModel(SashModel object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Window'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Window'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseWindow(Window object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Panel Parent'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Panel Parent'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePanelParent(PanelParent object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Abstract Panel'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Abstract Panel'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractPanel(AbstractPanel object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Position'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Position'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePosition(Position object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Size'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Size'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSize(Size object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Tab Folder'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Tab Folder'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTabFolder(TabFolder object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Page Ref'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Page Ref'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePageRef(PageRef object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Sash Panel'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Sash Panel'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSashPanel(SashPanel object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Abstract Page'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Abstract Page'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractPage(AbstractPage object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Page List'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Page List'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePageList(PageList object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Sash Windows Mngr'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Sash Windows Mngr'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSashWindowsMngr(SashWindowsMngr object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} // DiSwitch diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/AbstractLocalPageService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/AbstractLocalPageService.java new file mode 100644 index 00000000000..feba079f6c3 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/AbstractLocalPageService.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.service; + + +/** + * Basic implementation of the local page service which contains the root element that contains pages. + */ +public abstract class AbstractLocalPageService implements ILocalPageService { + + /** The root element. */ + protected Object rootElement = null; + + /** + * Constructor. + * + */ + public AbstractLocalPageService(Object rootElement) { + this.rootElement = rootElement; + } + + + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java new file mode 100644 index 00000000000..1ae2d42be6a --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java @@ -0,0 +1,398 @@ +/***************************************************************************** + * Copyright (c) 2013, 2016 Cedric Dumoulin, CEA, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 433371 + * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 415638 + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754 + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.osgi.framework.FrameworkUtil; + + +/** + * A basic implementation of the {@link IPageManager} service for manipulation of + * the sash model in a headless (non-UI) context. + * + * @author cedric dumoulin + * + */ +public class BasicPageManagerImpl implements IPageManager { + + /** Internal EMF model */ + private SashWindowsMngr diSashModel; + + /** + * Constructor. + * + * @param diSashModel + * The model onto which operation of this class act. + * + */ + public BasicPageManagerImpl(SashWindowsMngr diSashModel) { + super(); + + this.diSashModel = diSashModel; + } + + @Override + public void closePage(Object pageIdentifier) { + diSashModel.getSashModel().removePageAndEmptyFolder(pageIdentifier); + } + + @Override + public void closeAllOpenedPages() { + diSashModel.getSashModel().removeAllPages(); + } + + @Override + public void closeAllOpenedPages(Object pageIdentifier) { + while (isOpen(pageIdentifier)) { + closePage(pageIdentifier); + } + } + + @Override + public void closeOtherPages(Object pageIdentifier) { + diSashModel.getSashModel().removeOtherPages(pageIdentifier); + } + + @Override + @Deprecated + public void addPage(Object pageIdentifier) { + if (isLegacyMode()) { + diSashModel.getPageList().addPage(pageIdentifier); + } + } + + @SuppressWarnings("deprecation") + private void doAddPage(Object pageIdentifier) { + if (isLegacyMode()) { + diSashModel.getPageList().addPage(pageIdentifier); + } + diSashModel.getSashModel().addPage(getCurrentFolder(), pageIdentifier); + } + + @SuppressWarnings("deprecation") + private void doAddPage(PageRef page) { + if (isLegacyMode()) { + diSashModel.getPageList().addPage(page.getPageIdentifier()); + } + diSashModel.getSashModel().addPage(getCurrentFolder(), page); + } + + /** + * Remove a page. + * + * @param pageIdentifier + * identifies the page to remove + * + * @deprecated Use the {@linkplain #closeAllOpenedPages(Object)} method, instead + */ + @Deprecated + public void removePage(Object pageIdentifier) { + closeAllOpenedPages(pageIdentifier); + if (isLegacyMode()) { + diSashModel.getPageList().removePage(pageIdentifier); + } + } + + /** + * Reload the Diagram + * This used when a resource is reloaded, the related diagrams are reloaded as well + * + * @see org.eclipse.papyrus.infra.services.controlmode.listener.LoadResourceSnippet + * + * @param diagramProxy + * Identifier of the page to reload + */ + @Override + public void reloadPage(Object diagramProxy) { + + if (diagramProxy instanceof EObject) { + + PageRef proxyRef = diSashModel.getSashModel().lookupPage(diagramProxy); + + if (proxyRef.eContainer() instanceof TabFolder) { + TabFolder folder = (TabFolder) proxyRef.eContainer(); + + + if (folder != null) { + if (folder.getChildren() != null) { + // get the initial index of the Diagram Tab + int i = folder.getChildren().indexOf(proxyRef); + + if (i >= 0) { + // Create a new Page + PageRef newRef = DiFactory.eINSTANCE.createPageRef(); + newRef.setEmfPageIdentifier((EObject) diagramProxy); + // Replace the previous by the new one + folder.getChildren().set(i, newRef); + } + } + } + } + } + } + + @Override + public List allPages() { + List result; + + if (isLegacyMode()) { + result = legacyAllPages(); + } else { + // FIXME: Temporary, naive code. Need to implement a mechanism to contribute page providers + result = new ArrayList<>(); + + List notationResources = getResources("notation"); + for (Resource notationResource : notationResources) { + for (EObject content : notationResource.getContents()) { + if (isPage(content)) { + result.add(content); + } + } + } + } + + return result; + } + + @SuppressWarnings("deprecation") + protected boolean isLegacyMode() { + return diSashModel.getPageList() != null; + } + + @SuppressWarnings("deprecation") + private List legacyAllPages() { + List result; + + if (diSashModel.getPageList() != null) { + result = diSashModel.getPageList().getAvailablePage().stream() + .map(PageRef::getPageIdentifier) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } else { + result = new ArrayList<>(0); + } + + return result; + } + + /** + * Gets the local pages. + * + * @param model + * the model + * @return the local pages + * @see org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager#allLocalPages() + */ + @Override + public List allLocalPages(ILocalPageService service) { + List result = new LinkedList(); + + for (Object next : allPages()) { + if (service.isLocalPage(next)) { + result.add(next); + } + } + + return result; + } + + + /** + * + * @see org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager#getAssociatedPages(org.eclipse.emf.common.util.URI) + * + * @param uriTrim + * @return + */ + @Override + public List getAssociatedPages(Object uriTrim) { + + List list = new ArrayList(); + + SashModel sashModel = diSashModel.getSashModel(); + Iterator iter = sashModel.eAllContents(); + + while (iter.hasNext()) { + Object next = iter.next(); + if (next instanceof PageRef) { + PageRef pageRef = (PageRef) next; + + // pageRef is one of the pages referred into the sash resource + if (pageRef != null) { + EObject pageID = pageRef.getEmfPageIdentifier(); + if (pageID != null) { + URI uriContainer; + if (pageID.eIsProxy()) { + InternalEObject internal = (InternalEObject) pageID; + uriContainer = internal.eProxyURI().trimFragment().trimFileExtension(); + + } else { + uriContainer = pageID.eResource().getURI().trimFileExtension(); + } + if (uriTrim instanceof URI) { + if (uriContainer.equals(uriTrim)) { + list.add(pageID); + } + } + } + } + + } + + } + return list; + } + + /** + * Gets the resources. + * + * @param fileExtension + * the file extension + * @return the resources + */ + private List getResources(String fileExtension) { + List resourcesList = new LinkedList(); + + // Get the contextual resources from the sash model + ResourceSet resourceSet = diSashModel.eResource().getResourceSet(); + for (Resource resource : resourceSet.getResources()) { + + // Verify if the resource exist and is loaded + if (resource != null && resource.isLoaded()) { + // Verify if its extension correspond + if (fileExtension.equals(resource.getURI().fileExtension())) { + resourcesList.add(resource); + } + + } + } + + return resourcesList; + } + + /** + * Checks if is page. + * + * @param content + * the content + * @return true, if is page + */ + protected boolean isPage(EObject content) { + // In the headless context, anything can be a page + return true; + } + + /** + * Obtains the currently active tab folder, whatever that might mean in the + * context of the page manager. + * + * @return the current folder, never {@code null} because at least one folder always + * implicitly exists + */ + protected TabFolder getCurrentFolder() { + TabFolder result = diSashModel.getSashModel().getCurrentSelection(); + + return result; + } + + @Override + public boolean isOpen(Object pageIdentifier) { + return diSashModel.getSashModel().lookupPage(pageIdentifier) != null; + } + + @Override + public void openPage(Object pageIdentifier) { + doAddPage(pageIdentifier); + } + + @Override + public void openPage(Object pageIdentifier, String editorID) { + PageRef newPage = DiFactory.eINSTANCE.createPageRef(); + newPage.setFavoriteEditor(editorID); + newPage.setPageIdentifier(pageIdentifier); + doAddPage(newPage); + } + + @Override + public void selectPage(final Object pageIdentifier) { + // In an headless context, there is no sensible realization of the "active page" + } + + /** + * Executes an operation on my internal sash model. + * + * @param + * the generic type + * @param sashModelOperation + * the operation to execute + * @return the operation's result + * @throws IllegalAccessException + * on attempt to execute an operation defined by a client bundle + */ + public T execute(SashModelOperation sashModelOperation) throws IllegalAccessException { + if (FrameworkUtil.getBundle(sashModelOperation.getClass()) != FrameworkUtil.getBundle(BasicPageManagerImpl.class)) { + throw new IllegalAccessException("Attempt to access bundle-private API."); //$NON-NLS-1$ + } + + return doExecute(sashModelOperation); + } + + protected T doExecute(SashModelOperation sashModelOperation) { + return sashModelOperation.execute(diSashModel); + } + + // + // Private interfaces + // + + /** + * An operation on the internal sash model of a page manager. + * + * @param + * the generic type + */ + @FunctionalInterface + public static interface SashModelOperation { + + /** + * Execute. + * + * @param sashWindowsManager + * the sash windows manager + * @return the t + */ + T execute(SashWindowsMngr sashWindowsManager); + } + +} \ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/ILocalPageService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/ILocalPageService.java new file mode 100644 index 00000000000..1dacbea2468 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/ILocalPageService.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Pascual (ALL4TEC) gabriel.pascual - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.service; + + +/** + * Service for PageManager to determine local page. + * + * @author Gabriel Pascual + * + */ +public interface ILocalPageService { + + + /** + * Checks if is local page. + * + * @param content + * the content + * @return true, if is local page + */ + boolean isLocalPage(Object content); + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/IPageManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/IPageManager.java new file mode 100644 index 00000000000..47bf47e9ef7 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/IPageManager.java @@ -0,0 +1,172 @@ +/***************************************************************************** + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754 + * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 415638 + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sashwindows.di.service; + +import java.util.List; + +/** + *

+ * Interface providing method to manage pages in the Sash Windows system. + * This interface can be provided by a ContentProvider wishing to provide a standard + * way to manage pages. This interface is not mandatory for the Sash Editor. + *

+ *

+ * This interface provide basic access to the Sash Windows system. + * It is intended to be used from the application in order to interact with the ContentProvider. + * Then, the implementation of the editor UI will refresh its views. + *

+ * + * @author dumoulin + */ +public interface IPageManager { + + /** + * Add a Page identifier to the list of pages, do not open it. + * + * @param page + * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This + * identifier is stored in the sash model. + * It should be a reference on a EMF object identifying the page. + * @deprecated The pages are now computed dynamically + */ + @Deprecated + public void addPage(Object pageIdentifier); + + /** + * Reload the Diagram + * This used when a resource is reloaded, the related diagrams are reloaded as well + * + * @see org.eclipse.papyrus.infra.services.controlmode.listener.LoadResourceSnippet + * + * @param pageIdentifier + * Identifier of the page to reload + */ + public void reloadPage(Object pageIdentifier); + + /** + * Close the page corresponding to the identifier. + * The identifier is removed from the Sash Windows, but not from the list of pages. + * + * If the page is open more than once on the current Sash windows, only + * one instance will be closed. + * + * @param pageIdentifier + * The object identifying the page + * + * + * @see {@link #closeAllOpenedPages(Object)} + */ + public void closePage(Object pageIdentifier); + + + /** + * Close all opened pages. + * + */ + public void closeAllOpenedPages(); + + /** + * Close all opened pages except the one provided as parameter. + * + * @param pageIdentifier + */ + public void closeOtherPages(Object pageIdentifier); + + /** + * Open a Page corresponding to the identifier. If the page is not in the list of pages, add it. + * The identifier is first added to the current folder model. Then the Sash Windows should react and + * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the + * SWT page. + * + * @param page + * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This + * identifier is stored in the sash model. + * It should be a reference on a EMF object identifying the page. + */ + public void openPage(Object pageIdentifier); + + /** + * Open a Page corresponding to the identifier. + * The identifier is first added to the current folder model. Then the Sash Windows should react and + * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the + * SWT page. + * + * The specified EditorID will be propagated to the {@link IPageModelFactory} to open the right editor + * + * @param page + * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This + * identifier is stored in the sash model. + * It should be a reference on a EMF object identifying the page. + */ + default void openPage(Object pageIdentifier, String editorID) { + openPage(pageIdentifier); + } + + /** + * Return all available page identifiers (open and closed pages). + * + * @return List of registered page identifiers. + */ + public List allPages(); + + /** + * Gets the local pages of a main model. + * + * @param mainModel + * the main model + * @param service + * the service to determine what is a local page + * @return the local pages + */ + public List allLocalPages(ILocalPageService service); + + /** + * Return true if a page is open for the specified pageIdentifier. + * + * @param diagram + * @return + */ + public boolean isOpen(Object pageIdentifier); + + /** + * Remove all pages used to render the specified pageIndentifier. + * If the pageIdentifier has more than one page rendering it, each of these + * pages are closed. + * + * @param pageIdentifier + */ + public void closeAllOpenedPages(Object pageIdentifier); + + /** + * Select the first page used to render the specified pageIdentifier. + * Do nothing if this page identifier is not rendered. + * + * @param pageIdentifier + */ + public void selectPage(Object pageIdentifier); + + /** + * Get the open pages associated to the passed Object + * + * @param uri + * URI of the Object from which we want the associated open pages + * @return List of Pages identifier of the related object'URI + */ + public List getAssociatedPages(Object uri); + + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java new file mode 100644 index 00000000000..bda023bb7b0 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/CompositePageRemovalValidator.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import java.util.Collection; + +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; + +/** + * A composition of two or more {@link PageRemovalValidator}s. + */ +class CompositePageRemovalValidator implements PageRemovalValidator { + + private final PageRemovalValidator one; + private final PageRemovalValidator two; + + CompositePageRemovalValidator(PageRemovalValidator one, PageRemovalValidator two) { + super(); + + this.one = one; + this.two = two; + } + + @Override + public boolean canRemovePage(PageRef page) { + return one.canRemovePage(page) && two.canRemovePage(page); + } + + @Override + public Collection filterRemovablePages(Collection pages) { + return two.filterRemovablePages(one.filterRemovablePages(pages)); + } +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java new file mode 100644 index 00000000000..9161ebbdbfb --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java @@ -0,0 +1,298 @@ +/***************************************************************************** + * Copyright (c) 2009 CEA LIST & LIFL + * + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Emilien Perico emilien.perico@atosorigin.com - add methods to manage di resource + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.Window; +import org.eclipse.papyrus.infra.core.sashwindows.di.exception.SashEditorException; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl.SashModelOperation; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; + + +/** + * Set of utility methods + * + * @author dumoulin + */ +public class DiUtils { + + /** + * Create a default SashModel with one window and one folder. + * Set the current folder. + * + * @param diResource + * @return + */ + static public SashModel createDefaultSashModel() { + + // SashModel + SashModel sashModel = DiFactory.eINSTANCE.createSashModel(); + Window window = DiFactory.eINSTANCE.createWindow(); + sashModel.getWindows().add(window); + + TabFolder folder = DiFactory.eINSTANCE.createTabFolder(); + window.setPanel(folder); + // Default folder + sashModel.setCurrentSelectionSilently(folder); + + return sashModel; + } + + /** + * Create a default SashWindowsMngr with one PageLit and one default SashModel. + * Set the current folder. + * + * @param diResource + * @return + */ + static public SashWindowsMngr createDefaultSashWindowsMngr() { + SashWindowsMngr model; + + model = DiFactory.eINSTANCE.createSashWindowsMngr(); + + // SashModel + SashModel layout = createDefaultSashModel(); + + model.setSashModel(layout); + return model; + } + + /** + * Lookup for the SashModel object in the resource. + * + * @param diResource + * @return The {@link DiSashModel} or null if not found. + */ + static public SashWindowsMngr lookupSashWindowsMngr(Resource diResource) { + + for (Object node : diResource.getContents()) { + if (node instanceof SashWindowsMngr) { + return (SashWindowsMngr) node; + } + } + return null; + } + + /** + * Lookup for the current selection TabFolder object in the resource. + * + * @param diResource + * @return The {@link TabFolder} or null if not found. + */ + static public TabFolder lookupCurrentTabFolderSelection(Resource diResource) { + SashWindowsMngr lookupSashWindowsMngr = lookupSashWindowsMngr(diResource); + if (lookupSashWindowsMngr != null) { + SashModel sashModel = lookupSashWindowsMngr.getSashModel(); + if (sashModel != null) { + return sashModel.getCurrentSelection(); + } + } + return null; + } + + /** + * Gets the page reference of the specified eObject + * + * @param diResource + * @param eObject + * + * @return the page ref of eObject, null if not found + * TODO This method use too low level mechanism for its implementation. Consider to move it in a + * more appropriate class. Furthermore, some similar methods already exist. Can't we use them + * instead ? + * + * @deprecated Should use IPageMngr instead. + */ + @Deprecated + static public PageRef getPageRef(Resource diResource, EObject eObject) { + SashWindowsMngr windowsMngr = lookupSashWindowsMngr(diResource); + if (windowsMngr != null && windowsMngr.getPageList() != null) { + + for (PageRef pageRef : windowsMngr.getPageList().getAvailablePage()) { + + EObject emfPageIdentifier = pageRef.getEmfPageIdentifier(); + if (eObject != null && eObject.equals(emfPageIdentifier)) { + return pageRef; + } + } + } + return null; + } + + /** + * Adds page to the page list of the sash windows manager + * + * @param diResource + * @param pageRef + * @throws SashEditorException + * TODO This method use too low level mechanism for its implementation. Consider to move it in a + * more appropriate class. Furthermore, some similar methods already exist. Can't we use them + * instead ? + * @deprecated Should use IPageMngr instead. + */ + @Deprecated + static public void addPageToPageList(Resource diResource, PageRef pageRef) throws SashEditorException { + // Do nothing. The page list is not used anymore + } + + /** + * Adds page to the page list of the sash windows manager. + * + * @param pageRef + * @param windowsMngr + * @throws SashEditorException + * TODO This method use too low level mechanism for its implementation. Consider to move it in a + * more appropriate class. Furthermore, some similar methods already exist. Can't we use them + * instead ? + * + * @deprecated Should use IPageMngr instead. + */ + @Deprecated + static public void addPageToPageList(SashWindowsMngr windowsMngr, PageRef pageRef) throws SashEditorException { + // Do nothing. The page list is not used anymore + } + + /** + * Adds page to tab folder. + * + * @param windowsMngr + * @param pageRef + * @throws SashEditorException + * TODO This method use too low level mechanism for its implementation. Consider to move it in a + * more appropriate class. Furthermore, some similar methods already exist. Can't we use them + * instead ? + * + * @deprecated Should use IPageMngr instead. + */ + @Deprecated + static public void addPageToTabFolder(SashWindowsMngr windowsMngr, PageRef pageRef) throws SashEditorException { + + // Check parameters + if (pageRef == null || pageRef.getPageIdentifier() == null) { + throw new SashEditorException("Unable to add the page to the tab folder: parameters are null"); + } + + SashModel sashModel = windowsMngr.getSashModel(); + if (sashModel == null) { + throw new SashEditorException("Unable to add the page to the tab folder: can't find SashModel"); + } + + // Get the currently active folder in order to add the page. + TabFolder tabFolder = sashModel.getCurrentSelection(); + if (tabFolder == null) { + throw new SashEditorException("Unable to add the page to the tab folder: No active folder"); + } + + tabFolder.addPage(pageRef.getPageIdentifier()); + } + + /** + * Obtains a command that will close all of the pages in the given {@code pageManager} that reference the specified {@code pageIdentifier}, + * regardless of whether they still reference that identifier at the time of execution (this is the "memoization"). + * + * @param domain + * the editing domain in which the command will be executed + * @param pageManager + * the page manager for which to construct the command + * @param pageIdentifier + * the identifier of the page(s) to be removed + * + * @return the memoized close-all-pages command, or {@code null} if there are no pages to close + */ + public static Command getMemoizedCloseAllPagesCommand(final TransactionalEditingDomain domain, final IPageManager pageManager, final Object pageIdentifier) { + Command result = null; + + final BasicPageManagerImpl pageMan = (BasicPageManagerImpl) pageManager; + + final Map pages = execute(pageMan, new SashModelOperation>() { + + @Override + public Map execute(SashWindowsMngr sashWindowsManager) { + return new DiSwitch>() { + + private Map pages = new HashMap(); + + @Override + public Map defaultCase(EObject object) { + for (EObject next : object.eContents()) { + doSwitch(next); + } + return pages; + } + + @Override + public Map casePageRef(PageRef object) { + if (object.getPageIdentifier() == pageIdentifier) { + pages.put(object, object.getParent()); + } + return pages; + } + }.doSwitch(sashWindowsManager.getSashModel()); + } + }); + + if (!pages.isEmpty()) { + final SashModelOperation removeOp = new SashModelOperation() { + + @Override + public Void execute(SashWindowsMngr sashWindowsManager) { + SashModel sashModel = sashWindowsManager.getSashModel(); + for (Map.Entry next : pages.entrySet()) { + PageRef page = next.getKey(); + TabFolder folder = next.getValue(); + + folder.getChildren().remove(page); + sashModel.removeEmptyFolder(folder); + } + return null; + } + }; + + result = new RecordingCommand(domain, "Remove Editor Page(s)") { //$NON-NLS-1$ + + @Override + protected void doExecute() { + DiUtils.execute(pageMan, removeOp); + } + }; + } + + return result; + } + + private static T execute(BasicPageManagerImpl pageManager, SashModelOperation sashOperation) { + try { + return pageManager.execute(sashOperation); + } catch (IllegalAccessException e) { + // Won't happen because this is our own operation + throw new IllegalAccessError(e.getLocalizedMessage()); + } + } + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java new file mode 100644 index 00000000000..13746ad2f59 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/PageRemovalValidator.java @@ -0,0 +1,93 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sashwindows.di.util; + +import java.util.Collection; +import java.util.stream.Collectors; + +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; + +/** + * A protocol for an adapter that can be attached to the Sash model to validate + * the closing of pages. + */ +@FunctionalInterface +public interface PageRemovalValidator { + /** A validator that always permits removing the page. */ + PageRemovalValidator ALWAYS_REMOVE = new PageRemovalValidator() { + + @Override + public boolean canRemovePage(PageRef page) { + return true; + } + + @Override + public Collection filterRemovablePages(Collection pages) { + return pages; + } + }; + + /** + * Queries whether the given page may be closed. + * + * @param page + * the page to be closed + * + * @return whether the page may be closed + */ + boolean canRemovePage(PageRef page); + + /** + * Filters a set of pages to be closed, returning those that actually may be closed. + * This accounts for the possibility where a page may be closeable on its own, + * but not if some other pages are also to be closed. + * + * @param pages + * a collection of pages to be closed + * + * @return the subset (possibly all or none) of the pages that may be closed + */ + default Collection filterRemovablePages(Collection pages) { + return pages.stream().filter(this::canRemovePage).collect(Collectors.toList()); + } + + /** + * Composes myself with an{@code other} removal validator. + * + * @param other + * another removal validator + * + * @return a removal validator that applies my filtering and the {@code other}'s, both + */ + default PageRemovalValidator compose(PageRemovalValidator other) { + return new CompositePageRemovalValidator(this, other); + } + + /** + * Obtains the page removal validator for the given {@code notifier}. + * + * @param notifier + * an element of (usually) the Sash model + * + * @return the appropriate removal validator, never {@code null} (though perhaps the + * {@link #ALWAYS_REMOVE} instance) + */ + static PageRemovalValidator getInstance(Notifier notifier) { + return notifier.eAdapters().stream() + .filter(PageRemovalValidator.class::isInstance).map(PageRemovalValidator.class::cast) + .reduce(PageRemovalValidator::compose) + .orElse(ALWAYS_REMOVE); + } +} 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 cca54b93d36..a7f9bade242 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 @@ -1,39 +1,29 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.core, org.eclipse.papyrus.infra.core.clipboard, - org.eclipse.papyrus.infra.core.contentoutline, org.eclipse.papyrus.infra.core.editor, - org.eclipse.papyrus.infra.core.editor.reload, - org.eclipse.papyrus.infra.core.editorsfactory, org.eclipse.papyrus.infra.core.extension, - org.eclipse.papyrus.infra.core.extension.commands, - org.eclipse.papyrus.infra.core.extension.diagrameditor, - org.eclipse.papyrus.infra.core.internal.commands;x-internal:=true, - org.eclipse.papyrus.infra.core.internal.preferences;x-internal:=true, + org.eclipse.papyrus.infra.core.internal.sashmodel;x-internal:=true, org.eclipse.papyrus.infra.core.language, - org.eclipse.papyrus.infra.core.lifecycleevents, org.eclipse.papyrus.infra.core.listenerservice, org.eclipse.papyrus.infra.core.markers, org.eclipse.papyrus.infra.core.modelsetquery, org.eclipse.papyrus.infra.core.modelsetquery.impl;x-friends:="org.eclipse.papyrus.uml.resourceloading.profile", - org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor, org.eclipse.papyrus.infra.core.operation, org.eclipse.papyrus.infra.core.resource, org.eclipse.papyrus.infra.core.resource.additional, org.eclipse.papyrus.infra.core.resource.sasheditor, org.eclipse.papyrus.infra.core.services, + org.eclipse.papyrus.infra.core.services.spi, org.eclipse.papyrus.infra.core.utils -Require-Bundle: org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0";visibility:=reexport, - org.eclipse.core.runtime, - org.eclipse.ui.ide;bundle-version="3.8.0", - org.eclipse.emf.edit.ui;bundle-version="2.8.0", +Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", - org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300", - org.eclipse.gef;bundle-version="3.8.1", org.eclipse.emf.workspace;bundle-version="1.5.1", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.core.filesystem + org.eclipse.core.filesystem, + org.eclipse.emf.ecore.xmi;bundle-version="2.12.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/build.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core/build.properties index c7d739adfb7..a192f915df4 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/build.properties +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/build.properties @@ -1,6 +1,6 @@ # #Mon Sep 12 09:29:37 CEST 2011 -bin.includes=META-INF/,.,plugin.xml,schema/,plugin.properties,.options,icons/,about.ini,about.properties,about.html +bin.includes=META-INF/,.,plugin.xml,schema/,plugin.properties,.options,about.ini,about.properties,about.html output..=bin/ src.includes = about.html source..=src/ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/PapyrusLogo32x32.png b/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/PapyrusLogo32x32.png deleted file mode 100644 index 57e441b344c..00000000000 Binary files a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/PapyrusLogo32x32.png and /dev/null differ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/Papyrus_32x32_t.gif b/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/Papyrus_32x32_t.gif deleted file mode 100644 index 50cd9a142ee..00000000000 Binary files a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/32x32/Papyrus_32x32_t.gif and /dev/null differ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus.gif b/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus.gif deleted file mode 100644 index 8a31f458379..00000000000 Binary files a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus.gif and /dev/null differ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus_16x16.gif b/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus_16x16.gif deleted file mode 100644 index 8a31f458379..00000000000 Binary files a/plugins/infra/core/org.eclipse.papyrus.infra.core/icons/papyrus/Papyrus_16x16.gif and /dev/null differ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml index 2879ff91084..06e5a11d674 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml @@ -1,213 +1,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/contentOutline.exsd b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/contentOutline.exsd deleted file mode 100644 index 2d9c56c7a7f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/contentOutline.exsd +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Specify the content outline to be used by the Papyrus backbone. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A human readable description. - - - - - - - The class implementing the contentOutline. -Class must extends org.eclipse.papyrus.infra.core.contentoutline.IPapyrusContentOutlinePage. - - - - - - - - - - An integer value representing the priority of the contentOutline. -Only one contentOutline is shown. The one with the highest priority is choosen. - - - - - - - ID of the ActionBarContributor requested by the outline. -The ID must match a declared ActionBarContributor. -If no ID is set, use the main ActionBarContributor (the one associated to the MultiEditor). - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - /******************************************************************************* - * Copyright (c) 2008 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: - * CEA List - initial API and implementation - *******************************************************************************/ - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/papyrusDiagram.exsd b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/papyrusDiagram.exsd deleted file mode 100644 index 8d350e3cccc..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/papyrusDiagram.exsd +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - <p> -The <code>org.eclipse.papyrus.infra.core.papyrusDiagram</code> extension point is used to register a new diagram editor within Papyrus. Once diagram editor is registered it can be used in the Papyrus multi-page diagram editor. The editor can have its own icon, label, a button for the creation action in the toolbar, and the possibility to be created using new Papyrus Model wizard. -</p> - -<p>Papyrus uses the term "<b>Diagram Category</b>" to categorize domain models and the term "<b>Diagram Kind</b>" to specialize a diagram editor for a domain model. Each Diagram Kind belongs to exactly one Diagram Category, Diagram Category can contains many Diagram Kinds. Papyrus supports <b>UML</b>, <b>Profile</b> and <b>SysML</b> diagram categories. -</p> - -<p>Besides, for a given diagram category the user can specify template models - a predefined model whose content is copied into a newly created diagram. Templates can be registered using <code>org.eclipse.papyrus.wizards.templates</code> extension point. Diagram kinds and available templates are filtered in the wizard in accordance with the chosen category. For example, if the user choses <i>Profile</i> category, then only Profile diagram kind are available on DiagramKindPage and only ProfileWithBasicTypes template is displayed in the list of available templates. -</p> - -<p>The user is free to use the already existing diagram categories as well as implement his own. -</p> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A diagram editor that can be used in the Papyrus multi-page diagram editor. - - - - - - - a name of the fully qualified class that implements <samp> org.eclipse.papyrus.infra.core.sasheditor.extension.IEditorFactory</samp>. It is used to create an instance of the editor. - - - - - - - - - - The ID of an ActionBarContributor. If no ID is set, the main ActionBarContributor is used (the one associated to the MultiEditor). - - - - - - - a relative path of an icon used to visually represent the diagram in outline tree. The path is relative to the location of the plugin.xml file of the contributing plug-in. - - - - - - - - - - The order of this factory. The order is used when several factories can handle the same element. An order of 0 is a very high priority, whereas an order of 50 is lower. Factories with a higher order (lower priority) can still be used e.g. via the Open with... menu - - - - - - - - - - A ActionBarContributor defines the actions for one or more editors or Views. - - - - - - - a unique identifier used as a reference for this ActionBarContributor. It is used to associate the ActionBarContributor to editors(see <code>actionBarContributorId</code> attribute of <code>editorDiagram</code> extension point) - - - - - - - a name of the fully qualified class that implements <samp>org.eclipse.ui.IEditorActionBarContributor</samp>. - - - - - - - - - - - - - A "creationCommand" is a command used to create a new diagram. - - - - - - - a unique identifier used as a reference for this creation command. - - - - - - - - - - a translatable name of the creation command. It is displayed in the toolbar as a button text of CreateDiagramAction, this label is also i the New Wizard while selecting the Diagram Kind. - - - - - - - a name of the fully qualified class that implements <samp>org.eclipse.papyrus.commands.ICreationCommand</samp>. - - - - - - - - - - a relative path of an icon used to visually represent the command. The path is relative to the location of the plugin.xml file of the contributing plug-in. - - - - - - - - - - the action in the diagram creation menu is disabled if this condition is evaluated to false. - - - - - - - - - - the id of a diagramCategory the creation command belongs to. - - - - - - - - - - - - - The category of a domain model. The registered category is available in New papyrus Model Wizard and it customizes creation of a domain model. It is also used to filter diagram kinds and model templates. - - - - - - - a unique identifier used as a reference for this diagram category. It is used to filter model templates and diagram kinds. - - - - - - - a name of the fully qualified class that implements <samp>org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand</samp>. - - - - - - - - - - the file extension. - - - - - - - a translatable name of the diagram category, it is displayed in the New Papyrus Model Wizard to select a Diagram Category. - - - - - - - a description of the diagram category is to be displayed as a tooltip next ti its label. - - - - - - - a relative path of an icon used to visually represent the diagram category. The path is relative to the location of the plugin.xml file of the contributing plug-in. - - - - - - - - - - - - - - - 0.7 - - - - - - - - - <pre> -<extension point="org.eclipse.papyrus.infra.core.papyrusDiagram"> - <diagramCategory - id="sysml" - class="org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand" - label="SysML" - description="SysML diagrams" - icon="icons/category_sysml.gif"> - </diagramCategory> - - <editorDiagram - actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor" - factoryClass="org.eclipse.papyrus.sysml.diagram.requirement.RequirementDiagramEditorFactory" - icon="icons/obj16/Diagram_Requirement.gif"> - </editorDiagram> - - <creationCommand - id="org.eclipse.papyrus.sysml.diagram.requirement.CreateCommand" - creationCommandClass="org.eclipse.papyrus.sysml.diagram.requirement.RequirementDiagramCreateCommand" - icon="icons/obj16/Diagram_Requirement.gif" - label="SysML Requirement Diagram" - language="sysml"> - </creationCommand> -</extension> -</pre> -In this example, a specific editor for SysML Requirement diagram is registered. -Besides, a diagram category for SysML diagrams is defined, it has <code>sysml</code> id. The category specifies a customized creation command <code>org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand</code> which applies a profile to the newly-created model. In this example, the category <code>sysml</code> containes only one diagram kind - Requirement diagram created with <code>org.eclipse.papyrus.sysml.diagram.requirement.CreateCommand</code>, but it can be used by other diagrams as well. -As Requirement diagram belongs to SysML category it will be created with a SysML profile applied to its root. - - - - - - - - - <p>The value of the <code>class</code> attribute of <code>diagramCategory</code> must represent a class that implements the <code>org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand</code> interface. There are a few default implementations of <code>IModelCreationCommand</code> that may be useful to users of this extension point: -<ul> -<li><code>org.eclipse.papyrus.commands.ModelCreationCommandBase</code> - an abstract implementation of a basic <code>IModelCreationCommand</code>.</li> -<li><code>org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand</code></li> - implementation of IModelCreationCommand that creates a UML model. -<li><code>org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand</code> - a subclass of CreateUMLModelCommand which creates Profile as a root element</li> -<li><code>org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand</code> - a subclass of CreateUMLModelCommand which applies SysML profile to the root element</li> -</ul> -</p> - -<p>The value of the <code>creationCommandClass</code> attribute of <code>creationCommand</code> - must represent a class that implements the <code>org.eclipse.papyrus.commands.ICreationCommand</code> interface. -<ul> -<li><code>org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler</code> - an abstract implementation of a basic <code>ICreationCommand</code> for GMF diagrams. All CreationCommands for Papyrus diagrams extend this class.</li> -</ul> -</p> - - - - - - - - - - Copyright (c) 2008, 2010 CEA List.<br> -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 <a -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - - - - diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/readme.txt b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/readme.txt deleted file mode 100644 index 381d7f1d4f0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ -nestedEditor.exsd is an example of schema that should be provided by plugin using -the multidiagrams extension mechanism. -Each multi-editor wanting to have auto plugable diagram should declare in its own plugin.xml the -extension point referencing a copy of nestedEditor.exsd. This copy should be in the same plugin -has the new multi-editor. \ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/Activator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/Activator.java index c7e3f64626d..11fe67ac9f6 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/Activator.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/Activator.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2008 CEA LIST. - * + * Copyright (c) 2008, 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 @@ -9,18 +8,21 @@ * * Contributors: * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.core; +import org.eclipse.core.runtime.Plugin; import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.papyrus.infra.core.services.spi.IContextualServiceRegistryTracker; import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; /** * The activator class controls the plug-in life cycle */ -public class Activator extends AbstractUIPlugin { +public class Activator extends Plugin { // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.core"; @@ -31,36 +33,30 @@ public class Activator extends AbstractUIPlugin { /** Logging helper */ public static LogHelper log; + private ServiceTracker serviceRegistryTrackerTracker; + /** * The constructor */ public Activator() { } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; // register the log helper log = new LogHelper(this); + + serviceRegistryTrackerTracker = new ServiceTracker<>(context, IContextualServiceRegistryTracker.class, null); + serviceRegistryTrackerTracker.open(); } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ @Override public void stop(BundleContext context) throws Exception { + serviceRegistryTrackerTracker.close(); + serviceRegistryTrackerTracker = null; + plugin = null; log = null; super.stop(context); @@ -75,4 +71,13 @@ public class Activator extends AbstractUIPlugin { return plugin; } + /** + * Obtain the instance of the contextual service-registry tracker service, if any. + * + * @return the service-registry tracker service, or {@code null} if none (probably + * because there is no UI and, therefore, no user to be editing any Papyrus models) + */ + public IContextualServiceRegistryTracker getContextualServiceRegistryTracker() { + return serviceRegistryTrackerTracker.getService(); + } } diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/ContentOutlineRegistry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/ContentOutlineRegistry.java deleted file mode 100644 index 51ce4231190..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/ContentOutlineRegistry.java +++ /dev/null @@ -1,263 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.contentoutline; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.extension.BadClassNameException; -import org.eclipse.papyrus.infra.core.extension.NotFoundException; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.EditorDescriptorExtensionFactory; -import org.osgi.framework.Bundle; - -public class ContentOutlineRegistry { - - /** ID of the editor extension (schema filename) */ - public static final String EDITOR_EXTENSION_ID = "papyrusContentOutline"; - - private static String classAttributeName = "class"; - - private static String actionBarContributorIdPropertyName = "actionBarContributorId"; - - /** Namespace where to look for the extension points. */ - protected String extensionPointNamespace; - - /** - * The selected content outline. - */ - protected IPapyrusContentOutlinePage contentOutline; - - /** - * Associated editor. - */ - private IMultiDiagramEditor multiEditor; - - /** - * Constructor. defaultContext, input and site are explicitly required in - * order be sure that they are initialized. The multiEditor should be - * initialized. In particular, getEditorSite(), getEditorInput() and - * getDefaultContext() should return initialized values. - * - * @param multiEditor - * @param defaultContext - * @param input - * @param site - * @param extensionPointNamespace - */ - public ContentOutlineRegistry(IMultiDiagramEditor multiEditor, String extensionPointNamespace) { - this.multiEditor = multiEditor; - this.extensionPointNamespace = extensionPointNamespace; - } - - /** - * Returns the single instance of the content outline. Creates one if - * necessary. - * - * @return the contentOutline the single instance of the content outline - * @throws BackboneException - * exception thrown when the outline can not be created. - */ - public IPapyrusContentOutlinePage getContentOutline() throws BackboneException { - if (contentOutline == null) { - createContentOutline(); - } - return contentOutline; - } - - /** - * Return the {@link ContentOutlineDescriptor} with the highest priority. - * - * @return - * @throws BackboneException - * @throws NotFoundException - * If no ContentOutline can be found in extensions - */ - private ContentOutlineDescriptor getContentOutlineDescriptor() throws BackboneException { - IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); - ContentOutlineDescriptor found = null; - - // look for the one with the highest priority - for (IConfigurationElement ele : configElements) { - ContentOutlineDescriptor desc = new ContentOutlineDescriptor(ele); - if (desc.isHigher(found)) { - found = desc; - } - } - - // Instanciate the object - if (found == null) { - throw new NotFoundException("No ContentOutline registered."); //$NON-NLS-1$ - } - - return found; - - } - - /** - * Creates the content outline from the selected extension. - * - * @throws BackboneException - * exception thrown when the outline can not be created. - */ - private void createContentOutline() throws BackboneException { - - ContentOutlineDescriptor found = getContentOutlineDescriptor(); - // Instanciate the object - if (found != null) { - contentOutline = found.createContentOutlinePage(); - } - } - - /** - * Inner Descriptor for content outline. This class load data from Eclipse - * extension mechanism TODO Change the parent class. It is here just to have - * quick code. - */ - protected class ContentOutlineDescriptor extends EditorDescriptorExtensionFactory { - - private int priority; - - private String className; - - private String actionBarContributorID; - - private IConfigurationElement element; - - /** - * Instance is created when requested. - */ - protected IPapyrusContentOutlinePage instance = null; - - /** - * Create a descriptor backuped by the config element. - */ - protected ContentOutlineDescriptor(IConfigurationElement element) throws BackboneException { - String tagName = "contentoutline"; - checkTagName(element, tagName); - this.className = element.getAttribute(classAttributeName); - this.actionBarContributorID = element.getAttribute(actionBarContributorIdPropertyName); - try { - this.priority = Integer.parseInt(element.getAttribute("priority")); - } catch (NumberFormatException e) { - this.priority = 0; - } - - this.element = element; - // check parameters - if (className == null) { - throw new BadClassNameException("Class name must be set", "contentoutline", classAttributeName); //$NON-NLS-1$ //$NON-NLS-2$ - } - - } - - /** - * Compare priority. The highest priority win. - */ - public boolean isHigher(ContentOutlineDescriptor found) { - if (found == null) { - return true; - } - return this.getPriority() > found.getPriority(); - } - - /** - * Return the higher value of the descriptor. This value is used to - * order the contentOutline. The highest priority win. - */ - private int getPriority() { - return priority; - } - - /** - * @return the actionBarContributorID - */ - public String getActionBarContributorID() { - return actionBarContributorID; - } - - /** - * Returns the content outline page instance (lazy initialization) - * - * @return the context outline page - * @throws BackboneException - * exception thrown when a problem occurs. - */ - protected IPapyrusContentOutlinePage getContentOutline() throws BackboneException { - if (instance == null) { - instance = createContentOutlinePage(); - } - return instance; - } - - /** - * Create the class corresponding to the class attribute. - */ - private Class loadClass() throws BadClassNameException { - if (className == null || className.length() == 0) { - throw new BadClassNameException("Classname should be set.", "contentoutline", classAttributeName); //$NON-NLS-1$ //$NON-NLS-2$ - } - Class factoryClass; - try { - factoryClass = (Class) Class.forName(className); - } catch (ClassNotFoundException e) { - // try another way - try { - String declaringID = element.getContributor().getName(); - Bundle bundle = Platform.getBundle(declaringID); - factoryClass = (Class) bundle.loadClass(className); - } catch (ClassNotFoundException e1) { - throw new BadClassNameException("", "contentoutline", classAttributeName, e1); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return factoryClass; - } - - /** - * create the outlinepage by calling constructor without parameter and - * then call init method - * - * @return the outline. - * @throws BackboneException - */ - protected IPapyrusContentOutlinePage createContentOutlinePage() throws BackboneException { - if (false) { - System.out.println("Not yet"); // FIXME : no syso - return null; - } - try { - IPapyrusContentOutlinePage outline = loadClass().newInstance(); - outline.init(multiEditor); - return outline; - - } catch (SecurityException e) { - // Lets propagate. This is an implementation problem that should - // be solved by programmer. - throw new RuntimeException(e); - } - - catch (InstantiationException e) { - // Lets propagate. This is an implementation problem that should - // be solved by programmer. - // throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // Lets propagate. This is an implementation problem that should - // be solved by programmer. - throw new RuntimeException(e); - } - return null; - } - - } // end class -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/IPapyrusContentOutlinePage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/IPapyrusContentOutlinePage.java deleted file mode 100644 index 824862a4891..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/IPapyrusContentOutlinePage.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.contentoutline; - -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; - -/** - * Extends the original interface to add the init method. - */ -public interface IPapyrusContentOutlinePage extends org.eclipse.ui.views.contentoutline.IContentOutlinePage { - - /** - * Init the content outline. - * - * @param multiEditor - * the multiEditor is used to access to the context - * @throws BackboneException - * during research of the associated context. - */ - void init(IMultiDiagramEditor multiEditor) throws BackboneException; - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePage.java deleted file mode 100644 index 1c89c538b45..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePage.java +++ /dev/null @@ -1,1098 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2014 CEA LIST and other. - * - * 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: - * Remi Schnekenburger (CEA LIST) - Initial API and implementation - * Christian W. Damus (CEA) - bug 437217 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.contentoutline; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener; -import org.eclipse.papyrus.infra.core.editor.reload.IReloadContextProvider; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageLifeCycleEventsListener; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.SubActionBars; -import org.eclipse.ui.part.IPageBookViewPage; -import org.eclipse.ui.part.IPageSite; -import org.eclipse.ui.part.Page; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.part.PageSite; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import com.google.common.collect.Lists; - -/** - * Page for Papyrus outline when active nested editor is a GMF editor - */ -public class NestedEditorDelegatedOutlinePage extends Page implements IPapyrusContentOutlinePage, IPageLifeCycleEventsListener, IEditorReloadListener { - - /** The editor for which I am a slave. */ - private IMultiDiagramEditor multiEditor; - - /** Sash window container to listen for page changes inside the same editor */ - private ISashWindowsContainer sashWindowsContainer; - - /** Page book in which all outline controls of nested editors will be stored and displayed one by one */ - private PageBook sashEditorPageBook; - - /** - * Map from papyrus pages (representing nested editors) to outline page records (key type: org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; - * value type: OutlinePageRec). - */ - private Map mapIPapyrusPageToOutlineRec = new HashMap(); - - /** - * The page rec which provided the current page or null - */ - private OutlinePageRec activeRec; - - /** - * Default page rec that displays a simple message - */ - private OutlinePageRec defaultPageRec; - - /** - * {@inheritDoc} - */ - @Override - public void init(IMultiDiagramEditor multiEditor) { - this.multiEditor = multiEditor; - - internalInit(multiEditor); - - IReloadableEditor.Adapter.getAdapter(multiEditor).addEditorReloadListener(this); - } - - private void internalInit(IMultiDiagramEditor multiEditor) { - sashWindowsContainer = (ISashWindowsContainer) multiEditor.getAdapter(ISashWindowsContainer.class); - sashWindowsContainer.addPageLifeCycleListener(this); - } - - /** - * {@inheritDoc} - */ - @Override - public void init(IPageSite pageSite) { - IViewSite viewSite = getViewSite(pageSite); - - DelegatedPageSite delegatedPageSite = new DelegatedPageSite(viewSite, this); - super.init(delegatedPageSite); - } - - /** - * /** - * The PageBookView implementation of this IWorkbenchPart method cleans up all the pages. Subclasses - * may extend. - */ - @Override - public void dispose() { - if (multiEditor != null) { - IReloadableEditor.Adapter.getAdapter(multiEditor).removeEditorReloadListener(this); - } - - internalDispose(); - - multiEditor = null; - - // Run super. - super.dispose(); - } - - private void internalDispose() { - // Deref all of the pages. - activeRec = null; - if (defaultPageRec != null) { - // check for null since the default page may not have - // been created (ex. perspective never visible) - defaultPageRec.contentOutlinePage.dispose(); - defaultPageRec.dispose(); - defaultPageRec = null; - } - - java.util.List records = new ArrayList(mapIPapyrusPageToOutlineRec.values()); - Iterator itr = records.iterator(); - while (itr.hasNext()) { - OutlinePageRec rec = itr.next(); - removePage(rec); - } - - // remove listener and all refs to editor - sashWindowsContainer.removePageLifeCycleListener(this); - } - - /** - * Refreshes the global actions for the active page. - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected void refreshGlobalActionHandlers() { - // Clear old actions. - IActionBars bars = getSite().getActionBars(); - bars.clearGlobalActionHandlers(); - - // Set new actions. - Map newActionHandlers = ((SubActionBars) activeRec.getPageSite().getActionBars()).getGlobalActionHandlers(); - if (newActionHandlers != null) { - Set keys = newActionHandlers.entrySet(); - Iterator iter = keys.iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - bars.setGlobalActionHandler(entry.getKey(), entry.getValue()); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void addSelectionChangedListener(ISelectionChangedListener listener) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public ISelection getSelection() { - // nothing here - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public void setSelection(ISelection selection) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public void createControl(Composite parent) { - sashEditorPageBook = new PageBook(parent, SWT.BORDER); - - createContents(); - } - - protected void createContents() { - // Create the default page rec. - IContentOutlinePage defaultPage = createDefaultPage(sashEditorPageBook); - defaultPageRec = new OutlinePageRec(null, defaultPage); - preparePage(defaultPageRec); - - // Show the initial active page or the default page - IPage activePage = sashWindowsContainer.getActiveSashWindowsPage(); - if (activePage != null) { - OutlinePageRec rec = getOutlinePageRec(activePage); - if (rec == null) { - rec = createPage(activePage); - } - - // Show the page, if it was successfully created - if (rec != null) { - showOutlinePageRec(rec); - } else { - showOutlinePageRec(defaultPageRec); - } - } else { - showOutlinePageRec(defaultPageRec); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Control getControl() { - return sashEditorPageBook; - } - - /** - * {@inheritDoc} - */ - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public void pageChanged(IPage newPage) { - // throw new UnsupportedOperationException("pageChanged not implemented " + newPage); - } - - /** - * {@inheritDoc} - */ - @Override - public void pageOpened(IPage page) { - // Activator.log.debug("Opened"); - // create the new Outline - // Create a page for the part. - OutlinePageRec rec = getOutlinePageRec(page); - if (rec == null) { - rec = createPage(page); - } - - // Show the page, if it was successfully created - if (rec != null) { - showOutlinePageRec(rec); - } else { - showOutlinePageRec(defaultPageRec); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void pageClosed(IPage papyrusPage) { - // Activator.log.debug("Closed"); - // Update the active part. - if (activeRec != null && activeRec.papyrusPage == papyrusPage) { - showOutlinePageRec(defaultPageRec); - } - - // Find and remove the part page. - OutlinePageRec rec = getOutlinePageRec(papyrusPage); - if (rec != null) { - removePage(rec); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void pageActivated(IPage page) { - // Activator.log.debug("Activated"); - // Create a page for the partm, if necessary. - OutlinePageRec rec = getOutlinePageRec(page, true); - - // Show the page, if it was successfully created - if (rec != null) { - showOutlinePageRec(rec); - } else { - showOutlinePageRec(defaultPageRec); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void pageDeactivated(IPage page) { - // throw new UnsupportedOperationException("pageDeactivated not implemented " + page); - } - - /** - * {@inheritDoc} - */ - @Override - public void pageAboutToBeOpened(IPage page) { - // throw new UnsupportedOperationException("pageAboutToBeOpened not implemented "+page); - } - - /** - * {@inheritDoc} - */ - @Override - public void pageAboutToBeClosed(IPage page) { - // throw new UnsupportedOperationException("pageAboutToBeClosed not implemented " + page); - } - - @Override - public void editorAboutToReload(EditorReloadEvent event) { - event.putContext(new OutlineContext()); - - internalDispose(); - } - - @Override - public void editorReloaded(EditorReloadEvent event) { - internalInit(event.getEditor()); - createContents(); - - ((OutlineContext) event.getContext()).restore(); - } - - // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // MAINLY INSPIRED FROM PAGE BOOK VIEW - // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Creates and returns the default page for this view. - * - * @param book - * the pagebook control - * @return the default page - */ - protected IContentOutlinePage createDefaultPage(PageBook book) { - MessageOutlinePage page = new MessageOutlinePage(); - initPage(page); - page.createControl(book); - return page; - } - - /** - * Creates an outline record for a given papyrus Page. Adds it to the pagebook but does not show it. - * - * @param page - * The nested editor we are created an outline. - * @return the created outline page record - */ - protected OutlinePageRec createPage(IPage papyrusPage) { - OutlinePageRec rec = doCreatePage(papyrusPage); - if (rec != null) { - mapIPapyrusPageToOutlineRec.put(papyrusPage, rec); - preparePage(rec); - } - return rec; - } - - /** - * Prepares the page in the given page rec for use in this view. - * - * @param rec - */ - protected void preparePage(OutlinePageRec rec) { - IPageSite site = null; - - if (!doesPageExist(rec.contentOutlinePage)) { - if (rec.contentOutlinePage instanceof IPageBookViewPage) { - site = ((IPageBookViewPage) rec.contentOutlinePage).getSite(); - rec.setPageSite(site); - } - } - } - - /** - * Initializes the given page with a page site. - *

- * Subclasses should call this method after the page is created but before creating its controls. - *

- *

- * Subclasses may override - *

- * - * @param page - * The page to initialize - */ - protected void initPage(IPageBookViewPage page) { - try { - IPageSite site = super.getSite(); - // try to create a specific page site for this page - page.init(new PageSite(getViewSite(site))); - } catch (PartInitException e) { - Activator.log.error(e); - } - } - - /** - * @param site - * the page site from which parent view site is retrieved - * @return the retrieved page site - */ - protected static IViewSite getViewSite(IPageSite site) { - if (site instanceof IViewSite) { - return ((IViewSite) site); - } - // no way to get the IViewSite from the page site. - if (site instanceof PageSite) { - try { - Field parentSiteField = PageSite.class.getDeclaredField("parentSite"); - parentSiteField.setAccessible(true); - Object parentSite = parentSiteField.get(site); - if (parentSite instanceof IViewSite) { - return ((IViewSite) parentSite); - } - } catch (SecurityException e) { - Activator.log.error(e); - } catch (NoSuchFieldException e) { - Activator.log.error(e); - } catch (IllegalArgumentException e) { - Activator.log.error(e); - } catch (IllegalAccessException e) { - Activator.log.error(e); - } - } - return null; - } - - /* - * (non-Javadoc) - * Method declared on PageBookView. - */ - protected OutlinePageRec doCreatePage(IPage papyrusPage) { - // Try to get an outline page. - if (papyrusPage instanceof IEditorPage) { - IEditorPart part = ((IEditorPage) papyrusPage).getIEditorPart(); - Object obj = getAdapter(part, IContentOutlinePage.class, false); - if (obj instanceof IContentOutlinePage) { - IContentOutlinePage page = (IContentOutlinePage) obj; - if (page instanceof IPageBookViewPage) { - initPage((IPageBookViewPage) page); - } - page.createControl(getPageBook()); - return new OutlinePageRec(papyrusPage, page); - } - } - - // There is no content outline - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public DelegatedPageSite getSite() { - return (DelegatedPageSite) super.getSite(); - } - - /* - * (non-Javadoc) - * Method declared on PageBookView. - */ - protected void doDestroyPage(IPage papyrusPage, OutlinePageRec rec) { - IContentOutlinePage contentOutlinePage = rec.contentOutlinePage; - contentOutlinePage.dispose(); - rec.dispose(); - } - - protected Collection getAllPages() { - return mapIPapyrusPageToOutlineRec.values(); - } - - /** - * Returns true if the page has already been created. - * - * @param page - * the page to test - * @return true if this page has already been created. - */ - protected boolean doesPageExist(IContentOutlinePage page) { - return mapIPapyrusPageToOutlineRec.containsKey(page); - } - - /** - * Returns the papyrus page which contributed the current outline page to this view. - * - * @return the page which contributed the current outline page or null if no part contributed the current page - */ - protected IPage getCurrentContributingPage() { - if (activeRec == null) { - return null; - } - return activeRec.papyrusPage; - } - - /** - * Returns the currently visible outline page for this view or null if no page is currently visible. - * - * @return the currently visible page - */ - public IContentOutlinePage getCurrentOutlinePage() { - if (activeRec == null) { - return null; - } - return activeRec.contentOutlinePage; - } - - /** - * Returns the view site for the given page of this view. - * - * @param page - * the page - * @return the corresponding site, or null if not found - */ - protected IPageSite getPageSite(IPage page) { - OutlinePageRec rec = getOutlinePageRec(page); - if (rec != null) { - return rec.getPageSite(); - } - return null; - } - - /** - * Returns the default page for this view. - * - * @return the default page - */ - public IContentOutlinePage getDefaultOutlinePage() { - return defaultPageRec.contentOutlinePage; - } - - /** - * Returns the pagebook control for this view. - * - * @return the pagebook control, or null if not initialized - */ - protected PageBook getPageBook() { - return sashEditorPageBook; - } - - /** - * Returns the page record for the given part. - * - * @param part - * the part - * @return the corresponding page record, or null if not - * found - */ - protected OutlinePageRec getOutlinePageRec(IPage papyrusPage) { - return mapIPapyrusPageToOutlineRec.get(papyrusPage); - } - - OutlinePageRec getOutlinePageRec(IPage papyrusPage, boolean create) { - OutlinePageRec result = getOutlinePageRec(papyrusPage); - if (result == null) { - result = createPage(papyrusPage); - } - return result; - } - - /** - * Returns the page record for the given page of this view. - * - * @param page - * the page - * @return the corresponding page record, or null if not - * found - */ - protected OutlinePageRec getPageRec(IContentOutlinePage contentOutlinePage) { - Iterator itr = mapIPapyrusPageToOutlineRec.values().iterator(); - while (itr.hasNext()) { - OutlinePageRec rec = itr.next(); - if (rec.contentOutlinePage == contentOutlinePage) { - return rec; - } - } - return null; - } - - /** - * Removes a page record. - * - * @param rec - * the page record to remove - */ - protected void removePage(OutlinePageRec rec) { - mapIPapyrusPageToOutlineRec.remove(rec.papyrusPage); - - Control control = rec.contentOutlinePage.getControl(); - if (control != null && !control.isDisposed()) { - // Dispose the page's control so pages don't have to do this in their dispose method. - // The page's control is a child of this view's control so if this view is closed, the page's control will already be disposed. - control.dispose(); - } - - // Do this before destroying the page, otherwise we won't be able to retrieve the page site (it will be null) - IPageSite site = rec.getPageSite(); - if (site instanceof PageSite) { // test null pointer and PageSite - ((SubActionBars) ((PageSite) site).getActionBars()).deactivate(); - ((SubActionBars) ((PageSite) site).getActionBars()).dispose(); - } - - // Free the page - doDestroyPage(rec.papyrusPage, rec); - } - - /* - * (non-Javadoc) Method declared on IWorkbenchPart. - */ - @Override - public void setFocus() { - // first set focus on the page book, in case the page - // doesn't properly handle setFocus - if (sashEditorPageBook != null) { - sashEditorPageBook.setFocus(); - } - // then set focus on the page, if any - if (activeRec != null) { - activeRec.contentOutlinePage.setFocus(); - } - } - - /** - * Shows page contained in the given page record in this view. The page - * record must be one from this pagebook view. - *

- * The PageBookView implementation of this method asks the pagebook control to show the given page's control, and records that the given page is now current. Subclasses may extend. - *

- * - * @param pageRec - * the page record containing the page to show - */ - protected void showOutlinePageRec(OutlinePageRec pageRec) { - // If already showing do nothing - if (activeRec == pageRec) { - return; - } - // If the page is the same, just set activeRec to pageRec - if (activeRec != null && pageRec != null && activeRec.contentOutlinePage == pageRec.contentOutlinePage) { - activeRec = pageRec; - return; - } - - activeRec = pageRec; - Control pageControl = activeRec.contentOutlinePage.getControl(); - if (pageControl != null && !pageControl.isDisposed()) { - PageSite pageSite = (PageSite) activeRec.getPageSite(); - // Verify that the page control is not disposed - // If we are closing, it may have already been disposed - sashEditorPageBook.showPage(pageControl); - getSite().setActivePageSite(pageSite); - } - - } - - /** - * If it is possible to adapt the given object to the given type, this - * returns the adapter. Performs the following checks: - * - *
    - *
  1. Returns sourceObject if it is an instance of the adapter type.
  2. - *
  3. If sourceObject implements IAdaptable, it is queried for adapters.
  4. - *
  5. If sourceObject is not an instance of PlatformObject (which would have already done so), the adapter manager is queried for adapters
  6. - *
- * - * Otherwise returns null. - * - * @param sourceObject - * object to adapt, or null - * @param adapter - * type to adapt to - * @param activatePlugins - * true if IAdapterManager.loadAdapter should be used (may trigger plugin activation) - * @return a representation of sourceObject that is assignable to the - * adapter type, or null if no such representation exists - */ - public static Object getAdapter(Object sourceObject, Class adapter, boolean activatePlugins) { - Assert.isNotNull(adapter); - if (sourceObject == null) { - return null; - } - if (adapter.isInstance(sourceObject)) { - return sourceObject; - } - - if (sourceObject instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) sourceObject; - - Object result = adaptable.getAdapter(adapter); - if (result != null) { - // Sanity-check - Assert.isTrue(adapter.isInstance(result)); - return result; - } - } - - if (!(sourceObject instanceof PlatformObject)) { - Object result; - if (activatePlugins) { - result = Platform.getAdapterManager().loadAdapter(sourceObject, adapter.getName()); - } else { - result = Platform.getAdapterManager().getAdapter(sourceObject, adapter); - } - if (result != null) { - return result; - } - } - - return null; - } - - /** - * A data structure used to store the information about the editor outline page within the papyrus outline page. - */ - protected static class OutlinePageRec { - - public Object subActionBars; - - /** papyrus page: current editor opened as nested editor */ - public IPage papyrusPage; - - /** outline page recorded for the given papyrus page */ - public IContentOutlinePage contentOutlinePage; - - /** page site for the recorded outline page */ - public IPageSite pageSite; - - /** - * Creates a new page record initialized to the given papyrus page and outline page. - * - * @param papyrusPage - * @param contentOutlinePage - */ - public OutlinePageRec(IPage papyrusPage, IContentOutlinePage contentOutlinePage) { - this.papyrusPage = papyrusPage; - this.contentOutlinePage = contentOutlinePage; - } - - /** - * Sets the page site - * - * @param pageSite - * the page site for the recorded content outline page - */ - public void setPageSite(IPageSite pageSite) { - this.pageSite = pageSite; - } - - /** - * Sets the page site - * - * @param pageSite - * the page site for the recorded content outline page - */ - public IPageSite getPageSite() { - return this.pageSite; - } - - /** - * Disposes of this page record by nulling its fields. - */ - public void dispose() { - papyrusPage = null; - contentOutlinePage = null; - pageSite = null; - } - } - - protected static class DelegatedPageSite extends PageSite { - - /** Page site of the active page in the book */ - protected PageSite activePageSite; - - private NestedEditorDelegatedOutlinePage nestedEditorDelegatedOutlinePage; - - /** - * Constructor. - * - * @param parentViewSite - * @param nestedEditorDelegatedOutlinePage - */ - public DelegatedPageSite(IViewSite parentViewSite, NestedEditorDelegatedOutlinePage nestedEditorDelegatedOutlinePage) { - super(parentViewSite); - this.nestedEditorDelegatedOutlinePage = nestedEditorDelegatedOutlinePage; - } - - /** - * Sets the active page site - * - * @param activePageSite - * the activePageSite to set - */ - public void setActivePageSite(PageSite activePageSite) { - // remove the contribution of the previous active page site - if (this.activePageSite != null) { - // update the action bars for the current page - getActionBars().deactivate(); - getActionBars().clearGlobalActionHandlers(); - getActionBars().updateActionBars(); - - activePageSite.deactivate(); - - } - this.activePageSite = activePageSite; - if (this.activePageSite != null) { - activePageSite.activate(); - // update the action bars for the current page - getActionBars().activate(); - getActionBars().updateActionBars(); - } - } - - /** - * Returns the active page site - * - * @return the active Page Site - */ - public PageSite getActivePageSite() { - return activePageSite; - } - - /** - * {@inheritDoc} - */ - @Override - public SubActionBars getActionBars() { - if (activePageSite != null) { - return (SubActionBars) activePageSite.getActionBars(); - } - return (SubActionBars) super.getActionBars(); - } - - /** - * {@inheritDoc} - */ - @Override - public void deactivate() { - // deactivate the action bars of the current active page - if (activePageSite != null) { - activePageSite.deactivate(); - } - - // deactivate all subcontributions - for (OutlinePageRec rec : nestedEditorDelegatedOutlinePage.getAllPages()) { - IPageSite site = rec.getPageSite(); - IActionBars bars = site.getActionBars(); - if (bars instanceof SubActionBars) { - SubActionBars subActionBars = (SubActionBars) bars; - subActionBars.deactivate(); - subActionBars.clearGlobalActionHandlers(); - subActionBars.updateActionBars(); - } - } - super.deactivate(); - } - - /** - * {@inheritDoc} - */ - @Override - public void activate() { - - // here, we have to desactivate all contributions of all pages of this delegating service. - // when the page site is activated, the pagebookview has already tried to update some action bars, even if it should not - // so we recompute all the active contributions items here, after desactivating all the contributions. - for (OutlinePageRec rec : nestedEditorDelegatedOutlinePage.getAllPages()) { - IPageSite site = rec.getPageSite(); - IActionBars bars = site.getActionBars(); - if (bars instanceof SubActionBars) { - SubActionBars subActionBars = (SubActionBars) bars; - subActionBars.deactivate(); - subActionBars.clearGlobalActionHandlers(); - subActionBars.updateActionBars(); - } - } - if (this.activePageSite != null) { - activePageSite.activate(); - // update the action bars for the current page - getActionBars().activate(); - getActionBars().updateActionBars(); - } - super.activate(); - } - } - - protected static class MessageOutlinePage implements IContentOutlinePage, IPageBookViewPage { - - private Text label; - - private IPageSite site; - - /** - * {@inheritDoc} - */ - @Override - public void createControl(Composite parent) { - label = new Text(parent, SWT.NONE); - label.setText("No outline for this editor"); - } - - /** - * {@inheritDoc} - */ - @Override - public void dispose() { - if (label != null && label.isDisposed()) { - label.dispose(); - label = null; - } - } - - /** - * {@inheritDoc} - */ - @Override - public Control getControl() { - return label; - } - - /** - * {@inheritDoc} - */ - @Override - public void setActionBars(IActionBars actionBars) { - } - - /** - * {@inheritDoc} - */ - @Override - public void setFocus() { - if (label != null && label.isDisposed()) { - label.setFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void addSelectionChangedListener(ISelectionChangedListener listener) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public ISelection getSelection() { - // nothing here - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public void setSelection(ISelection selection) { - // nothing here - } - - /** - * {@inheritDoc} - */ - @Override - public IPageSite getSite() { - return site; - } - - /** - * {@inheritDoc} - */ - @Override - public void init(IPageSite site) throws PartInitException { - this.site = site; - } - - } - - private class OutlineContext { - - private List pages = Lists.newArrayListWithCapacity(mapIPapyrusPageToOutlineRec.size()); - - OutlineContext() { - for (OutlinePageRec next : mapIPapyrusPageToOutlineRec.values()) { - pages.add(new PageContext(next)); - } - } - - public void restore() { - for (PageContext next : pages) { - next.restore(); - } - } - - // - // Nested types - // - - private class PageContext { - - final URI diagramToken; - - final Object context; - - PageContext(OutlinePageRec outlinePage) { - Object diagram = outlinePage.papyrusPage.getRawModel(); - diagramToken = (diagram instanceof EObject) ? EcoreUtil.getURI((EObject) diagram) : null; - - // Can only sensibly manage restoring the state of the page if we can find it again - if (diagramToken == null) { - context = null; - } else { - IReloadContextProvider provider = AdapterUtils.adapt(outlinePage.contentOutlinePage, IReloadContextProvider.class, null); - context = (provider == null) ? null : provider.createReloadContext(); - } - } - - void restore() { - if (diagramToken != null) { - try { - ModelSet modelSet = multiEditor.getServicesRegistry().getService(ModelSet.class); - - Object diagram = modelSet.getEObject(diagramToken, true); - if (diagram != null) { - IPage page = sashWindowsContainer.lookupModelPage(diagram); - if (page != null) { - OutlinePageRec outlinePage = getOutlinePageRec(page, true); - if ((outlinePage != null) && (context != null)) { - // Restore it. We know it adapts if it provided the reload state in the first place - AdapterUtils.adapt(outlinePage.contentOutlinePage, IReloadContextProvider.class, null).restore(context); - } - } - } - } catch (ServiceException e) { - Activator.log.error(e); - } - } - } - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/ContentProviderServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/ContentProviderServiceFactory.java deleted file mode 100644 index f7396fb127f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/ContentProviderServiceFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * A service factory to create the {@link ISashWindowsContentProvider} service. - * This service depends on {@link DiSashModelMngrServiceFactory}. - * - * @author cedric dumoulin - * - */ -public class ContentProviderServiceFactory implements IServiceFactory { - - /** - * The sashModelMangr. - */ - private DiSashModelManager sashModelMngr; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - // Get required services - sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() - * - * @return - * @throws ServiceException - */ - @Override - public Object createServiceInstance() throws ServiceException { - return sashModelMngr.getISashWindowsContentProvider(); - } - -} 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 deleted file mode 100644 index 24a15bd5e20..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java +++ /dev/null @@ -1,1244 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, 2015 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Christian W. Damus (CEA) - manage models by URI, not IFile (CDO) - * Christian W. Damus (CEA) - bug 410346 - * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up) - * Christian W. Damus (CEA) - bug 437217 - * Christian W. Damus - bug 469464 - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.editor; - -import static org.eclipse.papyrus.infra.core.Activator.log; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicReference; - -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.contentoutline.ContentOutlineRegistry; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor.DirtyPolicy; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener; -import org.eclipse.papyrus.infra.core.language.ILanguageChangeListener; -import org.eclipse.papyrus.infra.core.language.ILanguageService; -import org.eclipse.papyrus.infra.core.language.LanguageChangeEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; -import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry; -import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.CoreComposedActionBarContributor; -import org.eclipse.papyrus.infra.core.resource.ModelMultiException; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; -import org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.papyrus.infra.core.sasheditor.editor.gef.MultiDiagramEditorGefDelegate; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleManager; -import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServiceMultiException; -import org.eclipse.papyrus.infra.core.services.ServiceStartKind; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.core.services.internal.EditorLifecycleManagerImpl; -import org.eclipse.papyrus.infra.core.services.internal.InternalEditorLifecycleManager; -import org.eclipse.papyrus.infra.core.utils.ServiceUtils; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorActionBarContributor; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IURIEditorInput; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.progress.UIJob; -import org.eclipse.ui.statushandlers.StatusManager; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; - -/** - * Multi diagram editor allowing to plug various kind of editors. Editors are - * registered with the help of the Eclipse extension mechanism. This - * implementation allows to register editors and context separately. An editor - * should specify which context it need to run. This multi diagram editor allows - * to show editor side by side in one or more sash windows. - * - * The real implementation for the generic type T of SashMultiPageEditorPart is - * actually di2.Diagram - * - * @author cedric dumoulin - * @author Jerome Benois - * @author Thomas Szadel - * Refactoring. - * - * TODO : remove GMF dependency ! - */ -public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IGotoMarker, IEditingDomainProvider { - - /** Gef adapter */ - private MultiDiagramEditorGefDelegate gefAdaptorDelegate; - - /** ContentOutline registry */ - private ContentOutlineRegistry contentOutlineRegistry; - - /** Services registry. Used to get registered services */ - private ServicesRegistry servicesRegistry; - - /** - * ActionBarContributor Registry. Allows to get an ActionBar by its Id. The - * registry is initialized from the Eclipse extension mechanism. - */ - private ActionBarContributorRegistry actionBarContributorRegistry; - - /** SashModelMngr to add pages */ - protected DiSashModelManager sashModelMngr; - - /** - * Service used to maintain the dirty state and to perform save and saveAs. - */ - protected ISaveAndDirtyService saveAndDirtyService; - - private final List propertiesPages = new LinkedList(); - - /** - * Listener on {@link ISaveAndDirtyService#addInputChangedListener(IEditorInputChangedListener)} - */ - private static class EditorInputChangedListener implements IEditorInputChangedListener { - - private CoreMultiDiagramEditor editor; - - public EditorInputChangedListener(CoreMultiDiagramEditor editor) { - this.editor = editor; - } - - /** - * This method is called when the editor input is changed from the - * ISaveAndDirtyService. - * - * @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput) - * - * @param fileEditorInput - */ - @Override - public void editorInputChanged(FileEditorInput fileEditorInput) { - // Change the editor input. - editor.setInputWithNotify(fileEditorInput); - editor.setPartName(fileEditorInput.getName()); - } - - /** - * The isDirty flag has changed, reflect its new value - * - * @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged() - * - */ - @Override - public void isDirtyChanged() { - - // Run it in async way. - editor.getSite().getShell().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - // editor can be null if this object has been finalized, but - // still queued in the asyncExec queue. - // This can happen if the editor is disposed, but some run still in - // the exec queue. - // When the method is executed asynchronously, the object is already finalized, and so - // editor is null. - if (editor == null) { - return; - } - editor.firePropertyChange(IEditorPart.PROP_DIRTY); - } - }); - } - - public void dispose() { - this.editor = null; - } - } - - protected EditorInputChangedListener editorInputChangedListener; - - private TransactionalEditingDomain transactionalEditingDomain; - - /** - * Object managing models lifeCycle. - */ - protected ModelSet resourceSet; - - /** - * Cached event that can be reused. - */ - protected DoSaveEvent lifeCycleEvent; - - private class ContentChangedListener implements IContentChangedListener { - - /** - * Called when the content is changed. RefreshTabs. - */ - @Override - public void contentChanged(ContentEvent event) { - scheduleRefresh(); - } - } - - /** - * A listener on model change events. - */ - private ContentChangedListener contentChangedListener; - - /** - * Undo context used to have the same undo context in all Papyrus related - * views and editors. TODO : move away, use a version independent of GMF, - * add a listener that will add the context to all commands modifying - * attached Resources (==> linked to ModelSet ?) - */ - private IUndoContext undoContext; - - /** - * Editor reload listeners. - */ - private CopyOnWriteArrayList reloadListeners = new CopyOnWriteArrayList(); - - /** - * A pending reload operation (awaiting next activation of the editor). - */ - private final AtomicReference pendingReload = new AtomicReference(); - - public CoreMultiDiagramEditor() { - super(); - - addSelfReloadListener(); - } - - /** - * Get the contentOutlineRegistry. Create it if needed. - * - * @return the contentOutlineRegistry - */ - protected ContentOutlineRegistry getContentOutlineRegistry() { - if (contentOutlineRegistry == null) { - createContentOutlineRegistry(); - } - - return contentOutlineRegistry; - } - - /** - * Create the contentOutlineRegistry. - */ - private void createContentOutlineRegistry() { - contentOutlineRegistry = new ContentOutlineRegistry(this, Activator.PLUGIN_ID); - } - - /** - * Returns the service registry associated to the editor. - * - * @return the servicesRegistry The registry. - */ - @Override - public ServicesRegistry getServicesRegistry() { - if (servicesRegistry == null) { - servicesRegistry = createServicesRegistry(); - } - return servicesRegistry; - } - - /** - * Create the ServicesRegistry. - * - * @return - */ - private ServicesRegistry createServicesRegistry() { - // Create Services Registry - try { - ServicesRegistry servicesRegistry = new ExtensionServicesRegistry(Activator.PLUGIN_ID); - // servicesRegistry.startRegistry(); - return servicesRegistry; - } catch (ServiceException e) { - // Show log and error - log.error(e.getMessage(), e); - } - return null; - } - - /** - * Do nothing as we create the provider before any calls to this method. - * Should not be called by subclasses. - * - * @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#createPageProvider() - */ - @Override - protected ISashWindowsContentProvider createPageProvider() { - throw new UnsupportedOperationException("Not implemented. Should not be called as the ContentProvider is already initialized."); - } - - /** - * Create the pageContentProvider. - * - * Removed since 0.10.0 - * - * @param pageFactory - * @param diResource - * Resource used to load/save the SashModel. - * - * - */ - // protected ISashWindowsContentProvider createPageProvider(IPageModelFactory pageFactory, Resource diResource, TransactionalEditingDomain editingDomain) { - // - // sashModelMngr = new TransactionalDiSashModelMngr(pageFactory, diResource, editingDomain); - // - // ISashWindowsContentProvider pageProvider = sashModelMngr.getISashWindowsContentProvider(); - // - // return pageProvider; - // } - - /** - * Get The {@link IPageMngr} used to add, open, remove or close a diagram in - * the SashWindow. This method is available as soon as the {@link CoreMultiDiagramEditor#init(IEditorSite, IEditorInput)} method is - * called. - * - * @return - */ - protected IPageManager getIPageManager() throws IllegalStateException { - try { - return sashModelMngr.getIPageManager(); - } catch (Exception e) { - throw new IllegalStateException("Method should be called after CoreMultiDiagramEditor#init(IEditorSite, IEditorInput) is called"); - } - } - - /** - * Get the ActionBarContributorRegistry. Creates it if necessary. - * - * @return - */ - protected ActionBarContributorRegistry getActionBarContributorRegistry() { - if (actionBarContributorRegistry != null) { - return actionBarContributorRegistry; - } - - // Try to got it from CoreComposedActionBarContributor - // Get it from the contributor. - IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor(); - if (contributor instanceof CoreComposedActionBarContributor) { - log.debug(getClass().getSimpleName() + " - ActionBarContributorRegistry loaded from CoreComposedActionBarContributor."); - return ((CoreComposedActionBarContributor) contributor).getActionBarContributorRegistry(); - } else { - // Create a registry. - log.debug(getClass().getSimpleName() + " - create an ActionBarContributorRegistry."); - return createActionBarContributorRegistry(); - } - - } - - /** - * Create the ActionBarContributorRegistry. - * - * @return - */ - private ActionBarContributorRegistry createActionBarContributorRegistry() { - return new ActionBarContributorRegistry(Activator.PLUGIN_ID); - } - - /** - * - * - * @param adapter - * - * @return - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class adapter) { - - if (ServicesRegistry.class == adapter) { - return getServicesRegistry(); - } - - if (IPageMngr.class == adapter || IPageManager.class == adapter) { - return getIPageManager(); - } - - if (IPropertySheetPage.class == adapter) { - // Do not test if tabbedPropertySheetPage is null before calling new - // this is managed by Eclipse which only call current method when - // necessary - return getPropertySheetPage(); - } - - // Add a viewer - if (IContentOutlinePage.class == adapter) { - try { - ContentOutlineRegistry outlineRegistry = getContentOutlineRegistry(); - if (outlineRegistry == null) { - return null; - } - IContentOutlinePage contentOutline = outlineRegistry.getContentOutline(); - if (contentOutline != null) { - return contentOutline; - } - } catch (BackboneException e) { - // Ignore: There is not registered outline. - } - } - - if (EditingDomain.class == adapter || TransactionalEditingDomain.class == adapter) { - return transactionalEditingDomain; - } - - /* - * Return context used for undo/redo. All papyrus views should use this - * context. The prefer way to get this is to use undoContext = - * servicesRegistry.getService(IUndoContext.class); - */ - if (IUndoContext.class == adapter) { - return undoContext; - } - - // EMF requirements - if (IEditingDomainProvider.class == adapter) { - return this; - } - - // GEF diagram requirements - if (adapter == ActionRegistry.class) { - return gefAdaptorDelegate.getActionRegistry(); - } - - if (adapter == ISelection.class) { - return getSite().getSelectionProvider().getSelection(); - } - - if (adapter == IReloadableEditor.class) { - return createReloadAdapter(); - } - - return super.getAdapter(adapter); - } - - /** - * Init the editor. - */ - @Override - public void init(IEditorSite site, IEditorInput input) throws PartInitException { - // Init super - super.init(site, input); - - // Set editor name - setPartName(input.getName()); - - initContents(); - } - - @Override - public void createPartControl(Composite parent) { - super.createPartControl(parent); - - // Fire the PreDisplay event synchronously, so that listeners can continue - // setting up the UI before the contents are actually rendered fully - getLifecycleManager().firePreDisplay(this); - - // Fire the PostDisplay event asynchronously, to leave time to the Eclipse - // framework to actually display the contents of the editor - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - // Because we are asynchronous, the editor may already have been disposed - // (Especially in the case of tests running in the UI Thread) - if (servicesRegistry == null) { - return; - } - getLifecycleManager().firePostDisplay(CoreMultiDiagramEditor.this); - } - }); - - } - - protected void loadModelAndServices() throws PartInitException { - // Create Gef adaptor - gefAdaptorDelegate = new MultiDiagramEditorGefDelegate(); - - // Create ServicesRegistry and register services - servicesRegistry = createServicesRegistry(); - - // Add itself as a service - servicesRegistry.add(IMultiDiagramEditor.class, 1, this); - - // Create lifeCycle event provider and the event that is used when the editor fire a save event. - // lifeCycleEventsProvider = new LifeCycleEventsProvider(); - // lifeCycleEvent = new DoSaveEvent(servicesRegistry, this); - // servicesRegistry.add(ILifeCycleEventsProvider.class, 1, lifeCycleEventsProvider); - - // register services - servicesRegistry.add(ActionBarContributorRegistry.class, 1, getActionBarContributorRegistry()); - // servicesRegistry.add(TransactionalEditingDomain.class, 1, transactionalEditingDomain); - // servicesRegistry.add(DiResourceSet.class, 1, resourceSet); - - // Create and initalize editor icons service - // PageIconsRegistry pageIconsRegistry = new PageIconsRegistry(); - // PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); - // editorReader.populate(pageIconsRegistry); - // servicesRegistry.add(IPageIconsRegistry.class, 1, pageIconsRegistry); - - - // Create PageModelRegistry requested by content provider. - // Also populate it from extensions. - // PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); - // editorReader.populate(pageModelRegistry, servicesRegistry); - - // TODO : create appropriate Resource for the contentProvider, and pass it here. - // This will allow to remove the old sash stuff. - // setContentProvider(createPageProvider(pageModelRegistry, resourceSet.getDiResource(), transactionalEditingDomain)); - // servicesRegistry.add(ISashWindowsContentProvider.class, 1, getContentProvider()); - // servicesRegistry.add(IPageMngr.class, 1, getIPageMngr()); - - // register a basic label provider - // adapter factory used by EMF objects - AdapterFactory factory = null; - try { - EditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(servicesRegistry); - if (domain instanceof AdapterFactoryEditingDomain) { - // Use the adapter factory already provided by this editing domain - factory = ((AdapterFactoryEditingDomain) domain).getAdapterFactory(); - } - } catch (ServiceException e) { - // OK, there's no editing domain. That's fine - } - - if (factory == null) { - // Must create a new adapter factory - factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - } - - /** label provider for EMF objects */ - ILabelProvider labelProvider = new AdapterFactoryLabelProvider(factory) { - - /** - * This implements {@link ILabelProvider}.getText by forwarding it - * to an object that implements {@link IItemLabelProvider#getText - * IItemLabelProvider.getText} - */ - @Override - public String getText(Object object) { - // Get the adapter from the factory. - // - IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); - if (object instanceof EObject) { - if (((EObject) object).eIsProxy()) { - return "Proxy - " + object; - } - } - return itemLabelProvider != null ? itemLabelProvider.getText(object) : object == null ? "" : object.toString(); - } - }; - servicesRegistry.add(ILabelProvider.class, 1, labelProvider); - - EditorLifecycleManager lifecycleManager = new EditorLifecycleManagerImpl(); - servicesRegistry.add(EditorLifecycleManager.class, 1, lifecycleManager, ServiceStartKind.LAZY); - - // Start servicesRegistry - URI uri; - IEditorInput input = getEditorInput(); - if (input instanceof IFileEditorInput) { - uri = URI.createPlatformResourceURI(((IFileEditorInput) input).getFile().getFullPath().toString(), true); - } else if (input instanceof URIEditorInput) { - uri = ((URIEditorInput) input).getURI(); - } else { - uri = URI.createURI(((IURIEditorInput) input).getURI().toString()); - } - - try { - // Start the ModelSet first, and load if from the specified File. - // Also start me so that I may be retrieved from the registry by other services - List> servicesToStart = new ArrayList>(1); - servicesToStart.add(ModelSet.class); - servicesToStart.add(IMultiDiagramEditor.class); - - servicesRegistry.startServicesByClassKeys(servicesToStart); - - resourceSet = servicesRegistry.getService(ModelSet.class); - resourceSet.loadModels(uri); - - // start remaining services - servicesRegistry.startRegistry(); - } catch (ModelMultiException e) { - try { - // with the ModelMultiException it is still possible to open the - // editors that's why the service registry is still started - servicesRegistry.startRegistry(); - warnUser(e); - } catch (ServiceException e1) { - log.error(e); - // throw new PartInitException("could not initialize services", e); //$NON-NLS-1$ - } - } catch (ServiceException e) { - log.error(e); - // throw new PartInitException("could not initialize services", e); - } - - - // Get required services - - try { - transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); - sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); - - saveAndDirtyService = servicesRegistry.getService(ISaveAndDirtyService.class); - undoContext = servicesRegistry.getService(IUndoContext.class); - - servicesRegistry.getService(ILanguageService.class).addLanguageChangeListener(createLanguageChangeListener()); - } catch (ServiceException e) { - log.error("A required service is missing.", e); - // if one of the services above fail to start, the editor can't run - // => stop - throw new PartInitException("could not initialize services", e); - } - - - // Listen on input changed from the ISaveAndDirtyService - editorInputChangedListener = new EditorInputChangedListener(this); - saveAndDirtyService.addInputChangedListener(editorInputChangedListener); - getLifecycleManager().firePostInit(this); - } - - private ILanguageChangeListener createLanguageChangeListener() { - return new ILanguageChangeListener() { - - @Override - public void languagesChanged(LanguageChangeEvent event) { - // Re-load the editor if languages changed, because new ModelSet configurations may be required - if (event.getType() == LanguageChangeEvent.ADDED) { - new UIJob(getSite().getShell().getDisplay(), NLS.bind("Reload editor {0}", getTitle())) { - - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - monitor = SubMonitor.convert(monitor, IProgressMonitor.UNKNOWN); - - try { - ISashWindowsContainer container = getISashWindowsContainer(); - if ((container != null) && !container.isDisposed()) { - IReloadableEditor.ReloadReason reason = IReloadableEditor.ReloadReason.RESOURCES_CHANGED; - - DirtyPolicy dirtyPolicy = DirtyPolicy.getDefault(); - try { - IReloadableEditor.Adapter.getAdapter(CoreMultiDiagramEditor.this).reloadEditor(resourceSet.getResources(), reason, dirtyPolicy); - } catch (CoreException e) { - result = e.getStatus(); - } - } - } finally { - monitor.done(); - } - - return result; - } - }.schedule(); - } - } - }; - } - - private InternalEditorLifecycleManager getLifecycleManager() { - // I've been disposed - if (servicesRegistry == null) { - return null; - } - try { - return (InternalEditorLifecycleManager) servicesRegistry.getService(EditorLifecycleManager.class); - } catch (ServiceException ex) { - Activator.log.error(ex); - } - return null; - } - - protected void loadNestedEditors() throws PartInitException { - ISashWindowsContentProvider contentProvider = null; - try { - contentProvider = servicesRegistry.getService(ISashWindowsContentProvider.class); - } catch (ServiceException ex) { - log.error("A required service is missing.", ex); - // if one of the services above fail to start, the editor can't run - // => stop - throw new PartInitException("could not initialize services", ex); - } - - // Set the content provider providing editors. - setContentProvider(contentProvider); - - // Listen on contentProvider changes - if (contentChangedListener == null) { - contentChangedListener = new ContentChangedListener(); - } - sashModelMngr.getSashModelContentChangedProvider().addListener(contentChangedListener); - - IEditorInput input = getEditorInput(); - - if (input instanceof IPapyrusPageInput) { - IPapyrusPageInput papyrusPageInput = (IPapyrusPageInput) input; - final IPageManager pageManager = getIPageManager(); - - if (papyrusPageInput.closeOtherPages()) { - pageManager.closeAllOpenedPages(); - } - - for (URI pageIdentifierURI : papyrusPageInput.getPages()) { - final EObject pageIdentifier = resourceSet.getEObject(pageIdentifierURI, true); - if (!pageManager.allPages().contains(pageIdentifier)) { - Activator.log.warn("The object " + pageIdentifier + " does not reference an existing page"); - continue; - } - - if (pageManager.isOpen(pageIdentifier)) { - pageManager.selectPage(pageIdentifier); - } else { - pageManager.openPage(pageIdentifier); - } - } - } - } - - protected void warnUser(ModelMultiException e) { - Activator.log.error(e); - MessageDialog.openError(getSite().getShell(), "Error", String.format("Your model is corrupted, invalid links have been found :\n" + "%s" + "It is recommended to fix it before editing it", e.getMessage())); - } - - /** - * Activate this editor. Called after the SWT.control is created. - */ - @Override - protected void activate() { - super.activate(); - - initFolderTabMenus(); - - try { - // Register ISashWindowsContainer as service - // Should be done only once the container is ready. - getServicesRegistry().add(ISashWindowsContainer.class, 1, getISashWindowsContainer()); - getServicesRegistry().startServicesByClassKeys(ISashWindowsContainer.class); - // Let the IPageMngr use the ISashWindowsContainer to discover current folder - // This should be done after SashWindowContainer initialization. - // DiSashModelManager sashModelManager = getServicesRegistry().getService(DiSashModelManager.class); - sashModelMngr.setCurrentFolderAndPageMngr(getISashWindowsContainer()); - - } catch (ServiceException e) { - log.error(e); - } - - } - - /** - * Init the contextual menu shown in the folder tabs. This popup menu is - * contributed by the help of Eclipse extensions, using the Commands - * framework. I.e, to add a menu item, create a menu, a command and an - * handler in the extension. - */ - protected void initFolderTabMenus() { - ISashWindowsContainer container = getISashWindowsContainer(); - - // TODO : use a constant - MenuManager menuManager = new MenuManager("tabmenu"); - menuManager.add(new Separator("tabcommands")); - menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - container.setFolderTabMenuManager(menuManager); - - // TODO : use a constant - getSite().registerContextMenu("org.eclipse.papyrus.infra.core.editor.ui.tabmenu", menuManager, getSite().getSelectionProvider()); - - } - - /** - * Overrides getPropertySheetPage. - * - * {@inheritDoc} - * - * @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getPropertySheetPage() - */ - public IPropertySheetPage getPropertySheetPage() { - IPropertySheetPage propertiesPage = new MultiDiagramPropertySheetPage(this); - propertiesPages.add(propertiesPage); - return propertiesPage; - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#dispose() - * - */ - @Override - public void dispose() { - for (IPropertySheetPage propertiesPage : this.propertiesPages) { - propertiesPage.dispose(); - } - propertiesPages.clear(); - - // Forget the outline page(s) - contentOutlineRegistry = null; - - super.dispose(); - } - - private IReloadableEditor createReloadAdapter() { - - return new IReloadableEditor() { - - @Override - public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { - // Attempt to re-load, later - pendingReload.set(new DeferredReload(triggeringResources, reason, dirtyPolicy)); - - // If I am already active, then do it now. Or, if we're not going to ask the user about it, also do it now - IWorkbenchPage page = getSite().getPage(); - if ((page.getActiveEditor() == CoreMultiDiagramEditor.this) || (dirtyPolicy != DirtyPolicy.PROMPT_TO_SAVE)) { - pendingReload.get().reload(); - } - } - - @Override - public void addEditorReloadListener(IEditorReloadListener listener) { - reloadListeners.addIfAbsent(listener); - } - - @Override - public void removeEditorReloadListener(IEditorReloadListener listener) { - reloadListeners.remove(listener); - } - }; - } - - private void addSelfReloadListener() { - createReloadAdapter().addEditorReloadListener(new IEditorReloadListener() { - - @Override - public void editorAboutToReload(EditorReloadEvent event) { - event.putContext(new MultiDiagramEditorSelectionContext(event.getEditor())); - } - - @Override - public void editorReloaded(EditorReloadEvent event) { - ((MultiDiagramEditorSelectionContext) event.getContext()).restore(event.getEditor()); - } - }); - } - - @Override - protected void deactivate() { - getLifecycleManager().fireBeforeClose(this); - if (sashModelMngr != null) { - sashModelMngr.getSashModelContentChangedProvider().removeListener(contentChangedListener); - } - - super.deactivate(); - - // dispose available service - if (servicesRegistry != null) { - try { - servicesRegistry.disposeRegistry(); - servicesRegistry = null; - } catch (ServiceMultiException e) { - log.error(e); - } - } - - if (contentChangedListener != null) { - this.contentChangedListener = null; - } - - if (editorInputChangedListener != null) { - this.editorInputChangedListener.dispose(); - this.editorInputChangedListener = null; - } - - if (gefAdaptorDelegate != null) { - gefAdaptorDelegate.dispose(); - gefAdaptorDelegate = null; - } - - transactionalEditingDomain = null; - resourceSet = null; - undoContext = null; - saveAndDirtyService = null; - sashModelMngr = null; - } - - void initContents() throws PartInitException { - loadModelAndServices(); - loadNestedEditors(); - } - - @Override - public void setFocus() { - super.setFocus(); - - DeferredReload reload = pendingReload.get(); - if (reload != null) { - reload.reload(); - } - } - - private void doReload() throws CoreException { - final IWorkbenchPage page = getSite().getPage(); - final IWorkbenchPart activePart = page.getActivePart(); - final IEditorPart activeEditor = page.getActiveEditor(); - - final Iterable listeners = ImmutableList.copyOf(reloadListeners); - final EditorReloadEvent event = new EditorReloadEvent(CoreMultiDiagramEditor.this); - - try { - event.dispatchEditorAboutToReload(listeners); - - deactivate(); - - initContents(); - - activate(); - - // My self-listener will be first, to ensure that the pages are all restored before dependents run - event.dispatchEditorReloaded(listeners); - } finally { - event.dispose(); - - // Ensure that the editor previously active is active again (if it still exists) - if ((activeEditor != null) && page.isPartVisible(activeEditor)) { - page.activate(activeEditor); - } - - // Ensure that the part previously active is active again (if it still exists and is not the active editor) - if ((activePart != null) && (activePart != activeEditor) && page.isPartVisible(activePart)) { - page.activate(activePart); - } - } - - } - - /** - * Overrides doSave. - * - * {@inheritDoc} - * - * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public void doSave(IProgressMonitor monitor) { - - saveAndDirtyService.doSave(monitor); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDirty() { - // May happen if the editor has not yet been initialized. In this case, the editor cannot be dirty, so we simply return false. - // Bug 410286: The isDirty() method can also be called /after/ the editor has been disposed. Most likely an Eclipse bug? - if (saveAndDirtyService == null) { - return false; - } - return saveAndDirtyService.isDirty(); - } - - /** - * Overrides doSaveAs. - * - * {@inheritDoc} - * - * @see org.eclipse.ui.part.EditorPart#doSaveAs() - */ - @Override - public void doSaveAs() { - - saveAndDirtyService.doSaveAs(); - } - - /** - * Overrides isSaveAsAllowed. - * - * {@inheritDoc} - * - * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * Overrides getContributorId. - * - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId() - */ - @Override - public String getContributorId() { - // return Activator.PLUGIN_ID; - return "TreeOutlinePage"; - - } - - // implements IDiagramWorkbenchPart to restore GMF standard behavior - // and delegate to the activeEditor - - /** - * Overrides getDiagram. - * - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagram() - */ - // public org.eclipse.gmf.runtime.notation.Diagram getDiagram() { - // IEditorPart activeEditor = getActiveEditor(); - // if(activeEditor instanceof DiagramEditor) { - // return ((DiagramEditor)activeEditor).getDiagram(); - // } else { - // return null; - // } - // } - - /** - * This method is called from a GMF diagram. It should only be called from GMF diagram code. Normally, the Diagram under the Mouse is a GMF - * Diagram. The active Diagram can be another Diagram, not - * under the mouse. This is a GMF issue. - */ - // public DiagramEditPart getDiagramEditPart() { - // - // // Get the editor under the mouse - // // IEditorPart activeEditor = rootContainer.getEditorUnderMouse(); - // IEditorPart activeEditor = getActiveEditor(); - // if(activeEditor == null) { - // return null; - // } - // // IEditorPart activeEditor = getActiveEditor(); - // if(activeEditor instanceof DiagramEditor) { - // return ((DiagramEditor)activeEditor).getDiagramEditPart(); - // } else { - // // This case should never happen. - // // Return null, as the GMF runtime now support it (since 093009) - // return null; - // } - // } - - /** - * Overrides getDiagramGraphicalViewer. - * - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagramGraphicalViewer() - */ - // public IDiagramGraphicalViewer getDiagramGraphicalViewer() { - // IEditorPart activeEditor = getActiveEditor(); - // if(activeEditor instanceof DiagramEditor) { - // return ((DiagramEditor)activeEditor).getDiagramGraphicalViewer(); - // } else { - // return null; - // } - // } - - /** - * Overrides getEditingDomain. - * - * {@inheritDoc} - * - * @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain() - */ - @Override - public EditingDomain getEditingDomain() { - return transactionalEditingDomain; - } - - /** - * Throws an UnsupportedOperationException. - * - * @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getDiagramEditDomain() - */ - // public DiagramEditDomain getDiagramEditDomain() { - // throw new UnsupportedOperationException("Not implemented. Should not be called."); - // } - - - /** - * Change the editor input.
- * Note: that method should be called within the UI-Thread. - * - * @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#setEditorInput(org.eclipse.ui.IEditorInput) - * - * @param newInput - * The new input - * @deprecated Not used anymore - */ - - @Override - @Deprecated - public void setEditorInput(IEditorInput newInput) { - setInputWithNotify(newInput); - setPartName(newInput.getName()); - } - - @Override - @Deprecated - public void gotoMarker(IMarker marker) { - IWorkbench wb = PlatformUI.getWorkbench(); - IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage(); - boolean first = true; - for (IViewReference view : page.getViewReferences()) { - // no longer restrict to model explorer (see bug 387578) - IWorkbenchPart part = view.getPart(false); - if (part instanceof IGotoMarker) { - // activate first view implementing the IGotoMarker interface - if (first) { - page.activate(view.getPart(false)); - first = false; - } - ((IGotoMarker) part).gotoMarker(marker); - } - } - } - - private boolean needsRefresh; - - protected void scheduleRefresh() { - needsRefresh = true; - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - refreshTabs(); - } - }); - } - - @Override - protected void refreshTabs() { - if (!needsRefresh) { - return; - } - needsRefresh = false; - super.refreshTabs(); - } - - @Override - public synchronized IEditorPart getActiveEditor() { - refreshTabs(); - return super.getActiveEditor(); - } - - private final class DeferredReload extends IReloadableEditor.Adapter { - - private final Collection triggeringResources; - - private final ReloadReason reason; - - private final DirtyPolicy dirtyPolicy; - - DeferredReload(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) { - super(CoreMultiDiagramEditor.this); - - this.triggeringResources = ImmutableSet.copyOf(triggeringResources); - this.reason = reason; - this.dirtyPolicy = dirtyPolicy; - } - - void reload() { - try { - reloadEditor(triggeringResources, reason, dirtyPolicy); - } catch (CoreException e) { - // Failed to properly unload/load in place, so just close - getSite().getPage().closeEditor(CoreMultiDiagramEditor.this, false); - - StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG | StatusManager.SHOW); - } - } - - @Override - public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { - if (!pendingReload.compareAndSet(this, null)) { - return; - } - - final DirtyPolicy action = dirtyPolicy.resolve(CoreMultiDiagramEditor.this, triggeringResources, reason); - - if ((action == DirtyPolicy.SAVE) && isDirty()) { - doSave(new NullProgressMonitor()); - } - - switch (action) { - case SAVE: - case DO_NOT_SAVE: - if (reason.shouldReload(triggeringResources)) { - // Attempt to re-load - doReload(); - } else { - // Just close 'er down - getSite().getPage().closeEditor(CoreMultiDiagramEditor.this, false); - } - break; - case IGNORE: - // Pass - break; - default: - throw new IllegalArgumentException("Invalid resolution of editor re-load dirty policy: " + action); //$NON-NLS-1$ - } - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelManagerServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelManagerServiceFactory.java deleted file mode 100644 index 0abcbbdc5ac..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelManagerServiceFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 Cedric Dumoulin. - * - * - * 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editorsfactory.PageModelFactoryRegistry; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.PluggableEditorFactoryReader; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * Service Factory to create the {@link DiSashModelManager} service. - * - * @author cedric dumoulin - * - */ -public class DiSashModelManagerServiceFactory implements IServiceFactory { - - private TransactionalEditingDomain transactionalEditingDomain; - - private SashModel sashModel; - - private DiSashModelManager sashModelMngr; - - private ServicesRegistry servicesRegistry; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - - this.servicesRegistry = servicesRegistry; - // Get required service - transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); - - // Get the model holding the contentProvider - sashModel = SashModelUtils.getSashModelChecked(servicesRegistry); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - - // Read declared editors - PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); - PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); - editorReader.populate(pageModelRegistry, servicesRegistry); - - if (sashModel.getResource() == null) { - throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service."); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // create the service - sashModelMngr = new DiSashModelManager(pageModelRegistry, sashModel.getResource(), transactionalEditingDomain); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() - * - * @return - * @throws ServiceException - */ - @Override - public Object createServiceInstance() throws ServiceException { - - // Start locally the service if needed. - // Question: Can createServiceInstance() method be called before - // startService() is called ? - if (sashModelMngr == null) { - startService(); - } - - return sashModelMngr; - } - - - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelMngrServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelMngrServiceFactory.java deleted file mode 100644 index 3e0a643c6c4..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelMngrServiceFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editorsfactory.PageModelFactoryRegistry; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.PluggableEditorFactoryReader; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * Service Factory to create the {@link DiSashModelMngr} service. - * - * @author cedric dumoulin - * - */ -public class DiSashModelMngrServiceFactory implements IServiceFactory { - - private TransactionalEditingDomain transactionalEditingDomain; - - private SashModel sashModel; - - private DiSashModelMngr sashModelMngr; - - private ServicesRegistry servicesRegistry; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - - this.servicesRegistry = servicesRegistry; - // Get required service - transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); - - // Get the model holding the contentProvider - sashModel = SashModelUtils.getSashModelChecked(servicesRegistry); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - - // Read declared editors - PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); - PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); - editorReader.populate(pageModelRegistry, servicesRegistry); - - if (sashModel.getResource() == null) { - throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service."); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // create the service - sashModelMngr = new DiSashModelMngr(pageModelRegistry, sashModel.getResource()); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() - * - * @return - * @throws ServiceException - */ - @Override - public Object createServiceInstance() throws ServiceException { - - // Start locally the service if needed. - // Question: Can createServiceInstance() method be called before - // startService() is called ? - if (sashModelMngr == null) { - startService(); - } - - return sashModelMngr; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IMultiDiagramEditor.java deleted file mode 100644 index 47f58f46653..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IMultiDiagramEditor.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; - -/** - * Interface implemented by the main multipage editor. This interface list the - * methods available to diagram editors. Diagram editors can relies on this - * interface to retrieve services from the main multi diagram editor.
- * This interface should stay minimalist, as the editor is not designed to - * handle the services itself. A service should be retrieved by using {@link #getServicesRegistry()}. - * - * - * @author cedric dumoulin - * - * TODO remove extends IEditingDomainProvider. This interface should be - * independant of any technology (EMF, GMF, ...). If the EditingDomain - * is required, it can be retrieved by the registry. - * - */ -public interface IMultiDiagramEditor extends IEditorPart { - - /** - * Returns the service registry associated to the editor. - * - * @return the servicesRegistry The registry. - */ - public ServicesRegistry getServicesRegistry(); - - /** - * Return the editor site. - * - * @return - */ - @Override - public IEditorSite getEditorSite(); - - /** - * Get the editor input. - * - * @return - */ - @Override - public IEditorInput getEditorInput(); - - /** - * Change the editor input. - * - * @param newInput - * The new input. - * @deprecated No replacement. Input can't be changed on multi editors. - */ - @Deprecated - public void setEditorInput(IEditorInput newInput); - - /** - * Returns the edit domain shared among editors - * - * @return the edit domain shared among editors - * @deprecated Use {@link #getServicesRegistry()} or {@link #getAdapter(Class)} - */ - // FIXME Remove it (GMF dependency) - // public DiagramEditDomain getDiagramEditDomain(); - - /** - * Get the currently active nested Editor. - */ - public IEditorPart getActiveEditor(); - - /** - * Get the property sheet page associated to the Editor. - * - * @return the property sheet page associated to the Editor. - * @deprecated Use {@link #getServicesRegistry()} or {@link #getAdapter(Class)} - */ - // @Deprecated - // public IPropertySheetPage getPropertySheetPage(); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IPapyrusPageInput.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IPapyrusPageInput.java deleted file mode 100644 index 25cdd3c90a6..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IPapyrusPageInput.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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.editor; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; - -/** - * An IEditorInput used to reference the page(s) to open - * - * @author Camille Letavernier - * - */ -public interface IPapyrusPageInput extends IEditorInput { - - /** - * @return the list of pages to open - */ - public URI[] getPages(); - - /** - * - * @return true if the editor should close all other pages - */ - public boolean closeOtherPages(); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IReloadableEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IReloadableEditor.java deleted file mode 100644 index 56f007f013b..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/IReloadableEditor.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor; - -import java.util.Collection; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; -import org.eclipse.papyrus.infra.tools.util.UIUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IURIEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.ide.IDE; - - -/** - * An {@linkplain IAdaptable adapter protocol} for editors that know how to internally - * reload themselves without disturbing the workbench window's perspective layout. - */ -public interface IReloadableEditor { - - /** - * Reloads me in-place in the perspective layout. - * - * @param triggeringResources - * the resources that have changed in some way, triggering re-load - * @param reason - * the reason why the re-load is being requested - * @param dirtyPolicy - * how the client would like to handle the case of a dirty editor - * - * @throws CoreException - * on any failure to unload, reload, or whatever - */ - void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException; - - void addEditorReloadListener(IEditorReloadListener listener); - - void removeEditorReloadListener(IEditorReloadListener listener); - - /** - * An enumeration of the reason why some resources that an editor has loaded are triggering a re-load (or close). - */ - enum ReloadReason { - /** Resources have changed in persistent storage. */ - RESOURCES_CHANGED, - /** Resources have been deleted from persistent storage. */ - RESOURCES_DELETED; - - /** - * Queries whether, under ordinary circumstances, the editor should attempt to re-load to pick up changes in its dependent resources. - * - * @param triggeringResources - * the resources triggering re-load (or close) - * - * @return whether the editor should re-load - */ - public boolean shouldReload(Collection triggeringResources) { - return this != RESOURCES_DELETED; - } - } - - /** - * An enumeration of policies that clients may request to govern what to do with the editor before re-load (or close) if it should happen to be - * dirty. Note that editors are free to honour the requested policy or not, according to their needs. - */ - enum DirtyPolicy { - /** - * Save the editor without prompting. - */ - SAVE, - /** - * Do not save the editor; just discard pending changes and re-load (or close). - */ - DO_NOT_SAVE, - /** - * Do not re-load (or close) the editor; just keep pending changes and deal with conflicts later. - */ - IGNORE, - /** - * Prompt the user to inquire whether to save, discard pending changes, or not re-load (or close) at all. - * Note that the user prompt must always result in one of the other policies being actually applied. - */ - PROMPT_TO_SAVE - { - - @Override - public DirtyPolicy resolve(IEditorPart editor, final Collection triggeringResources, final ReloadReason reason) throws CoreException { - final boolean dirty = editor.isDirty(); - - if (!dirty) { - if (reason.shouldReload(triggeringResources)) { - // Just re-load it. Simple - return DO_NOT_SAVE; - } else if (isPrincipalResourceAffected(editor, triggeringResources)) { - // Just close it. Also simple - return DO_NOT_SAVE; - } - } - - final String editorName = getEditorName(editor); - - final boolean allReadOnly = allReadOnly(triggeringResources); - final String promptTitle; - final String promptIntro; - final String saveOption; - final String dontSaveOption; - final String ignoreOption = "Ignore"; - - switch (reason) { - case RESOURCES_DELETED: - promptTitle = "Resources Deleted"; - promptIntro = NLS.bind("Some resources used by \"{0}\" have been deleted.", editorName); - saveOption = "Save and Close"; - dontSaveOption = "Close Editor"; - break; - default: - promptTitle = "Resources Changed"; - promptIntro = NLS.bind("Some resources used by \"{0}\" have changed.", editorName); - saveOption = "Save and Re-open"; - dontSaveOption = "Re-open Editor"; - break; - } - - Callable result; - - if (allReadOnly) { - // Only read-only models have changed. We (most likely) won't save them within this current editor. As they are already loaded, we can just continue. - result = new Callable() { - - @Override - public DirtyPolicy call() { - Shell parentShell = Display.getCurrent().getActiveShell(); - - final String message; - final String[] options; - if (dirty) { - message = promptIntro + " Note: all these resources are loaded in read-only mode and won't be overridden if you choose to save. Unsaved changes will be lost."; - options = new String[] { saveOption, dontSaveOption, ignoreOption }; - } else { - message = promptIntro; - options = new String[] { dontSaveOption, ignoreOption }; - } - - final MessageDialog dialog = new MessageDialog(parentShell, promptTitle, null, message, MessageDialog.WARNING, options, 0) { - - @Override - protected void setShellStyle(int newShellStyle) { - super.setShellStyle(newShellStyle | SWT.SHEET); - } - }; - final int answer = dialog.open(); - - DirtyPolicy result; - - if (answer == SWT.DEFAULT) { - // User hit Esc or dismissed the dialog with the window manager button. Ignore - result = IGNORE; - } else if (dirty) { - result = values()[answer]; - } else { - result = values()[answer + 1]; // Account for the missing "Save and Xxx" option - } - - return result; - } - }; - } else { - // At least one read-write resource has changed. Potential conflicts. - result = new Callable() { - - @Override - public DirtyPolicy call() { - DirtyPolicy result = IGNORE; - - final Shell parentShell = Display.getCurrent().getActiveShell(); - final String action = reason.shouldReload(triggeringResources) ? "re-open" : "close"; - final String message; - - if (dirty) { - message = promptIntro + NLS.bind(" Do you wish to {0} the current editor? Unsaved changes will be lost.", action); - } else { - message = promptIntro + NLS.bind(" Do you wish to {0} the current editor?", action); - } - - final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; - final MessageDialog dialog = new MessageDialog(parentShell, promptTitle, null, message, MessageDialog.WARNING, options, 0) { - - @Override - protected void setShellStyle(int newShellStyle) { - super.setShellStyle(newShellStyle | SWT.SHEET); - } - }; - if (dialog.open() == 0) { - result = DO_NOT_SAVE; - } - - return result; - } - }; - } - - try { - return UIUtil.syncCall(result).get(); - } catch (ExecutionException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to determine dirty policy for editor re-load.", e)); - } catch (InterruptedException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Interrupted in determining dirty policy for editor re-load.", e)); - } - } - }; - - /** - * Queries the default dirty policy currently in effect. The default-default is {@link #PROMPT_TO_SAVE}. - * - * @return the default policy - */ - public static DirtyPolicy getDefault() { - return PROMPT_TO_SAVE; - } - - /** - * Resolves me to a specific actionable policy, based on the resources that are triggering re-load (or close) and the reason. - * - * @param editor - * the editor to be re-loaded - * @param triggeringResources - * the resources (possibly an empty collection) that have changed - * @param reloadReason - * the reason why re-load (or close) is triggered - * - * @return the specific policy to implement in re-loading the editor - * - * @throws CoreException - * on failure to resolve the specific policy - */ - public DirtyPolicy resolve(IEditorPart editor, Collection triggeringResources, ReloadReason reason) throws CoreException { - return this; - } - - String getEditorName(IEditorPart editor) { - ModelSet modelSet = getModelSet(editor); - return (modelSet == null) ? editor.getTitle() : modelSet.getURIWithoutExtension().lastSegment(); - } - - private ModelSet getModelSet(IEditorPart editor) { - ModelSet result = null; - - if (editor instanceof IMultiDiagramEditor) { - try { - result = ((IMultiDiagramEditor) editor).getServicesRegistry().getService(ModelSet.class); - } catch (ServiceException e) { - // No problem. We have a fall-back - Activator.log.error(e); - } - } - - return result; - } - - boolean isPrincipalResourceAffected(IEditorPart editor, Collection triggeringResources) { - boolean result = false; - - ModelSet modelSet = getModelSet(editor); - if (modelSet != null) { - URI principalURI = modelSet.getURIWithoutExtension(); - for (Resource next : triggeringResources) { - if (next.getURI().trimFileExtension().equals(principalURI)) { - result = true; - break; - } - } - } else { - URI principalURI = getURI(editor.getEditorInput()); - if (principalURI != null) { - for (Resource next : triggeringResources) { - if (next.getURI().equals(principalURI)) { - result = true; - break; - } - } - } - } - - return result; - } - - private URI getURI(IEditorInput input) { - URI result = null; - - if (input instanceof URIEditorInput) { - result = ((URIEditorInput) input).getURI(); - } else if (input instanceof IURIEditorInput) { - result = URI.createURI(((IURIEditorInput) input).getURI().toString()); - } - - return result; - } - - protected boolean allReadOnly(Collection resources) { - for (Resource resource : resources) { - EditingDomain domain = TransactionUtil.getEditingDomain(resource); - if ((domain == null) || !domain.isReadOnly(resource)) { - return false; - } - } - - return true; - } - } - - /** - * A convenience adapter for editors that don't actually know how to reload themselves in place. - * It simply closes the editor and then opens it again on the original input. - */ - class Adapter implements IReloadableEditor { - - private final IEditorPart editor; - - public Adapter(IEditorPart editor) { - super(); - - this.editor = editor; - } - - public static IReloadableEditor getAdapter(IMultiDiagramEditor editor) { - return AdapterUtils.adapt(editor, IReloadableEditor.class, new Adapter(editor)); - } - - @Override - public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { - final IWorkbenchPage page = editor.getSite().getPage(); - final IEditorInput currentInput = editor.getEditorInput(); - - final Display display = editor.getSite().getShell().getDisplay(); - - final String editorId = editor.getSite().getId(); - - final DirtyPolicy action = dirtyPolicy.resolve(editor, triggeringResources, reason); - final boolean save = action == DirtyPolicy.SAVE; - - if (save && editor.isDirty()) { - editor.doSave(new NullProgressMonitor()); - } - - if (action != DirtyPolicy.IGNORE) { - page.closeEditor(editor, save); - - // If resources were deleted, we close and don't re-open - if (reason.shouldReload(triggeringResources)) { - display.asyncExec(new Runnable() { - - @Override - public void run() { - try { - IDE.openEditor(page, currentInput, editorId); - } catch (PartInitException ex) { - Activator.log.error(ex); - } - } - }); - } - } - } - - @Override - public void addEditorReloadListener(IEditorReloadListener listener) { - // Don't need to track these listeners because I never properly reload an editor - } - - @Override - public void removeEditorReloadListener(IEditorReloadListener listener) { - // Don't need to track these listeners because I never properly reload an editor - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramEditorSelectionContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramEditorSelectionContext.java deleted file mode 100644 index be2a1329eea..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramEditorSelectionContext.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor; - -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.reload.CompositeReloadContext; -import org.eclipse.papyrus.infra.core.editor.reload.DelegatingReloadContext; -import org.eclipse.papyrus.infra.core.editor.reload.EMFSelectionContext; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IComponentPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - - -/** - * A {@linkplain EditorReloadEvent reload event} context that restores the selection of which editor page - * is active in an {@link IMultiDiagramEditor} that is reloaded and delegates to its pages to capture - * re-load context for each to restore whatever they need to restore (internal selections etc.). - */ -class MultiDiagramEditorSelectionContext extends CompositeReloadContext { - - private ISashWindowsContainer sashContainer; - - private final List resourcesToLoad; - - MultiDiagramEditorSelectionContext(IMultiDiagramEditor editor) { - super(); - - init(editor); - - resourcesToLoad = computeResourcesToLoad(editor); - - IPage active = sashContainer.getActiveSashWindowsPage(); - DiagramPageContext activePage = null; - - Set visiblePages = Sets.newIdentityHashSet(); - visiblePages.addAll(sashContainer.getVisiblePages()); - - List allPages = getAllPages(sashContainer); - - for (IPage page : allPages) { - final DelegatingReloadContext delegator = (page instanceof IEditorPage) ? add(new DelegatingReloadContext(((IEditorPage) page).getIEditorPart())) : null; - DiagramPageContext context; - - if (page == active) { - // This one will have the selection of the active page - context = new DiagramPageContext(new VisiblePageSelectionProvider(page), page, delegator); - activePage = context; - } else { - if (visiblePages.contains(page)) { - // This one must be selected in its folder in order to make it visible again - context = new DiagramPageContext(new VisiblePageSelectionProvider(page), page, delegator); - } else { - context = new DiagramPageContext(EmptySelectionProvider.INSTANCE, page, delegator); - } - - // We make sure always to restore the active page last - // so that it will not only be visible but also the - // over-all active page - add(context); - } - } - - if (activePage != null) { - // Restore this one last - add(activePage); - } - } - - @Override - public void dispose() { - sashContainer = null; - super.dispose(); - } - - private List getAllPages(ISashWindowsContainer container) { - final List result = Lists.newArrayList(); - - container.visit(new IPageVisitor() { - - @Override - public void accept(IEditorPage page) { - result.add(page); - } - - @Override - public void accept(IComponentPage page) { - result.add(page); - } - }); - - return result; - } - - private void init(IMultiDiagramEditor editor) { - sashContainer = AdapterUtils.adapt(editor, ISashWindowsContainer.class, null); - } - - void restore(IMultiDiagramEditor editor) { - init(editor); - - // Forcibly re-load all previously loaded resources to that - // (a) we don't lose imports that weren't yet used, and - // (b) we can restore selections in resources that wouldn't be loaded until proxies resolve later - reloadResources(editor); - - ISelectionProvider selectionProvider = new VisiblePageSelectionProvider(); - for (DiagramPageContext next : getReloadContexts(DiagramPageContext.class)) { - next.restore(selectionProvider); - } - } - - protected List computeResourcesToLoad(IMultiDiagramEditor editor) { - List result = null; - - ResourceSet rset = getResourceSet(editor); - if (rset != null) { - result = Lists.newArrayListWithCapacity(rset.getResources().size()); - - for (Resource next : rset.getResources()) { - if (next.isLoaded()) { - result.add(next.getURI()); - } - } - } - - return result; - } - - protected void reloadResources(IMultiDiagramEditor editor) { - if (resourcesToLoad != null) { - ResourceSet rset = getResourceSet(editor); - if (rset != null) { - for (URI next : resourcesToLoad) { - try { - rset.getResource(next, true); - } catch (Exception e) { - Activator.log.error("Failed to restore loaded resource: " + next, e); //$NON-NLS-1$ - } - } - } - } - } - - protected final ResourceSet getResourceSet(IMultiDiagramEditor editor) { - ResourceSet result = null; - - EditingDomain editingDomain = (EditingDomain) editor.getAdapter(EditingDomain.class); - if (editingDomain != null) { - result = editingDomain.getResourceSet(); - } - - return result; - } - - // - // Nested types - // - - private class DiagramPageContext extends EMFSelectionContext { - - private URI pageRef; - - private DelegatingReloadContext pageContext; - - DiagramPageContext(ISelectionProvider structuredSelectionProvider, IPage page, DelegatingReloadContext pageContext) { - super(structuredSelectionProvider); - - this.pageContext = pageContext; - this.pageRef = getToken(page.getRawModel()); - } - - @Override - public void restore(ISelectionProvider structuredSelectionProvider) { - IPage page = sashContainer.lookupModelPage(resolveToken(pageRef)); - - if ((pageContext != null) && (page instanceof IEditorPage)) { - pageContext.restore(((IEditorPage) page).getIEditorPart()); - } - - super.restore(structuredSelectionProvider); - } - - @Override - protected Object deresolveSelectableElement(Object selectableElement) { - return (selectableElement instanceof IPage) ? ((IPage) selectableElement).getRawModel() : super.deresolveSelectableElement(selectableElement); - } - - @Override - protected Object resolveSelectableElement(Object deresolved) { - return sashContainer.lookupModelPage(deresolved); - } - } - - private static class EmptySelectionProvider implements ISelectionProvider { - - static final EmptySelectionProvider INSTANCE = new EmptySelectionProvider(); - - EmptySelectionProvider() { - super(); - } - - @Override - public ISelection getSelection() { - return StructuredSelection.EMPTY; - } - - @Override - public void setSelection(ISelection selection) { - // Pass - } - - @Override - public void addSelectionChangedListener(ISelectionChangedListener listener) { - // Not needed because the selection is always empty - } - - @Override - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - // Not needed because the selection is always empty - } - - } - - private class VisiblePageSelectionProvider implements ISelectionProvider { - - private final IStructuredSelection selection; - - VisiblePageSelectionProvider() { - this(null); - } - - VisiblePageSelectionProvider(IPage visible) { - super(); - - this.selection = (visible == null) ? StructuredSelection.EMPTY : new StructuredSelection(visible); - } - - @Override - public ISelection getSelection() { - return selection; - } - - @Override - public void setSelection(ISelection selection) { - if (!selection.isEmpty()) { - IPage page = (IPage) ((IStructuredSelection) selection).getFirstElement(); - sashContainer.selectPage(page); - } - } - - @Override - public void addSelectionChangedListener(ISelectionChangedListener listener) { - // Not needed - } - - @Override - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - // Not needed - } - - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java deleted file mode 100644 index 75f4962b214..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java +++ /dev/null @@ -1,178 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Christian W. Damus - bug 469188 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener; -import org.eclipse.papyrus.infra.core.operation.DelegatingUndoContext; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.papyrus.infra.tools.util.PlatformHelper; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IStorageEditorInput; -import org.eclipse.ui.IURIEditorInput; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.operations.RedoActionHandler; -import org.eclipse.ui.operations.UndoActionHandler; -import org.eclipse.ui.part.IShowInSource; -import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.views.properties.PropertyShowInContext; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - - -/** - * A specialized property-sheet page that knows how to restore the Property Sheet view's input from the workbench part - * that most recently gave it its input, after a {@link CoreMultiDiagramEditor} has been re-loaded. - */ -class MultiDiagramPropertySheetPage extends TabbedPropertySheetPage implements IEditorReloadListener { - - private final CoreMultiDiagramEditor multiDiagramEditor; - - private UndoActionHandler undo; - private RedoActionHandler redo; - private DelegatingUndoContext undoContext; - - public MultiDiagramPropertySheetPage(CoreMultiDiagramEditor editor) { - super(editor); - - this.multiDiagramEditor = editor; - IReloadableEditor.Adapter.getAdapter(editor).addEditorReloadListener(this); - } - - @Override - public void dispose() { - IReloadableEditor.Adapter.getAdapter(multiDiagramEditor).removeEditorReloadListener(this); - - if (undo != null) { - undo.dispose(); - } - if (redo != null) { - redo.dispose(); - } - - super.dispose(); - } - - @Override - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if (selection.isEmpty() && (part instanceof IMultiDiagramEditor)) { - // Perhaps the user selected a page such as the Welcome Page that - // isn't an editor and so doesn't have a selection - IMultiDiagramEditor editor = (IMultiDiagramEditor) part; - ISashWindowsContainer sash = editor.getAdapter(ISashWindowsContainer.class); - if (sash != null) { - if ((sash.getActiveEditor() == null) && (sash.getActiveSashWindowsPage() != null)) { - // Yep, that's the case, here. So show the properties of the input - // resource (usually a DI file) - IEditorInput input = editor.getEditorInput(); - Object newSelection; - if (input instanceof IFileEditorInput) { - newSelection = ((IFileEditorInput) input).getFile(); - } else if (input instanceof IStorageEditorInput) { - IStorageEditorInput storageInput = (IStorageEditorInput) input; - try { - newSelection = storageInput.getStorage(); - } catch (CoreException e) { - newSelection = storageInput; - } - } else if (input instanceof IURIEditorInput) { - newSelection = ((IURIEditorInput) input).getURI(); - } else if (input instanceof URIEditorInput) { - newSelection = ((URIEditorInput) input).getURI(); - } else { - newSelection = null; - } - - if (newSelection != null) { - selection = new StructuredSelection(newSelection); - } - } - } - } - - super.selectionChanged(part, selection); - } - - @Override - public void editorAboutToReload(EditorReloadEvent event) { - Object propertySheet = getSite().getService(IViewPart.class); - if (propertySheet instanceof IShowInSource) { - ShowInContext context = ((IShowInSource) propertySheet).getShowInContext(); - - if (context instanceof PropertyShowInContext) { - IWorkbenchPart inputPart = ((PropertyShowInContext) context).getPart(); - if (inputPart != null) { - event.putContext(inputPart); - } - } - } - } - - @Override - public void editorReloaded(EditorReloadEvent event) { - final IWorkbenchPart inputPart = (IWorkbenchPart) event.getContext(); - if (inputPart != null) { - final Object propertySheet = getSite().getService(IViewPart.class); - if (propertySheet instanceof IPartListener) { - // Kick it with this part - ((IPartListener) propertySheet).partActivated(inputPart); - - // And again later to get its new selection (we don't know when its selection may be restored relative to us) - getSite().getShell().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - ISelectionProvider selectionProvider = inputPart.getSite().getSelectionProvider(); - if (selectionProvider != null) { - ((ISelectionListener) propertySheet).selectionChanged(inputPart, selectionProvider.getSelection()); - } - } - }); - } - } - - // The editor will have a new undo context (because it will have a new editing domain) - if (undoContext != null) { - undoContext.setDelegate(PlatformHelper.getAdapter(multiDiagramEditor, IUndoContext.class)); - } - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - - undoContext = new DelegatingUndoContext(); - undoContext.setDelegate(PlatformHelper.getAdapter(multiDiagramEditor, IUndoContext.class)); - - undo = new UndoActionHandler(multiDiagramEditor.getSite(), undoContext); - redo = new RedoActionHandler(multiDiagramEditor.getSite(), undoContext); - - actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo); - actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo); - } - - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageIconRegistryServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageIconRegistryServiceFactory.java deleted file mode 100644 index 56ec0d85d86..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageIconRegistryServiceFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry; -import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.PluggableEditorFactoryReader; -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * Service Factory to register {@link IPageIconsRegistry}. - * - * @author cedric dumoulin - * - */ -public class PageIconRegistryServiceFactory implements IServiceFactory { - - private PageIconsRegistry pageIconsRegistry; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - if (pageIconsRegistry != null) { - pageIconsRegistry.dispose(); - } - } - - /** - * Create and populate a {@link PageIconsRegistry}. Return it as the service - * instance. - * - * @return - */ - @Override - public Object createServiceInstance() { - if (pageIconsRegistry == null) { - pageIconsRegistry = new PageIconsRegistry(); - PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); - editorReader.populate(pageIconsRegistry); - } - return pageIconsRegistry; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageMngrServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageMngrServiceFactory.java deleted file mode 100644 index f4357afdd44..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PageMngrServiceFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2014 LIFL, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * LIFL - Initial API and implementation - * Christian W. Damus - bug 415638 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.editor; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * A service factory to create the {@link IPageMngr} service. This - * serviceFactory depends on {@link ISashWindowsContentProvider} service. - * - * @author cedric dumoulin - * - */ -public class PageMngrServiceFactory implements IServiceFactory { - - /** - * The sashModelMangr. - */ - private DiSashModelManager sashModelMngr; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - - // Get required services - sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() - * - * @return - * @throws ServiceException - * if the required sash model manager service is unavailable - */ - @Override - public Object createServiceInstance() throws ServiceException { - if (sashModelMngr == null) { - throw new ServiceNotFoundException(DiSashModelManager.class.getName()); - } - return sashModelMngr.getIPageMngr(); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PapyrusPageInput.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PapyrusPageInput.java deleted file mode 100644 index 301b9ab9384..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/PapyrusPageInput.java +++ /dev/null @@ -1,62 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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.editor; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.part.FileEditorInput; - -/** - * Basic implementation of {@link IPapyrusPageInput} - * - * @author Camille Letavernier - */ -public class PapyrusPageInput extends FileEditorInput implements IPapyrusPageInput { - - private final URI[] pages; - - private final boolean closeOtherPages; - - /** - * Creates a new PapyrusPageInput - * - * @param diFile - * The file resource - * @param pages - * The pageIdentifiers of the pages to open - * @param closeOtherPages - * True if only the selected pages should be opened. All other pages will be closed. - */ - public PapyrusPageInput(IFile diFile, URI[] pages, boolean closeOtherPages) { - super(diFile); - this.pages = pages; - this.closeOtherPages = closeOtherPages; - } - - /** - * {@inheritDoc} - */ - @Override - public URI[] getPages() { - return pages; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean closeOtherPages() { - return closeOtherPages; - } - - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/CompositeReloadContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/CompositeReloadContext.java deleted file mode 100644 index b7cd92215c0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/CompositeReloadContext.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - - -/** - * An {@linkplain EditorReloadEvent#putContext(Object) editor reload context} that composes other reload contexts. - * This should be used whenever a {@linkplain IReloadContextProvider reload context provider} supplies multiple - * reload contexts, to ensure that they are properly initialized by the reload system. - */ -public class CompositeReloadContext implements IDisposableReloadContext, IAdaptable { - - private final Collection reloadContexts; - - public CompositeReloadContext() { - this(Collections.EMPTY_LIST); - } - - public CompositeReloadContext(Iterable reloadContexts) { - super(); - - this.reloadContexts = Lists.newArrayList(reloadContexts); - } - - public T add(T reloadContext) { - reloadContexts.add(reloadContext); - return reloadContext; - } - - public Iterable getReloadContexts() { - return Collections.unmodifiableCollection(reloadContexts); - } - - public Iterable getReloadContexts(Class type) { - return Iterables.filter(getReloadContexts(), type); - } - - @Override - public void dispose() { - for (Object next : reloadContexts) { - if (next instanceof IDisposableReloadContext) { - ((IDisposableReloadContext) next).dispose(); - } - } - - reloadContexts.clear(); - } - - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; - } - - private IInternalEMFSelectionContext getEMFContext() { - IInternalEMFSelectionContext result = null; - - for (Object next : reloadContexts) { - if (AdapterUtils.adapt(next, IInternalEMFSelectionContext.class, null) != null) { - // We need the adapter - result = new IInternalEMFSelectionContext.Composite(this); - break; - } - } - - return result; - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/DelegatingReloadContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/DelegatingReloadContext.java deleted file mode 100644 index 76b377df4e4..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/DelegatingReloadContext.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; - - -/** - * An {@linkplain EditorReloadEvent#putContext(Object) editor reload context} that delegates to another reload context. - * This should be used whenever a {@linkplain IReloadContextProvider reload context provider} is needed to get a reload - * context to delegate to. - */ -public class DelegatingReloadContext implements IDisposableReloadContext, IAdaptable { - - private Object delegate; - - public DelegatingReloadContext(Object reloadContextProvider) { - super(); - - IReloadContextProvider provider = AdapterUtils.adapt(reloadContextProvider, IReloadContextProvider.class, null); - if (provider != null) { - delegate = provider.createReloadContext(); - } - } - - @Override - public void dispose() { - if (delegate instanceof IDisposableReloadContext) { - ((IDisposableReloadContext) delegate).dispose(); - } - - delegate = null; - } - - public Object getDelegate() { - return delegate; - } - - public void restore(Object reloadContextProvider) { - if (delegate != null) { - IReloadContextProvider provider = AdapterUtils.adapt(reloadContextProvider, IReloadContextProvider.class, null); - if (provider != null) { - provider.restore(delegate); - } - } - } - - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; - } - - private IInternalEMFSelectionContext getEMFContext() { - IInternalEMFSelectionContext result = null; - - if ((delegate != null) && (AdapterUtils.adapt(delegate, IInternalEMFSelectionContext.class, null) != null)) { - // We need the adapter - result = new IInternalEMFSelectionContext.Delegating(this); - } - - return result; - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFSelectionContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFSelectionContext.java deleted file mode 100644 index 2ab3f179937..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFSelectionContext.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.viewers.ISelectionProvider; - - -/** - * A convenient selection re-load context for UIs that present EMF-based content. - */ -public class EMFSelectionContext extends SelectionContext implements IAdaptable { - - private IInternalEMFSelectionContext emfContext; - - public EMFSelectionContext(ISelectionProvider structuredSelectionProvider) { - super(structuredSelectionProvider); - } - - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; - } - - final IInternalEMFSelectionContext getEMFContext() { - if (emfContext == null) { - emfContext = new IInternalEMFSelectionContext.Default(); - } - return emfContext; - } - - @Override - protected URI getToken(Object object) { - return getEMFContext().getToken(object); - } - - @Override - protected Object resolveToken(URI token) { - return getEMFContext().resolveToken(token); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFTreeViewerContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFTreeViewerContext.java deleted file mode 100644 index b7f4ea86b24..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EMFTreeViewerContext.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.viewers.AbstractTreeViewer; - -/** - * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore - * the expansion and selection state of nodes in an EMF-based tree viewer. - */ -public class EMFTreeViewerContext extends TreeViewerContext implements IAdaptable { - - private IInternalEMFSelectionContext emfContext; - - public EMFTreeViewerContext(AbstractTreeViewer viewer) { - super(viewer); - } - - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; - } - - final IInternalEMFSelectionContext getEMFContext() { - if (emfContext == null) { - emfContext = new IInternalEMFSelectionContext.Default(); - } - return emfContext; - } - - @Override - protected URI getToken(Object object) { - return getEMFContext().getToken(object); - } - - @Override - protected Object resolveToken(URI token) { - return getEMFContext().resolveToken(token); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadAdapter.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadAdapter.java deleted file mode 100644 index 51c6fdadd85..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadAdapter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - - - -/** - * Convenience superclass for selective implementation of editor reload call-backs. - */ -public class EditorReloadAdapter implements IEditorReloadListener { - - public EditorReloadAdapter() { - super(); - } - - @Override - public void editorAboutToReload(EditorReloadEvent event) { - // Pass - } - - @Override - public void editorReloaded(EditorReloadEvent event) { - // Pass - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadEvent.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadEvent.java deleted file mode 100644 index f7670fd6968..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/EditorReloadEvent.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import java.util.EventObject; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; - -import com.google.common.base.Supplier; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; - - -/** - * The event object for notifications of each phase in the reloading of a {@linkplain IReloadableEditor reloadable editor}. - */ -public class EditorReloadEvent extends EventObject { - - private static final long serialVersionUID = 1L; - - public static final int ABOUT_TO_RELOAD = 1; - - public static final int RELOADED = 2; - - private int type; - - private transient Map context; - - private transient IEditorReloadListener currentListener; - - public EditorReloadEvent(IMultiDiagramEditor editor) { - super(editor); - } - - public final IMultiDiagramEditor getEditor() { - return (IMultiDiagramEditor) getSource(); - } - - public final int getEventType() { - return type; - } - - /** - * Puts some opaque representation of contextual state for the caller to retrieve later when an editor is {@linkplain IEditorReloadListener#editorReloaded(EditorReloadEvent) reloaded}. - * The canonical example of this usage is storing state such as selection, expanded tree nodes, etc. to restore after re-building a UI that - * depends on the reloaded editor. After the editor re-load completes and all listeners are notified of that, then all context objects are - * released. Any that implement the {@link IDisposableReloadContext} interface are disposed according to that protocol. This is done even if it - * happens that the editor re-load procedure cannot complete normally and the editor is forced to close without notifying the post-reload - * listeners. - * - * @param object - * some state to stash for later retrieval following the re-loading of the editor - * - * @return the previous context object, if any (there normally wouldn't be as each listener that is invoked has its own context storage - * - * @throws IllegalStateException - * on any attempt to invoke this method except during an {@link IEditorReloadListener#editorAboutToReload(EditorReloadEvent)} call-back - */ - public Object putContext(Object object) { - checkContext(ABOUT_TO_RELOAD); - - IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(object, IInternalEMFSelectionContext.class, null); - if (emfContext != null) { - initContext(emfContext); - } - - return context.put(currentListener, object); - } - - /** - * Retrieves an opaque representation of contextual state that was previously {@linkplain #putContext(Object) put} by the caller. - * - * @return the previously stashed object, or {@code null} if none - * - * @throws IllegalStateException - * on any attempt to invoke this method except during an {@link IEditorReloadListener#editorReloaded(EditorReloadEvent)} call-back - */ - public Object getContext() { - checkContext(RELOADED); - return context.get(currentListener); - } - - private void initContext(IInternalEMFSelectionContext context) { - Supplier resourceSetSupplier = new Supplier() { - - @Override - public ResourceSet get() { - try { - return getEditor().getServicesRegistry().getService(ModelSet.class); - } catch (ServiceException e) { - Activator.log.error(e); - throw new IllegalStateException("Invalid service registry in editor"); //$NON-NLS-1$ - } - } - }; - - context.setResourceSetSupplier(resourceSetSupplier); - } - - protected final void checkContext(int phase) { - if (currentListener == null) { - throw new IllegalStateException("Not in an IEditorReloadListener call-back"); //$NON-NLS-1$ - } - - if (phase != this.type) { - throw new IllegalStateException(String.format("Not in '%s' listener call-back", (phase == ABOUT_TO_RELOAD) ? "editorAboutToReload" : "editorReloaded")); - } - } - - public final void dispatchEditorAboutToReload(Iterable listeners) { - context = Maps.newHashMap(); - type = ABOUT_TO_RELOAD; - - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - currentListener = iter.next(); - - try { - currentListener.editorAboutToReload(this); - } catch (Exception e) { - Activator.log.error("Uncaught exception in editor reload listener.", e); //$NON-NLS-1$ - } finally { - currentListener = null; - } - } - } - - public final void dispatchEditorReloaded(Iterable listeners) { - type = RELOADED; - - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - currentListener = iter.next(); - - try { - currentListener.editorReloaded(this); - } catch (Exception e) { - Activator.log.error("Uncaught exception in editor reload listener.", e); //$NON-NLS-1$ - } finally { - currentListener = null; - } - } - } - - public void dispose() { - if (context != null) { - Error error = null; - - try { - for (IDisposableReloadContext next : Iterables.filter(context.values(), IDisposableReloadContext.class)) { - try { - next.dispose(); - } catch (Exception e) { - Activator.log.error("Uncaught exception in editor reload context disposal.", e); //$NON-NLS-1$ - } catch (Error e) { - if (error == null) { - error = e; - } - Activator.log.error("Uncaught exception in editor reload context disposal.", e); //$NON-NLS-1$ - } - } - } finally { - context = null; - } - - if (error != null) { - throw error; - } - } - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IDisposableReloadContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IDisposableReloadContext.java deleted file mode 100644 index 1d1e2377788..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IDisposableReloadContext.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -/** - * Protocol implemented by {@link EditorReloadEvent} context objects that must be disposed when they are no longer needed. - * - * @see EditorReloadEvent#dispose() - */ -public interface IDisposableReloadContext { - - void dispose(); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IEditorReloadListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IEditorReloadListener.java deleted file mode 100644 index 3b4a79f2579..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IEditorReloadListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import java.util.EventListener; - -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; - - -/** - * A protocol for notification of the phases of re-loading of an {@link IReloadableEditor}. - */ -public interface IEditorReloadListener extends EventListener { - - /** - * Notifies that an editor is about to reload. Implementors may put stuff into the {@code event}'s {@link EditorReloadEvent#putContext(Object) - * context} to retrieve in an eventual {@linkplain #editorReloaded(EditorReloadEvent) }re-load} notification. The canonical example of this - * usage is storing state such as selection, expanded tree nodes, etc. to restore after re-building a UI that depends on the reloaded - * editor. - * - * @param event - * notification that an editor is going to re-load itself - */ - void editorAboutToReload(EditorReloadEvent event); - - /** - * Notifies that an editor has reloaded. Implementors may retrieve from the {@code event} any {@link EditorReloadEvent#getContext() - * context} that they put in {@linkplain #editorAboutToReload(EditorReloadEvent) before} the re-load. - * - * @param event - * notification that an editor has reloaded - */ - void editorReloaded(EditorReloadEvent event); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IInternalEMFSelectionContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IInternalEMFSelectionContext.java deleted file mode 100644 index e3480b58ddb..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IInternalEMFSelectionContext.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; - - -/** - * An internal interface provided (usually as an {@linkplain IAdaptable#getAdapter(Class) adapter}) by EMF-based {@linkplain SelectionContext - * selection contexts}. - */ -interface IInternalEMFSelectionContext { - - void setResourceSetSupplier(Supplier resourceSetSupplier); - - URI getToken(Object object); - - Object resolveToken(URI token); - - class Default implements IInternalEMFSelectionContext { - - Supplier resourceSetSupplier; - - Default() { - super(); - } - - @Override - public void setResourceSetSupplier(Supplier resourceSetSupplier) { - this.resourceSetSupplier = Suppliers.memoize(resourceSetSupplier); - } - - @Override - public URI getToken(Object object) { - return (object instanceof EObject) ? EcoreUtil.getURI((EObject) object) : null; - } - - @Override - public Object resolveToken(URI token) { - ResourceSet rset = (resourceSetSupplier == null) ? null : resourceSetSupplier.get(); - return (rset == null) ? null : rset.getEObject(token, true); - } - - } - - class Composite extends Default { - - private final CompositeReloadContext composite; - - Composite(CompositeReloadContext composite) { - super(); - - this.composite = composite; - } - - @Override - public void setResourceSetSupplier(Supplier resourceSetSupplier) { - super.setResourceSetSupplier(resourceSetSupplier); - - for (Object next : composite.getReloadContexts()) { - IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(next, IInternalEMFSelectionContext.class, null); - if (emfContext != null) { - // Pass along the memoizer so that we can all share it - emfContext.setResourceSetSupplier(this.resourceSetSupplier); - } - } - } - } - - class Delegating extends Default { - - private final DelegatingReloadContext delegating; - - Delegating(DelegatingReloadContext delegating) { - super(); - - this.delegating = delegating; - } - - @Override - public void setResourceSetSupplier(Supplier resourceSetSupplier) { - super.setResourceSetSupplier(resourceSetSupplier); - - IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(delegating.getDelegate(), IInternalEMFSelectionContext.class, null); - if (emfContext != null) { - // Pass along the memoizer so that we can all share it - emfContext.setResourceSetSupplier(this.resourceSetSupplier); - } - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IReloadContextProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IReloadContextProvider.java deleted file mode 100644 index d8432e83534..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/IReloadContextProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - - -/** - * An adapter protocol for objects that can provide {@code context}s to be included in the - * re-load state of dependent parts in an {@link EditorReloadEvent}, for the purpose of - * restoring the state of those objects after re-load has completed. - */ -public interface IReloadContextProvider { - - /** - * Creates an opaque token from which the receiver can be {@linkplain #restore(Object) restored} after the editor has reloaded. - * - * @return an opaque editor re-load context, or {@code null} if none is needed on this occasion (for example because the receiver - * is in its default state) - */ - Object createReloadContext(); - - /** - * Reloads the receiver's state from a token previously {@linkplain #createReloadContext() provided}. - * - * @param reloadContext - * the opaque re-load context token - */ - void restore(Object reloadContext); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/SelectionContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/SelectionContext.java deleted file mode 100644 index 45bc637d51f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/SelectionContext.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import java.util.List; - -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import com.google.common.collect.Lists; - -/** - * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore - * the selection state a selection provider; - * - * @param - * the type of selection provider - * @param - * the type of token used to restore the selection state - */ -public abstract class SelectionContext { - - private List selection = Lists.newArrayList(); - - public SelectionContext(V structuredSelectionProvider) { - for (Object next : ((IStructuredSelection) structuredSelectionProvider.getSelection()).toList()) { - T token = token(next); - if (token != null) { - selection.add(token); - } - } - } - - public void restore(V structuredSelectionProvider) { - List select = Lists.newArrayListWithCapacity(selection.size()); - for (T next : selection) { - Object resolved = resolve(next); - if (resolved != null) { - select.add(resolved); - } - } - setSelection(structuredSelectionProvider, select); - } - - T token(Object selectableElement) { - Object deresolved = deresolveSelectableElement(selectableElement); - return (deresolved == null) ? null : getToken(deresolved); - } - - protected Object deresolveSelectableElement(Object selectableElement) { - return selectableElement; - } - - protected abstract T getToken(Object object); - - Object resolve(T token) { - Object deresolved = resolveToken(token); - return (deresolved == null) ? null : resolveSelectableElement(deresolved); - } - - protected Object resolveSelectableElement(Object deresolved) { - return deresolved; - } - - protected abstract Object resolveToken(T token); - - protected void setSelection(V structuredSelectionProvider, List selection) { - structuredSelectionProvider.setSelection(new StructuredSelection(selection)); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/TreeViewerContext.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/TreeViewerContext.java deleted file mode 100644 index f3015a86ec2..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/reload/TreeViewerContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editor.reload; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.StructuredSelection; - -import com.google.common.collect.Lists; - -/** - * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore - * the expansion and selection state of nodes in a tree viewer. - */ -public abstract class TreeViewerContext extends SelectionContext { - - private List expandedNodes = Lists.newArrayList(); - - public TreeViewerContext(AbstractTreeViewer viewer) { - super(viewer); - - for (Object next : viewer.getExpandedElements()) { - T token = token(next); - if (token != null) { - expandedNodes.add(token); - } - } - } - - @Override - public void restore(AbstractTreeViewer viewer) { - List expand = Lists.newArrayListWithCapacity(expandedNodes.size()); - for (T next : expandedNodes) { - Object resolved = resolve(next); - if (resolved != null) { - expand.add(resolved); - } - } - setExpandedElements(viewer, expand); - - super.restore(viewer); - } - - @Override - protected void setSelection(AbstractTreeViewer viewer, List selection) { - viewer.setSelection(new StructuredSelection(selection), true); - } - - protected void setExpandedElements(AbstractTreeViewer viewer, Collection toExpand) { - viewer.setExpandedElements(toExpand.toArray()); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorFactory.java deleted file mode 100644 index b1e465e6c12..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editorsfactory; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; - -/** - * Factory used to get the Icon associated to the editor used to render the - * specified pageIdentifier. - * - * - * @author cedric dumoulin - * - */ -public interface IEditorFactory { - - /** - * Create the {@link IPageModel} for the specified identifier. TODO throw an - * exception encapsulating problems encountered while creating the model. - * - * @param pageIdentifier - * Object identifying an Editor. - * @return PageModel allowing to create the editor. - */ - public IPageModel createIPageModel(Object pageIdentifier); - - /** - * Return true if the factory can create an IPageModel for the specified - * pageIdentifier. Return false otherwise TODO throw an exception - * encapsulating problems encountered while creating the model. - * - * @param pageIdentifier - * The object representing the page to test - * @return - */ - public boolean isPageModelFactoryFor(Object pageIdentifier); - - /** - * The ID of this factory - * - * @return - */ - default String getFactoryID() { - return getClass().getName(); - } - - /** - * The display label of this factory - * - * @return - */ - default String getLabel() { - return getClass().getSimpleName(); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactory.java deleted file mode 100644 index 6f48ad38f2b..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editorsfactory; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.swt.graphics.Image; - -/** - * Factory used to create an {@link IPageModel} used by the {@link ISashWindowsContainer} to create an instance of the editor represented - * by the provided Object. Such factory is required by the {@link DiSashModelMngr}. It is called whenever the ISashWindowsContainer need - * to create an editor from an EObject representing this editor in the Di - * implementation of the {@link ISashWindowsContentProvider} - * - * - * @author cedric dumoulin - * - */ -public interface IEditorIconFactory { - - /** - * Get the icon associated to the editor used to render the model. Model - * represent the top level object of a model editor. Can return a cached - * Image. - * - * @param pageIdentifier - * the pageIdentifier representing the Editor. This is usually - * the EObject used to reconstruct the editor. - * @return the icon representing the editor - */ - public Image getEditorIcon(Object pageIdentifier); - - /** - * Create the icon associated to the editor used to render the model. Model - * represent the top level object of a model editor. Always return a newly - * created Image. - * - * @param pageIdentifier - * the pageIdentifier representing the Editor. This is usually - * the EObject used to reconstruct the editor. - * @return the icon representing the editor - */ - public Image createEditorIcon(Object pageIdentifier); - - /** - * Return true if the factory can create an IPageModel for the specified - * pageIdentifier. Return false otherwise TODO throw an exception - * encapsulating problems encountered while creating the model. - * - * @param pageIdentifier - * The object representing the page to test - * @return - */ - public boolean isPageModelFactoryFor(Object pageIdentifier); - - /** - * Dispose this factory - */ - public void dispose(); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactoryExtended.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactoryExtended.java deleted file mode 100644 index c2ea07e9d29..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IEditorIconFactoryExtended.java +++ /dev/null @@ -1,30 +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: - * Atos - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editorsfactory; - -/** - * - * @author "Arthur Daussy arthur.daussy@atos.net" - * - */ -public interface IEditorIconFactoryExtended extends IEditorIconFactory { - - /** - * Return the icon URL associated to the editor used to render the model. Model represent the top level - * object of a model editor. - * - * @param pageIdentifier - * @return - */ - public String getURLMainIcon(Object pageIdentifier); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistry.java deleted file mode 100644 index 660807bd906..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistry.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.editorsfactory; - -import org.eclipse.swt.graphics.Image; - -/** - * Registry used to get Icons associated to an editor. - * - * @author cedric dumoulin - */ -public interface IPageIconsRegistry { - - /** - * Get the icon associated to the editor used to render the model. Model - * represent the top level object of a model editor. - * - * @param model - * the model representing the Editor. This is usually the EObject - * used to reconstruct the editor. - * @return the icon representing the editor - */ - public Image getEditorIcon(Object model); - - /** - * Dispose this registry - */ - public void dispose(); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistryExtended.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistryExtended.java deleted file mode 100644 index 52cf01b94ee..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/IPageIconsRegistryExtended.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2011 Atos Origin. - * - * 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: - * Atos Origin - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.core.editorsfactory; - -/** - * Extends IPageIconsRegistry in order to offer a second methods which will give back the URL of the requested Icon - * - * @author "Arthur Daussy arthur.daussy@atos.net" - * - */ -public interface IPageIconsRegistryExtended extends IPageIconsRegistry { - - /** - * Get the URL icon associated to the editor used to render the model. Model represent the top level - * object of a model editor. - * - * @param model - * @return {@link String} which represent the URL of the resource - */ - public String getEditorURLIcon(Object model); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageIconsRegistry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageIconsRegistry.java deleted file mode 100644 index 6ae2dc5162f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageIconsRegistry.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.editorsfactory; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.swt.graphics.Image; - -/** - * Concrete implementation of the {@link IPageIconsRegistry}. This - * implementation allows to add and remove {@link IPageIconsRegistry}. - * - * - * @author cedric dumoulin - */ -public class PageIconsRegistry implements IPageIconsRegistryExtended { - - /** list of registered icon factories */ - protected List pageIcons = new ArrayList(); - - /** - * Constructor. - * - * @param editorFactoryRegistry - * @param servicesRegistry - */ - public PageIconsRegistry() { - - } - - /** - * Walk each registered {@link IEditorFactory} to find the one handling the - * specified pageIdentifier. Call the corresponding method in the found - * pageIdentifier. - * - * TODO Throw an exception to report errors. - * - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) - */ - @Override - public Image getEditorIcon(Object pageIdentifier) { - - for (IEditorIconFactory factory : getPageIcons()) { - if (factory.isPageModelFactoryFor(pageIdentifier)) { - { - // return factory.getEditorIcon(pageIdentifier); - return factory.getEditorIcon(pageIdentifier); - } - } - } - // no editor found ! - // TODO Throw an exception. - // throw new EditorNotFoundException("No editor registered for '" + - // pageIdentifier + "'."); - return null; - } - - /** - * @return the editorFactories - */ - protected List getPageIcons() { - return pageIcons; - } - - /** - * Add the specified {@link IEditorFactory} - * - * @param editorIconFactory - */ - public void add(IEditorIconFactory editorIconFactory) { - // This should never happen - if (editorIconFactory == null) { - throw new RuntimeException("Parameter should not be null."); //$NON-NLS-1$ - } - - pageIcons.add(editorIconFactory); - } - - /** - * Remove the specified {@link IEditorFactory} - * - * @param editorIconFactory - */ - public void remove(IEditorIconFactory editorIconFactory) { - pageIcons.remove(editorIconFactory); - } - - /** - * Return the path to the icon ressource. - * - * @see org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended#getEditorURLIcon(java.lang.Object) - * - * @param model - * @return - */ - @Override - public String getEditorURLIcon(Object model) { - for (IEditorIconFactory factory : getPageIcons()) { - if (factory.isPageModelFactoryFor(model)) { - { - if (factory instanceof IEditorIconFactoryExtended) { - return ((IEditorIconFactoryExtended) factory).getURLMainIcon(model); - } - } - } - } - return ""; - } - - @Override - public void dispose() { - for (IEditorIconFactory factory : pageIcons) { - factory.dispose(); - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageModelFactoryRegistry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageModelFactoryRegistry.java deleted file mode 100644 index 8904f7238cf..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/PageModelFactoryRegistry.java +++ /dev/null @@ -1,165 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 - 2015 CEA LIST & LIFL - * - * 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Camille Letavernier (CEA LIST) - camille.letavernier@cea.fr - Bug 476625 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.editorsfactory; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory; - -/** - * Concrete implementation of the {@link IPageModelFactory} required by the di - * implementation of {@link ISashWindowsContentProvider}. This implementation - * allows to add and remove {@link IEditorFactory}. - * - * - * @author cedric dumoulin - */ -public class PageModelFactoryRegistry implements IPageModelFactory { - - /** ordered list of editor factories */ - protected List editorFactories = new ArrayList(); - - /** - * Constructor. - * - * @param editorFactoryRegistry - * @param servicesRegistry - */ - public PageModelFactoryRegistry() { - - } - - /** - * Walk each registered {@link IEditorFactory} to find the one handling the - * specified pageIdentifier. Call the corresponding method in the found - * pageIdentifier. - * - * TODO Throw an exception to report errors. - * - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) - */ - @Override - public IPageModel createIPageModel(Object pageIdentifier) { - return createIPageModel(pageIdentifier, null); - } - - /** - * Walk each registered {@link IEditorFactory} to find the one handling the - * specified pageIdentifier. Call the corresponding method in the found - * pageIdentifier. - * - * If several factories match the selected page, use the favorite editor. - * If the favorite editor is not available, use the priority mechanism - * - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) - */ - @Override - public IPageModel createIPageModel(Object pageIdentifier, String favoriteEditorID) { - - IEditorFactory factory = getFactoryFor(pageIdentifier, favoriteEditorID); - if (factory == null) { - return null; - } - return factory.createIPageModel(pageIdentifier); - } - - /** - * Returns the IEditorFactory for the given pageIdentifier. - * - * If several factories match the page identifier, use the favorite one - * - * @param pageIdentifier - * @return - */ - private IEditorFactory getFactoryFor(Object pageIdentifier, String favoriteEditorID) { - List matchingFactories = new LinkedList<>(); - - for (IEditorFactory factory : getEditorFactories()) { - if (factory.isPageModelFactoryFor(pageIdentifier)) { - matchingFactories.add(factory); - } - } - - if (matchingFactories.isEmpty()) { - return null; - } else if (matchingFactories.size() == 1) { - return matchingFactories.get(0); - } else if (favoriteEditorID != null) { - for (IEditorFactory matchingFactory : matchingFactories) { - if (favoriteEditorID.equals(matchingFactory.getFactoryID())) { - return matchingFactory; - } - } - } - - return matchingFactories.get(0); - } - - /** - * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#getEditorIDsFor(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public Map getEditorIDsFor(Object pageIdentifier) { - return getEditorFactories().stream() - .filter(f -> f.isPageModelFactoryFor(pageIdentifier)) - .collect(Collectors - .toMap( - f -> f.getFactoryID(), f -> f.getLabel(), // key, value - (v1, v2) -> { // Conflict merger - Activator.log.warn(String.format("Several editors are declared with the same ID: '%s', '%s'", v1, v2)); - return v1; // Any value - } , - LinkedHashMap::new)); // HashMap Supplier - } - - /** - * @return the editorFactories - */ - protected List getEditorFactories() { - return editorFactories; - } - - /** - * Add the specified {@link IEditorFactory} - * - * @param editorFactory - */ - public void add(IEditorFactory editorFactory) { - // This should never happen - if (editorFactory == null) { - throw new IllegalArgumentException("Parameter should not be null."); //$NON-NLS-1$ - } - - editorFactories.add(editorFactory); - } - - /** - * Remove the specified {@link IEditorFactory} - * - * @param editorFactory - */ - public void remove(IEditorFactory editorFactory) { - editorFactories.remove(editorFactory); - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/anytype/AnyTypeEditorFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/anytype/AnyTypeEditorFactory.java deleted file mode 100644 index 93679061c5e..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editorsfactory/anytype/AnyTypeEditorFactory.java +++ /dev/null @@ -1,135 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2014 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation - * Christian W. Damus (CEA) - bug 392301 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.editorsfactory.anytype; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IComponentModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -/** - * An EditorFactory for "AnyType", i.e. EObject deserialized from unknown Packages - * - * Allows recovery and manipulation of models containing optional EMF components - * - * @author Camille Letavernier - */ -public class AnyTypeEditorFactory extends AbstractEditorFactory { - - public AnyTypeEditorFactory() { - super(null, "AnyTypeHandler"); - } - - @Override - public IPageModel createIPageModel(Object pageIdentifier) { - - final AnyType anyTypeModel = (AnyType) pageIdentifier; - - return new IComponentModel() { - - private AnyType anyType = anyTypeModel; - - @Override - public void dispose() { - // Pass. The tab icon is a workbench-shared image - } - - @Override - public String getTabTitle() { - EClass eClass = anyType.eClass(); - String label; - if (eClass == null) { - label = "component"; - } else { - label = eClass.getName(); - } - return "Missing " + label; - } - - private String getTypeLabel() { - EClass eClass = anyType.eClass(); - String className = eClass == null ? "None" : eClass.getName(); - return className; - } - - private String getNsURI() { - EClass eClass = anyType.eClass(); - EPackage ePackage = eClass == null ? null : eClass.getEPackage(); - String ePackageName = ePackage == null ? "None" : ePackage.getNsURI(); - - return ePackageName; - } - - public Image getComponentIcon() { - return Display.getDefault().getSystemImage(SWT.ICON_WARNING); - } - - @Override - public Image getTabIcon() { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); - } - - @Override - public Object getRawModel() { - return anyType; - } - - public String getErrorText() { - String typeLabel = getTypeLabel(); - String packageURI = getNsURI(); - String message = "A component is missing. The following Model cannot be loaded: " + typeLabel + " (from " + packageURI + ")\n"; - message += "Changes to the model won't be reflected in this editor. This editor will be saved in the current state, i.e. without any data loss. "; - message += "However, this may result in an inconsistent state of this editor when the missing component will be restored\n"; - return message; - } - - @Override - public Composite createPartControl(Composite parent) { - Composite tabComposite = new Composite(parent, SWT.NONE); - tabComposite.setLayout(new GridLayout(2, false)); - - Image componentIcon = getComponentIcon(); - if (componentIcon != null) { - Label errorImageLabel = new Label(tabComposite, SWT.NONE); - errorImageLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - errorImageLabel.setImage(componentIcon); - } - - Label label = new Label(tabComposite, SWT.WRAP); - label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label.setText(getErrorText()); - - return tabComposite; - } - }; - } - - @Override - public boolean isPageModelFactoryFor(Object pageIdentifier) { - return pageIdentifier instanceof AnyType; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/ICreationCondition.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/ICreationCondition.java deleted file mode 100644 index ed6e3c72cbb..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/ICreationCondition.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 ATOS ORIGIN. - * - * - * 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 - * - * Tristan Faure (ATOS ORIGIN) tristan.faure@atosorigin.com - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.commands; - -import org.eclipse.emf.ecore.EObject; - -public interface ICreationCondition { - - /** - * This method returns true if the diagram creation is allowed - * - * @param selectedElement - * the element where the diagram is provided - * @return true if the diagram can be created - */ - boolean create(EObject selectedElement); - - /** - * set the command ID in order to take account the environment in order to - * create a diagram - * - * @param commandID - */ - public void setCommand(String commandID); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/IModelCreationCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/IModelCreationCommand.java deleted file mode 100644 index b2b173694fa..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/IModelCreationCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.commands; - -import org.eclipse.papyrus.infra.core.resource.ModelSet; - -/** - * The Interface IModelCreationCommand. - */ -public interface IModelCreationCommand { - - /** - * Creates the model. - * - * @param modelSet - * the modelSet set - */ - void createModel(final ModelSet modelSet); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/PerspectiveContextDependence.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/PerspectiveContextDependence.java deleted file mode 100644 index 08b623e7b48..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/commands/PerspectiveContextDependence.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.commands; - -import org.eclipse.emf.ecore.EObject; - -//FIXME Refactoring Juno : I don't know how to migrate this code -public class PerspectiveContextDependence implements ICreationCondition { - - protected String commandID = null; - - public PerspectiveContextDependence() { - // TODO Auto-generated constructor stub - } - - /** - * {@inheritDoc} - */ - @Override - public boolean create(EObject selectedElement) { - // FIXME Refactoring Juno : I don't know how to migrate this code - // // Get the perspective - // Perspective perspective = ((WorkbenchPage)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()).getActivePerspective(); - // // look for the perspective - // // verify if the command has to be displayed - // if(perspective.getHiddenMenuItems().contains(commandID) && perspective.getHiddenToolbarItems().contains(commandID)) { - // return false; - // } - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public void setCommand(String commandID) { - this.commandID = commandID; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/AbstractEditorFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/AbstractEditorFactory.java deleted file mode 100644 index d5622aff527..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/AbstractEditorFactory.java +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * Abstract base class for Factory of editors. See {@link IEditorFactory}. - * - * - * @author Remi Schnekenburger - * @author Patrick Tessier - * @author cedric dumoulin - */ -public abstract class AbstractEditorFactory implements IPluggableEditorFactory { - - /** - * Expected Class of the diagram to create. - */ - private Class diagramClass; - - /** Expected diagram type (@see {@link Diagram#getType()}) */ - private String expectedType; - - /** - * EditorDescriptor associated to the factory. TODO : Maybe use individual - * setters to set the requested data (ContributorId and Icon). - */ - protected EditorDescriptor editorDescriptor; - - /** - * ServiceRegistry that can be provided to created editors. - */ - private ServicesRegistry serviceRegistry; - - /** - * Creates a new AbstractEditorFactory. - * - * @param diagramClass - * expected Class of the diagram to create. - * @param expectedType - * expected diagram type (@see {@link Diagram#getType()}) - */ - public AbstractEditorFactory(Class diagramClass, String expectedType) { - assert (expectedType != null); - this.diagramClass = diagramClass; - this.expectedType = expectedType; - } - - /** - * Initialize the factory with useful Classes. - * - * @param serviceRegistry - * Service registry that will be provided to created editor. - * @param editorDescriptor - * Descriptor containing data from the Eclipse Extension. - */ - @Override - public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) { - this.editorDescriptor = editorDescriptor; - this.serviceRegistry = serviceRegistry; - - } - - /** - * @return the serviceRegistry - */ - public ServicesRegistry getServiceRegistry() { - return serviceRegistry; - } - - /** - * Returns the expected class for the diagram implementation - * - * @return the expected class for the diagram implementation - */ - public Class getDiagramClass() { - return diagramClass; - } - - /** - * Returns the expected type of the diagram - * - * @return the expected diagram type (@see {@link Diagram#getType()}) - */ - public String getExpectedType() { - return expectedType; - } - - /** - * @return the editorDescriptor - */ - public EditorDescriptor getEditorDescriptor() { - return editorDescriptor; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptor.java deleted file mode 100644 index 5481abdf019..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptor.java +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * This descriptor describes a nested diagram. It is used by MultiDiagramEditor - * to know about the nested diagram. It is fill by an extension. - * - * @author Cedric Dumoulin - * - */ -public class EditorDescriptor { - - /** - * Editor factory implementation class. - */ - private Class editorFactoryClass; - - /** - * EditorActionBarContributor Id used to search the - * EditorActionBarContributor requested by the editor. - */ - private String actionBarContributorId; - - /** - * The icon representing the diagram - */ - private ImageDescriptor icon; - - /** - * Resource path to the icon - */ - private String iconPath; - - /** - * The order of this factory. Used when several factories match the same element (Diagram...) - * The lower the order, the higher the priority of this factory - */ - private int order; - - /** - * Constructor. - */ - public EditorDescriptor() { - - } - - /** - * - * @param attribute - */ - public void setActionBarContributorId(String actionBarContributorId) { - this.actionBarContributorId = actionBarContributorId; - - } - - /** - * @see org.eclipse.papyrus.infra.core.extension.diagrameditor.IEditorDescriptor#getActionBarContributorId() - * @return - * - */ - public String getActionBarContributorId() { - return actionBarContributorId; - } - - /** - * get the editor icon path - * - * @return the editor icon path - */ - public ImageDescriptor getIcon() { - return icon; - } - - /** - * set the editor icon - * - * @param icon - * the icon path - */ - public void setIcon(ImageDescriptor icon) { - this.icon = icon; - } - - /** - * get the class of the editor factory - * - * @return the class of the editor - */ - public Class getEditorFactoryClass() { - return editorFactoryClass; - } - - /** - * set the editor facoty to this descriptor - * - * @param editorFactoryClass - * the class that represents the editor factory - */ - public void setEditorFactoryClass(Class editorFactoryClass) { - this.editorFactoryClass = editorFactoryClass; - } - - /** - * - * {@inheritDoc} - */ - @Override - public String toString() { - if (editorFactoryClass == null || editorFactoryClass.getName() == null) { - return "[nestedEditor editorFactory:" + editorFactoryClass + "(null)]"; - } - return "[nestedEditor editorFactory:" + editorFactoryClass.getName() + "]"; - } - - public int getOrder() { - return order; - } - - public void setOrder(int order) { - this.order = order; - } - - /** - * Set the URL of the Icon - * - * @param iconPath - * path of the Icon - */ - public void setIconURL(String iconPath) { - this.iconPath = iconPath; - } - - /** - * Get the URL of the based images - * - * @return the path of the mai image. can return null if this property is not set - */ - public String getIconURL() { - return iconPath; - } - - /** - * set the Icon thanks to a {@link IConfigurationElement} and {@link String}which represent the path of the Icon - * - * @param element - * @param iconPath - */ - public void setIcon(IConfigurationElement element, String iconPath, String pluginID) { - setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconPath)); - setIconURL(element.getNamespaceIdentifier() + '/' + iconPath); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptorExtensionFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptorExtensionFactory.java deleted file mode 100644 index 386c93960e8..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorDescriptorExtensionFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import static org.eclipse.papyrus.infra.core.Activator.log; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.extension.BadNameExtensionException; -import org.eclipse.papyrus.infra.core.extension.ExtensionException; -import org.eclipse.papyrus.infra.core.extension.ExtensionUtils; - -/** - * A factory used to create editor descriptor object from Eclipse extensions points elements. - * - * @author Cedric Dumoulin - * @author Patrick Tessier - */ -public class EditorDescriptorExtensionFactory extends ExtensionUtils { - - /** singleton eINSTANCE of this class */ - public final static EditorDescriptorExtensionFactory eINSTANCE = new EditorDescriptorExtensionFactory(); - - /** constant for the editor diagram **/ - public final static String EDITOR_DIAGRAM_EXTENSIONPOINT = "editorDiagram"; - - /** constant for the attribute factoryClass **/ - public final static String FACTORYCLASS_ATTRIBUTE = "factoryClass"; - - /** constant for the attribute contextId **/ - public final static String ACTIONBARCONTRIBUTORID_ATTRIBUTE = "actionBarContributorId"; - - /** constant for the attribute icon **/ - public final static String ICON_ATTRIBUTE = "icon"; - - /** constant for the order attribute */ - public final static String ORDER_ATTRIBUTE = "order"; - - /** - * @return the eINSTANCE - */ - public static EditorDescriptorExtensionFactory getInstance() { - return eINSTANCE; - } - - /** - * Create a descriptor instance corresponding to the ConfigurationElement. - * - * @param element - * an {@link IConfigurationElement} see eclipse extension point - * @return a nestedEditorDescriptor structure that contains information to create diagrams - * @throws BadNameExtensionException - */ - @SuppressWarnings("unchecked") - public EditorDescriptor createNestedEditorDescriptor(IConfigurationElement element) throws ExtensionException { - EditorDescriptor res; - - checkTagName(element, EDITOR_DIAGRAM_EXTENSIONPOINT); - - res = new EditorDescriptor(); - res.setEditorFactoryClass((Class) parseClass(element, FACTORYCLASS_ATTRIBUTE, EDITOR_DIAGRAM_EXTENSIONPOINT)); - res.setActionBarContributorId(element.getAttribute(ACTIONBARCONTRIBUTORID_ATTRIBUTE)); - - int order = 0; // Default - try { - String orderAttribute = element.getAttribute(ORDER_ATTRIBUTE); - if (orderAttribute != null) { - order = Integer.parseInt(orderAttribute); - } - } catch (NumberFormatException ex) { - Activator.log.warn("Invalid order provided by " + element.getContributor() + ". Order should be an integer value"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - res.setOrder(order); - - String iconPath = element.getAttribute(ICON_ATTRIBUTE); - if (iconPath != null) { - /** Implementation which set the icon and register the complete URL of the icon : Bug eclipse 358732 */ - res.setIcon(element, iconPath, org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); - - } - - if (log.isDebugEnabled()) { - log.debug("Read editor descriptor " + res); //$NON-NLS-1$ - } - return res; - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorFactoryProxy.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorFactoryProxy.java deleted file mode 100644 index 251da1623f7..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorFactoryProxy.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * A proxy implementation of {@link IEditorFactory} used to do lazy - * instantiation of concrete {@link IPluggableEditorFactory}. This class is used - * by the {@link PluggableEditorFactoryReader} - * - * @author cedric dumoulin - * - */ -public class EditorFactoryProxy implements IEditorFactory { - - /** - * The concrete implementation. - */ - private IPluggableEditorFactory editorFactory; - - /** - * EditorDescriptor associated to the factory. - */ - protected EditorDescriptor editorDescriptor; - - /** - * ServiceRegistry that can be provided to created editors. - */ - private ServicesRegistry serviceRegistry; - - /** - * Constructor. - * - * @param serviceRegistry - * @param editorDescriptor - */ - public EditorFactoryProxy(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) { - this.serviceRegistry = serviceRegistry; - this.editorDescriptor = editorDescriptor; - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public IPageModel createIPageModel(Object pageIdentifier) { - try { - return getEditorFactory().createIPageModel(pageIdentifier); - } catch (Exception ex) { - // An error occurred in a contribution. Do not use this factory - return null; - } - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public boolean isPageModelFactoryFor(Object pageIdentifier) { - try { - return getEditorFactory().isPageModelFactoryFor(pageIdentifier); - } catch (Exception ex) { - // An error occurred in a contribution. Do not use this factory - return false; - } - } - - /** - * @return the editorFactory - */ - protected IPluggableEditorFactory getEditorFactory() { - - if (editorFactory == null) { - editorFactory = createEditorFactory(); - } - - return editorFactory; - - } - - /** - * Create an instance of IPluggableEditorFactory as described in the - * editorDescriptor. TODO let propagate the exceptions. - * - * @return - */ - private IPluggableEditorFactory createEditorFactory() { - // Create the requested class. - try { - editorFactory = editorDescriptor.getEditorFactoryClass().newInstance(); - // Set the descriptor. USed by the factory to get the ActionBarId - // and Icon - editorFactory.init(serviceRegistry, editorDescriptor); - return editorFactory; - } catch (InstantiationException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } - - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#getFactoryID() - * - * @return - */ - @Override - public String getFactoryID() { - return getEditorFactory().getFactoryID(); - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#getLabel() - * - * @return - */ - @Override - public String getLabel() { - return getEditorFactory().getLabel(); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorIconFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorIconFactory.java deleted file mode 100644 index 3d9f589cc2a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorIconFactory.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.core.editorsfactory.IEditorIconFactoryExtended; -import org.eclipse.swt.graphics.Image; - -/** - * A factory used to create the Icon associated to an editor TODO Lets have a - * common ancestor for {@link EditorIconFactory} and {@link EditorFactoryProxy} - * - * @author cedric dumoulin - * - */ -public class EditorIconFactory implements IEditorIconFactoryExtended { - - /** - * The concrete implementation. - */ - private IPluggableEditorFactory editorFactory; - - /** - * EditorDescriptor associated to the factory. - */ - protected EditorDescriptor editorDescriptor; - - /** - * Cached image for reuse. - */ - protected Image cachedImage; - - /** - * Constructor. - * - * @param serviceRegistry - * @param editorDescriptor - */ - public EditorIconFactory(EditorDescriptor editorDescriptor) { - this.editorDescriptor = editorDescriptor; - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorIconFactory#getEditorIcon(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public Image getEditorIcon(Object pageIdentifier) { - - if (cachedImage == null) { - cachedImage = createEditorIcon(pageIdentifier); - } - - return cachedImage; - } - - /** - * Create an Image associated to the editor used to render the specified - * pageIdentifier - * - * @return - */ - @Override - public Image createEditorIcon(Object pageIdentifier) { - ImageDescriptor imageDescriptor = editorDescriptor.getIcon(); - if (imageDescriptor == null) { - return null; - } - Image image = imageDescriptor.createImage(); - return image; - } - - /** - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public boolean isPageModelFactoryFor(Object pageIdentifier) { - return getEditorFactory().isPageModelFactoryFor(pageIdentifier); - } - - /** - * @return the editorFactory - */ - protected IPluggableEditorFactory getEditorFactory() { - - if (editorFactory == null) { - editorFactory = createEditorFactory(); - } - - return editorFactory; - - } - - /** - * Create an instance of IPluggableEditorFactory as described in the - * editorDescriptor. TODO let propagate the exceptions. - * - * @return - */ - private IPluggableEditorFactory createEditorFactory() { - // Create the requested class. - try { - editorFactory = editorDescriptor.getEditorFactoryClass().newInstance(); - // Set the descriptor. USed by the factory to get the ActionBarId - // and Icon - // editorFactory.init(serviceRegistry, editorDescriptor); - return editorFactory; - } catch (InstantiationException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } - - } - - /** - * Return the URL of the main icon used to create this icon - * - * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorIconFactory#getURLMainIcon(java.lang.Object) - * - * @param pageIdentifier - * @return - */ - @Override - public String getURLMainIcon(Object pageIdentifier) { - return editorDescriptor.getIconURL(); - } - - /** - * {@inheritDoc} - * - * Dispose the cached image - */ - @Override - public void dispose() { - if (cachedImage != null) { - cachedImage.dispose(); - cachedImage = null; - } - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorNotFoundException.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorNotFoundException.java deleted file mode 100644 index 3198544a49d..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/EditorNotFoundException.java +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -/** - * Editor was not found. - * - * @author dumoulin - * - */ -@SuppressWarnings("serial") -public class EditorNotFoundException extends MultiDiagramException { - - /** - * - */ - public EditorNotFoundException() { - } - - /** - * @param arg0 - */ - public EditorNotFoundException(String arg0) { - super(arg0); - } - - /** - * @param arg0 - */ - public EditorNotFoundException(Throwable arg0) { - super(arg0); - } - - /** - * @param arg0 - * @param arg1 - */ - public EditorNotFoundException(String arg0, Throwable arg1) { - super(arg0, arg1); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/IPluggableEditorFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/IPluggableEditorFactory.java deleted file mode 100644 index d75ba2b6e31..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/IPluggableEditorFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * This interface should be implemented by Editor Factories that can be declared - * as Eclipse extension. It extends the {@link IEditorFactory} by adding methods - * to initialize the factory with multieditor ServiceRegistry and associated - * editor data. - * - * @author Cédric Dumoulin - * - */ -public interface IPluggableEditorFactory extends IEditorFactory { - - /** - * Initialize the factory with useful Classes. - * - * @param serviceRegistry - * Service registry that will be provided to created editor. - * @param editorDescriptor - * Descriptor containing data from the Eclipse Extension. - */ - public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/MultiDiagramException.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/MultiDiagramException.java deleted file mode 100644 index 8375929a2b9..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/MultiDiagramException.java +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -/** - * Root Exception of MultiDiagram exception - * - * @author dumoulin - * - */ -@SuppressWarnings("serial") -public class MultiDiagramException extends Exception { - - /** - * - */ - public MultiDiagramException() { - } - - /** - * @param arg0 - */ - public MultiDiagramException(String arg0) { - super(arg0); - } - - /** - * @param arg0 - */ - public MultiDiagramException(Throwable arg0) { - super(arg0); - } - - /** - * @param arg0 - * @param arg1 - */ - public MultiDiagramException(String arg0, Throwable arg1) { - super(arg0, arg1); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/PluggableEditorFactoryReader.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/PluggableEditorFactoryReader.java deleted file mode 100644 index cea7e0bba40..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/extension/diagrameditor/PluggableEditorFactoryReader.java +++ /dev/null @@ -1,143 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.extension.diagrameditor; - -import static org.eclipse.papyrus.infra.core.Activator.log; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry; -import org.eclipse.papyrus.infra.core.editorsfactory.PageModelFactoryRegistry; -import org.eclipse.papyrus.infra.core.extension.ExtensionException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * This reader is used to read PluggableEditorFactory from the Eclipse extension - * declarations. It can be used to populate an {@link PageModelFactoryRegistry}. - */ -public class PluggableEditorFactoryReader { - - /** ordered list of editor descriptors */ - protected List editorDescriptors; - - /** ID of the editor extension (schema filename) */ - public static final String EDITOR_EXTENSION_ID = "papyrusDiagram"; - - /** Namespace where to look for the extension points. */ - protected String extensionPointNamespace; - - /** indicates if extension is loaded or not */ - private boolean isExtensionLoaded = false; - - /** - * Create a new Registry reading extension from the specified namespace. The - * namespace is usually the name of the plugin owning the registry. - * - * @param extensionPointNamespace - */ - public PluggableEditorFactoryReader(String extensionPointNamespace) { - super(); - this.extensionPointNamespace = extensionPointNamespace; - editorDescriptors = new ArrayList(); - } - - /** - * Populate the provided {@link PageModelFactoryRegistry} with {@link IPluggableEditorFactory} read from Eclipse extension declarations. - * For each declared editor, create a proxy encapsulating the real - * EditorFactory. Then the proxy is added to the PageModelFactoryRegistry. - * - * @param pageModelFactoryRegistry - * The object to populate - * @param serviceRegistry - * ServiceRegistry provided to newly instantiated {@link IPluggableEditorFactory}. - */ - public void populate(PageModelFactoryRegistry pageModelFactoryRegistry, ServicesRegistry serviceRegistry) { - - for (EditorDescriptor desc : getEditorDescriptors()) { - - // Create and add a proxy encapsulating the EditorFactory. - pageModelFactoryRegistry.add(new EditorFactoryProxy(serviceRegistry, desc)); - } - } - - /** - * Populate the provided {@link PageIconsRegistry} with icons read from - * Eclipse extension declarations. For each declared editor, create a {@link EditorIconFactory}. - * - * @param pageModelFactoryRegistry - * The object to populate - * @param serviceRegistry - * ServiceRegistry provided to newly instantiated {@link IPluggableEditorFactory}. - */ - public void populate(PageIconsRegistry registry) { - - for (EditorDescriptor desc : getEditorDescriptors()) { - - // Create and add a proxy encapsulating the EditorFactory. - registry.add(new EditorIconFactory(desc)); - } - } - - /** - * Get the list of editor descriptor. - * - * @return the list of editor descriptor. - */ - public List getEditorDescriptors() { - if (!isExtensionLoaded) { - isExtensionLoaded = true; - initializeEditorDescriptors(); - } - return editorDescriptors; - } - - /** - * Read editor descriptors from extension points. - */ - private void initializeEditorDescriptors() { - // Reading data from plugins - IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); - - for (IConfigurationElement ele : configElements) { - EditorDescriptor desc; - try { - if (EditorDescriptorExtensionFactory.EDITOR_DIAGRAM_EXTENSIONPOINT.equals(ele.getName())) { - desc = EditorDescriptorExtensionFactory.eINSTANCE.createNestedEditorDescriptor(ele); - editorDescriptors.add(desc); - } - } catch (ExtensionException e) { - log.error("Initialization editor problem ", e); //$NON-NLS-1$ - } - } - - Collections.sort(editorDescriptors, (ed1, ed2) -> Integer.compare(ed1.getOrder(), ed2.getOrder())); - - if (log.isDebugEnabled()) { - log.debug("Read " + editorDescriptors.size() + " editor descriptors from Eclipse extensions"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return "EditorFactoryRegistry: " + editorDescriptors.toString(); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/PageLayoutStorageState.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/PageLayoutStorageState.java deleted file mode 100644 index 1218162eb1c..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/PageLayoutStorageState.java +++ /dev/null @@ -1,164 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.commands; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.lang.ref.Reference; -import java.lang.ref.WeakReference; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.commands.ToggleState; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IPartService; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * The boolean toggle state of the private page layout storage menu item. - */ -public class PageLayoutStorageState extends ToggleState implements IPartListener, PropertyChangeListener { - - private IPartService partService = null; - - private Reference activeEditor; - - public PageLayoutStorageState() { - super(); - - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - - if (window != null) { - partService = window.getPartService(); - if (partService != null) { - partService.addPartListener(this); - update(partService.getActivePart()); - } - } - } - - @Override - public void dispose() { - if (partService != null) { - partService.removePartListener(this); - } - - super.dispose(); - } - - @Override - public void partDeactivated(IWorkbenchPart part) { - if ((activeEditor != null) && (activeEditor.get() == part)) { - update(null); - } - } - - @Override - public void partActivated(IWorkbenchPart part) { - update(part); - } - - private void update(IWorkbenchPart part) { - // Default state is private storage - boolean state = true; - - unhookSashModelListener(); - - activeEditor = null; - - if (part instanceof IMultiDiagramEditor) { - IMultiDiagramEditor editor = (IMultiDiagramEditor) part; - activeEditor = new WeakReference<>(editor); - state = isPrivateLayout(editor); - } - - hookSashModelListener(); - - // Fires notification if changed from previous state - setValue(state); - } - - // I am a computed value, actually - @Override - public Object getValue() { - IMultiDiagramEditor editor = (activeEditor == null) ? null : activeEditor.get(); - return (editor != null) ? isPrivateLayout(editor) : super.getValue(); - } - - boolean isPrivateLayout(IMultiDiagramEditor editor) { - ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); - SashModel sashModel = SashModelUtils.getSashModel(modelSet); - - // The default is private layout - return (sashModel == null) || !sashModel.isLegacyMode(); - } - - @Override - public void partBroughtToTop(IWorkbenchPart part) { - // Pass - } - - @Override - public void partClosed(IWorkbenchPart part) { - // Pass - } - - @Override - public void partOpened(IWorkbenchPart part) { - // Pass - } - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getSource() instanceof SashModel) { - switch (evt.getPropertyName()) { - case SashModel.PROPERTY_LEGACY_MODE: - setValue(!(Boolean) evt.getNewValue()); - break; - } - } - } - - private SashModel getSashModel() { - SashModel result = null; - - if (activeEditor != null) { - IMultiDiagramEditor editor = activeEditor.get(); - if (editor != null) { - result = SashModelUtils.getSashModel(editor.getServicesRegistry()); - } - } - - return result; - } - - private void unhookSashModelListener() { - SashModel sash = getSashModel(); - if (sash != null) { - sash.removePropertyChangeListener(SashModel.PROPERTY_LEGACY_MODE, this); - } - } - - private void hookSashModelListener() { - SashModel sash = getSashModel(); - if (sash != null) { - sash.addPropertyChangeListener(SashModel.PROPERTY_LEGACY_MODE, this); - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/TogglePageLayoutStorageHandler.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/TogglePageLayoutStorageHandler.java deleted file mode 100644 index c9b86cd0fe8..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/commands/TogglePageLayoutStorageHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.commands; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.transaction.RollbackException; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashLayoutCommandFactory; -import org.eclipse.papyrus.infra.core.services.SaveLayoutBeforeClose; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.TransactionHelper; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.handlers.HandlerUtil; -import org.eclipse.ui.statushandlers.StatusManager; - -/** - * Command handler for the private page-layout storage toggle menu. - */ -public class TogglePageLayoutStorageHandler extends AbstractHandler { - - public TogglePageLayoutStorageHandler() { - super(); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - IEditorPart active = HandlerUtil.getActiveEditor(event); - if (active instanceof IMultiDiagramEditor) { - IMultiDiagramEditor editor = (IMultiDiagramEditor) active; - - // Toggle the storage of the layout - togglePrivatePageLayout(editor); - - // And then save the layout immediately if the editor is not dirty - // (if it is dirty, then the layout will be saved when the editor - // is saved; saving it now would possibly result in inconsistencies) - try { - SaveLayoutBeforeClose save = editor.getServicesRegistry().getService(SaveLayoutBeforeClose.class); - save.saveBeforeClose(editor); - } catch (ServiceException e) { - // Doesn't matter; we'll just have to rely on the normal editor save - } - } - - return null; - } - - public void togglePrivatePageLayout(IMultiDiagramEditor editor) { - Command command = new SashLayoutCommandFactory(editor).createTogglePrivateLayoutCommand(); - EditingDomain domain = editor.getAdapter(EditingDomain.class); - - // Don't execute on the undo history because the changes in the sash model - // are never tracked for undo/redo - try { - TransactionHelper.run(domain, () -> command.execute()); - } catch (RollbackException e) { - StatusManager.getManager().handle(e.getStatus()); - } catch (InterruptedException e) { - Activator.log.error("Failed to execute page layout toggle command", e); //$NON-NLS-1$ - } - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferencePage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferencePage.java deleted file mode 100644 index 92b999ae38b..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferencePage.java +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.preferences; - -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * The preference page for Papyrus Editor general preferences. - */ -public class EditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - public EditorPreferencePage() { - super(Messages.EditorPreferencePage_0, SWT.FLAT); - - setDescription(Messages.EditorPreferencePage_5); - } - - @Override - public void init(IWorkbench workbench) { - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - } - - @Override - protected void createFieldEditors() { - addField(new RadioGroupFieldEditor(EditorPreferences.PREF_CONVERT_SHARED_LAYOUT, - Messages.EditorPreferencePage_1, - 1, - new String[][] { - { Messages.EditorPreferencePage_2, YesNo.PROMPT.name() }, - { Messages.EditorPreferencePage_3, YesNo.NO.name() }, - { Messages.EditorPreferencePage_4, YesNo.YES.name() }, - }, - getFieldEditorParent())); - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferences.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferences.java deleted file mode 100644 index e77d40263d0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/EditorPreferences.java +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.core.Activator; - -/** - * Accessor for the Papyrus Editor preferences. - */ -public class EditorPreferences { - public static final String PREF_CONVERT_SHARED_LAYOUT = "convertSharedLayout"; //$NON-NLS-1$ - - private static final EditorPreferences INSTANCE = new EditorPreferences(); - private final IPreferenceStore store; - - private EditorPreferences() { - super(); - - store = Activator.getDefault().getPreferenceStore(); - } - - public static EditorPreferences getInstance() { - return INSTANCE; - } - - /** - * Queries whether the user prefers to migrate shared editor layout to private storage - * always, never, or interactively pop up a dialog to ask (the default). - * - * @return the shared layout conversion on first open preference, which is never - * {@code null} and defaults to {@link YesNo#PROMPT} - */ - public YesNo getConvertSharedPageLayoutToPrivate() { - return YesNo.valueOf(store.getString(PREF_CONVERT_SHARED_LAYOUT)); - } - - /** - * Sets whether the editor will always, never, or ask the user to migrate shared - * (in the {@code *.di} resource) page layout into the private storage ({@code *.sash} resource} - * on the first opening of a Papyrus model in the workspace that uses the shared - * storage (usually from pre-1.0 release). - * - * @param convert - * the preference setting to assign, or {@code null} for the default, which - * is {@link YesNo#PROMPT} - */ - public void setConvertSharedPageLayoutToPrivate(YesNo convert) { - if (convert == null) { - convert = YesNo.PROMPT; - } - - store.setValue(PREF_CONVERT_SHARED_LAYOUT, convert.name()); - } - - // - // Nested types - // - - /** - * Initializer of defaults for the editor preferences. - */ - public static class Initializer extends AbstractPreferenceInitializer { - - public Initializer() { - super(); - } - - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - - store.setDefault(PREF_CONVERT_SHARED_LAYOUT, YesNo.PROMPT.name()); - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/Messages.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/Messages.java deleted file mode 100644 index 6556ba36b19..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/Messages.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.preferences; - -import org.eclipse.osgi.util.NLS; - -/** - * Translatable strings. - */ -class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.core.internal.preferences.messages"; //$NON-NLS-1$ - public static String EditorPreferencePage_0; - public static String EditorPreferencePage_1; - public static String EditorPreferencePage_2; - public static String EditorPreferencePage_3; - public static String EditorPreferencePage_4; - public static String EditorPreferencePage_5; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/YesNo.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/YesNo.java deleted file mode 100644 index cd697bca280..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/YesNo.java +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.internal.preferences; - -/** - * A tri-state boolean-ish preference data type with a "prompt the user" value. - */ -public enum YesNo { - PROMPT, NO, YES; -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/messages.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/messages.properties deleted file mode 100644 index a34a57ddfbe..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/preferences/messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2015 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 -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Christian W. Damus - Initial API and implementation -# - -EditorPreferencePage_0=General Editor Settings -EditorPreferencePage_1=Convert shared storage of editor layout to private: -EditorPreferencePage_2=Ask each time -EditorPreferencePage_3=Never -EditorPreferencePage_4=Always -EditorPreferencePage_5=General settings for the Papyrus multi-diagram editor. diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/BasicPageManagerServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/BasicPageManagerServiceFactory.java new file mode 100644 index 00000000000..c0a1724d1d3 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/BasicPageManagerServiceFactory.java @@ -0,0 +1,69 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.internal.sashmodel; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; + +/** + * Factory for the headless {@link IPageManager} service. + */ +public class BasicPageManagerServiceFactory implements IServiceFactory { + + private ModelSet modelSet; + + public BasicPageManagerServiceFactory() { + super(); + } + + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + this.modelSet = servicesRegistry.getService(ModelSet.class); + } + + @Override + public void startService() { + // Pass + } + + @Override + public void disposeService() { + // Pass + } + + @Override + public Object createServiceInstance() { + EditingDomain domain = TransactionUtil.getEditingDomain(modelSet); + IPageManager result; + + SashWindowsMngr diSashModel = SashModelUtils.getSashWindowsMngr(modelSet); + + if (domain != null) { + result = new TransactionalBasicPageManagerImpl(diSashModel, domain); + } else { + result = new BasicPageManagerImpl(diSashModel); + } + + return result; + } + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/TransactionalBasicPageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/TransactionalBasicPageManagerImpl.java new file mode 100644 index 00000000000..62b40c02ff1 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/sashmodel/TransactionalBasicPageManagerImpl.java @@ -0,0 +1,102 @@ +/***************************************************************************** + * Copyright (c) 2014, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.internal.sashmodel; + +import java.util.Collections; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.RollbackException; +import org.eclipse.emf.transaction.Transaction; +import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + +/** + * Transactional implementation of the basic (headless) page manager. + * + * It runs all commands in write transactions on the editing domain, without using the CommandStack. + * + * @author Camille Letavernier + * + */ +public class TransactionalBasicPageManagerImpl extends BasicPageManagerImpl { + + private EditingDomain editingDomain; + + public TransactionalBasicPageManagerImpl(SashWindowsMngr diSashModel, EditingDomain editingDomain) { + super(diSashModel); + + this.editingDomain = editingDomain; + } + + @Override + public void closePage(final Object pageIdentifier) { + run(editingDomain, () -> super.closePage(pageIdentifier)); + } + + @Override + public void closeAllOpenedPages() { + run(editingDomain, () -> super.closeAllOpenedPages()); + } + + @Override + public void closeOtherPages(final Object pageIdentifier) { + run(editingDomain, () -> super.closeOtherPages(pageIdentifier)); + } + + @Override + public void openPage(final Object pageIdentifier) { + run(editingDomain, () -> super.openPage(pageIdentifier)); + } + + @Override + public void openPage(final Object pageIdentifier, final String editorID) { + run(editingDomain, () -> super.openPage(pageIdentifier, editorID)); + } + + @Override + public void closeAllOpenedPages(final Object pageIdentifier) { + run(editingDomain, () -> super.closeAllOpenedPages(pageIdentifier)); + } + + protected static void run(EditingDomain domain, Runnable writeOperation) { + if (domain instanceof InternalTransactionalEditingDomain) { + try { + run((InternalTransactionalEditingDomain) domain, writeOperation); + } catch (Exception e) { + Bundle self = FrameworkUtil.getBundle(TransactionalBasicPageManagerImpl.class); + IStatus status = new Status(IStatus.ERROR, self.getSymbolicName(), "Sash model transaction failed.", e); //$NON-NLS-1$ + Platform.getLog(self).log(status); + } + } else { + // No need for any transaction + writeOperation.run(); + } + } + + private static void run(InternalTransactionalEditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException { + Transaction transaction = domain.startTransaction(false, Collections.emptyMap()); + try { + writeOperation.run(); + } finally { + transaction.commit(); + } + } + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/DoSaveEvent.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/DoSaveEvent.java deleted file mode 100644 index 6284515a571..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/DoSaveEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * Event sent whith a Save or SaveAs. - * - * @author cedric dumoulin - * - */ -public class DoSaveEvent { - - final protected ServicesRegistry serviceRegistry; - - final protected IMultiDiagramEditor multiDiagramEditor; - - final protected boolean isAutoSave; - - /** - * Create an Event that is sent with a Save or SaveAs. The same event can be - * reused. Constructor. - * - * @param serviceRegistry - * @param multiDiagramEditor - */ - public DoSaveEvent(ServicesRegistry serviceRegistry, IMultiDiagramEditor multiDiagramEditor) { - this(serviceRegistry, multiDiagramEditor, false); - } - - /** - * Create an Event that is sent with a Save or SaveAs. The same event can be - * reused. Constructor. - * - * @param serviceRegistry - * @param multiDiagramEditor - * @param isAutoSave - */ - public DoSaveEvent(ServicesRegistry serviceRegistry, IMultiDiagramEditor multiDiagramEditor, boolean isAutoSave) { - this.serviceRegistry = serviceRegistry; - this.multiDiagramEditor = multiDiagramEditor; - this.isAutoSave = isAutoSave; - } - - /** - * @return the serviceRegistry - */ - public ServicesRegistry getServiceRegistry() { - return serviceRegistry; - } - - /** - * @return the multiDiagramEditor - */ - public IMultiDiagramEditor getMultiDiagramEditor() { - return multiDiagramEditor; - } - - public boolean isAutoSave() { - return isAutoSave; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/IEditorInputChangedListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/IEditorInputChangedListener.java deleted file mode 100644 index 9731898a68f..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/IEditorInputChangedListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import org.eclipse.ui.part.FileEditorInput; - -/** - * Interface implemented by classes wishing to be notified of the inputChanged - * event after a call to {@link ISaveAndDirtyService#doSaveAs()}. - * - * @author cedric dumoulin - * - */ -public interface IEditorInputChangedListener { - - /** - * - * @param fileEditorInput - * The new value of EditorInput - */ - public void editorInputChanged(FileEditorInput fileEditorInput); - - /** - * Called when the value of the isDirty() flag has changed. - */ - public void isDirtyChanged(); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ILifeCycleEventsProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ILifeCycleEventsProvider.java deleted file mode 100644 index cd52255ff62..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ILifeCycleEventsProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -/** - * Concrete implementation of this interface allows to listen on various - * lifecycle events. This interface is the "public" part of the {@link LifeCycleEventsProvider}. - * - * @author cedric dumoulin - * - */ -public interface ILifeCycleEventsProvider { - - /** - * Add specified listener. - * - * @param listener - */ - public void addDoSaveListener(ISaveEventListener listener); - - /** - * Remove specified listener. - * - * @param listener - */ - public void removeDoSaveListener(ISaveEventListener listener); - - /** - * Add specified listener. - * - * @param listener - */ - public void addAboutToDoSaveListener(ISaveEventListener listener); - - /** - * Remove specified listener. - * - * @param listener - */ - public void removeAboutToDoSaveListener(ISaveEventListener listener); - - /** - * Add specified listener. - * - * @param listener - */ - public void addPostDoSaveListener(ISaveEventListener listener); - - /** - * Remove specified listener. - * - * @param listener - */ - public void removePostDoSaveListener(ISaveEventListener listener); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveAndDirtyService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveAndDirtyService.java deleted file mode 100644 index c531e65a0d3..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveAndDirtyService.java +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.ui.ISaveablePart; - -/** - * @author dumoulin - * - */ -public interface ISaveAndDirtyService extends ISaveablePart { - - /** - * Register a nested {@link ISaveablePart} as a listener that will be - * notified each time a {@link #doSave(IProgressMonitor)} or {@link #doSaveAs()} is performed. Also, it will be asked for the - * dirtyState. - * - * @param saveablePart - */ - public abstract void registerIsaveablePart(ISaveablePart saveablePart); - - /** - * Remove the specified {@link ISaveablePart} from the list of listeners. - * - * @param saveablePart - */ - public abstract void removeIsaveablePart(ISaveablePart saveablePart); - - /** - * Add a listeners on input changed event. - * - * @param inputChangedListener - */ - public void addInputChangedListener(IEditorInputChangedListener inputChangedListener); - - /** - * Remove a listeners on input changed event. - * - * @param inputChangedListener - */ - public void removeInputChangedListener(IEditorInputChangedListener inputChangedListener); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveEventListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveEventListener.java deleted file mode 100644 index 563a66c3389..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/ISaveEventListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -/** - * Interface used to listen on open, save and saveAs events. - * - * @author cedric dumoulin - * - * @param - * Type of event passed to methods. - */ -public interface ISaveEventListener { - - /** - * - * @param editor - */ - public void doSave(DoSaveEvent event); - - /** - * - * @param editor - */ - public void doSaveAs(DoSaveEvent event); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProvider.java deleted file mode 100644 index daa6931f5b1..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProvider.java +++ /dev/null @@ -1,291 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import java.util.ArrayList; -import java.util.List; - -/** - * This class provides events about the life cycle of a MultiEditor. Not all - * life cycle events are available. Available events: - *
    - *
  • aboutToDoSave, aboutToDoSaveAs - SaveEventListener
  • - *
  • doSave, doSaveAs - SaveEventListener
  • - *
  • afterDoSave, afterDoSaveAs - SaveEventListener
  • - *
  • - *
  • - *
- * - * - * @author cedric dumoulin - * - */ -public class LifeCycleEventsProvider implements ILifeCycleEventsProvider { - - /** - * - */ - protected SaveEventListenerLazyList preSaveListeners = new SaveEventListenerLazyList(); - - /** - * - */ - protected SaveEventListenerLazyList saveListeners = new SaveEventListenerLazyList(); - - /** - * - */ - protected SaveEventListenerLazyList postSaveListeners = new SaveEventListenerLazyList(); - - /** - * Add specified listener. - * - * @param listener - */ - @Override - public void addDoSaveListener(ISaveEventListener listener) { - - saveListeners.addListener(listener); - } - - /** - * Remove specified listener. - * - * @param listener - */ - @Override - public void removeDoSaveListener(ISaveEventListener listener) { - saveListeners.removeListener(listener); - } - - /** - * Add specified listener. - * - * @param listener - */ - @Override - public void addAboutToDoSaveListener(ISaveEventListener listener) { - - preSaveListeners.addListener(listener); - } - - /** - * Remove specified listener. - * - * @param listener - */ - @Override - public void removeAboutToDoSaveListener(ISaveEventListener listener) { - preSaveListeners.removeListener(listener); - } - - /** - * Add specified listener. - * - * @param listener - */ - @Override - public void addPostDoSaveListener(ISaveEventListener listener) { - - postSaveListeners.addListener(listener); - } - - /** - * Remove specified listener. - * - * @param listener - */ - @Override - public void removePostDoSaveListener(ISaveEventListener listener) { - postSaveListeners.removeListener(listener); - } - - // ****************************************************** // - // Fire events methods // - // ****************************************************** // - - /** - * Fire AboutToSaveEvent to registered Listeners. - * - * @param editorPart - */ - public void fireAboutToDoSaveEvent(DoSaveEvent event) { - preSaveListeners.fireSaveEvent(event); - } - - /** - * Fire AboutToSaveAs to registered Listeners. - * - * @param editorPart - */ - public void fireAboutToDoSaveAsEvent(DoSaveEvent event) { - preSaveListeners.fireSaveAsEvent(event); - } - - /** - * Fire AboutToSaveEvent to registered Listeners. - * - * @param editorPart - */ - public void fireDoSaveEvent(DoSaveEvent event) { - saveListeners.fireSaveEvent(event); - } - - /** - * Fire AboutToSaveAs to registered Listeners. - * - * @param editorPart - */ - public void fireDoSaveAsEvent(DoSaveEvent event) { - saveListeners.fireSaveAsEvent(event); - } - - /** - * Fire AboutToSaveEvent to registered Listeners. - * - * @param editorPart - */ - public void firePostDoSaveEvent(DoSaveEvent event) { - postSaveListeners.fireSaveEvent(event); - } - - /** - * Fire AboutToSaveAs to registered Listeners. - * - * @param editorPart - */ - public void firePostDoSaveAsEvent(DoSaveEvent event) { - postSaveListeners.fireSaveAsEvent(event); - } - - /** - * Fire all Save events (about, events, post) to registered Listeners. - * Exceptions from listeners are propagated and stop the event chain. - * - * @param editorPart - */ - public void fireAllDoSaveEvent(DoSaveEvent event) { - fireAboutToDoSaveEvent(event); - fireDoSaveEvent(event); - firePostDoSaveEvent(event); - } - - /** - * Fire all SaveAs events (about, events, post) to registered Listeners. If - * one of the saveAs event fail, post events are not sent. - * - * @param editorPart - */ - public void fireAllDoSaveAsEvent(DoSaveEvent event) { - fireAboutToDoSaveAsEvent(event); - fireDoSaveAsEvent(event); - firePostDoSaveAsEvent(event); - } - - /** - * Base class encapsulating a lazy creation list. - * - * @author cedric dumoulin - * - * @param - */ - abstract protected class AbstractEventListenersLazyList { - - List listeners; - - /** - * Add specified listener. - * - * @param listener - */ - public void addListener(T listener) { - // Lazy creation - if (listeners == null) { - listeners = new ArrayList(); - } - - // do not add if already present. - if (listeners.contains(listener)) { - return; - } - - listeners.add(listener); - } - - /** - * Remove specified listener. - * - * @param listener - */ - public void removeListener(T listener) { - // Lazy creation - if (listeners == null) { - return; - } - - listeners.remove(listener); - } - - /** - * @return the listeners - */ - protected List getListeners() { - return listeners; - } - - /** - * Remove all listeners. - */ - protected void clear() { - if (listeners != null) { - listeners.clear(); - } - } - } - - /** - * List of {@link ISaveEventListener}. - * - * @author cedric dumoulin - * - */ - protected class SaveEventListenerLazyList extends AbstractEventListenersLazyList { - - /** - * Fire OpenEvent to registered Listeners. If a listener throw an - * exception, remaining listeners are called, and then the exception is - * resent. - * - * @param editorPart - */ - public void fireSaveEvent(DoSaveEvent event) { - // Lazy creation - if (listeners == null) { - return; - } - - for (ISaveEventListener listener : listeners) { - listener.doSave(event); - } - } - - /** - * Fire OpenEvent to registered Listeners. - * - * @param editorPart - */ - public void fireSaveAsEvent(DoSaveEvent event) { - // Lazy creation - if (listeners == null) { - return; - } - - for (ISaveEventListener listener : listeners) { - listener.doSaveAs(event); - } - - } - - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderServiceFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderServiceFactory.java deleted file mode 100644 index 01082a0c75d..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderServiceFactory.java +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import org.eclipse.papyrus.infra.core.services.IServiceFactory; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - -/** - * A service factory to create the {@link ILifeCycleEventsProvider} service. - * This provide a nickname for {@link SaveAndDirtyService} service. This - * serviceFactory depends on {@link SaveAndDirtyService} service. - * - * @author cedric dumoulin - * - */ -public class LifeCycleEventsProviderServiceFactory implements IServiceFactory { - - /** - * The sashModelMangr. - */ - private SaveAndDirtyService saveAndDirtyService; - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - // Get required services - // This rely on the real implementation. - saveAndDirtyService = (SaveAndDirtyService) servicesRegistry.getService(ISaveAndDirtyService.class); - - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() - * - * @return - * @throws ServiceException - */ - @Override - public Object createServiceInstance() throws ServiceException { - return saveAndDirtyService; - } - -} 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 deleted file mode 100644 index a34a742d272..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java +++ /dev/null @@ -1,550 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010, 2013 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * Christian W. Damus (CEA) - Don't make editor dirty on empty ResourceSetChangeEvent - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import static org.eclipse.papyrus.infra.core.Activator.log; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.EventObject; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.transaction.NotificationFilter; -import org.eclipse.emf.transaction.ResourceSetChangeEvent; -import org.eclipse.emf.transaction.ResourceSetListener; -import org.eclipse.emf.transaction.RollbackException; -import org.eclipse.emf.transaction.Transaction; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.services.IService; -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.swt.widgets.Shell; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.ISaveablePart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.part.FileEditorInput; - -/** - * A Papyrus Service allowing to perform save and saveAs on Papyrus Models. The - * service also allows to listen on the dirty state of the Models.
- * The service implements the {@link ISaveablePart} interface, and can be used - * directly in part requiring such interface of adapter. - * - *
- * This class allows nested editors to register themselves as nested {@link ISaveablePart}. In this case, the registered part will be notified - * each time a save or saveAs is performed. Also, the nested part will be asked - * for its dirtyState. - * - * TODO : Improve the implementation by registering the isDirty flag value, and - * firing events only if the value really change. Actually, the event is fired - * every time the model is modified, even if the virtual value of the flag - * hasn't changed. - * - * @author cedric dumoulin - * - */ -public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISaveablePart, IService, ISaveAndDirtyService { - - /** - * Class used to propagate life cycle events. This class can be retrieved as - * a service using {@link ILifeCycleEventsProvider}.class. This class - * extends LifeCycleEventsProvider, so the local variable is set with - * ourself (historical reasons). TODO : remove this local variable. - */ - protected LifeCycleEventsProvider lifeCycleEventsProvider = this; - - /** - * Cached event that can be reused. - */ - protected DoSaveEvent lifeCycleEvent; - - /** - * Model set managing models. - */ - private ModelSet resourceSet; - - /** - * - */ - private TransactionalEditingDomain transactionalEditingDomain; - - /** - * The serviceRegistry. - */ - // private ServicesRegistry servicesRegistry; - - /** - * Associated editor. Needed by saveAs to synchronize editor input. - */ - private IMultiDiagramEditor multiDiagramEditor; - - /** - * List of registered {@link ISaveablePart}. This are usually nested - * editors. - */ - private ISaveablePartList registeredIsaveablePart; - - /** - * List of listeners on input changed event after a call to saveAs. - */ - private List inputChangedListeners; - - /** - * Listener on commandStack changes. - */ - private final CommandStackListener commandStackListener = new CommandStackListener() { - - @Override - public void commandStackChanged(EventObject event) { - - fireIsDirtyChanged(); - }; - }; - - /* - * Listener on ResourceSet - */ - private final ResourceSetListener resourceSetListener = new ResourceSetListener() { - - @Override - public NotificationFilter getFilter() { - return null; - } - - @Override - public boolean isAggregatePrecommitListener() { - return false; - } - - @Override - public boolean isPostcommitOnly() { - return true; - } - - @Override - public boolean isPrecommitOnly() { - return false; - } - - @Override - public void resourceSetChanged(ResourceSetChangeEvent event) { - if (event.getTransaction() != null && event.getTransaction().getStatus().isOK() && madePersistableChanges(event)) { - fireIsDirtyChanged(); - } - } - - private boolean madePersistableChanges(ResourceSetChangeEvent event) { - return !event.getNotifications().isEmpty() && !isUnprotected(event.getTransaction()); - } - - private boolean isUnprotected(Transaction transaction) { - return !Boolean.TRUE.equals(transaction.getOptions().get(Transaction.OPTION_UNPROTECTED)); - } - - @Override - public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { - return null; - } - - }; - - /** - * Constructor. - * - */ - public SaveAndDirtyService() { - registeredIsaveablePart = new ISaveablePartList(); - inputChangedListeners = new ArrayList(); - } - - /** - * Initialize the service. Retrieve other required services (ModelSet, - * CoreEditor). - * - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - * @throws ServiceException - */ - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - - // this.servicesRegistry = servicesRegistry; - - // Retrieve required services. - resourceSet = servicesRegistry.getService(ModelSet.class); - multiDiagramEditor = servicesRegistry.getService(IMultiDiagramEditor.class); - transactionalEditingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(servicesRegistry); - - // Initialize and register the ILifeCycleEventsProvider service (which - // is ourself). - // This mean that the ILifeCycleEventsProvider is not available until we - // are started. - lifeCycleEvent = new DoSaveEvent(servicesRegistry, multiDiagramEditor); - // servicesRegistry.add(ILifeCycleEventsProvider.class, 1, - // lifeCycleEventsProvider); - - } - - /** - * Do nothing. - * - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - * - * @throws ServiceException - */ - @Override - public void startService() throws ServiceException { - - // Listen to the modifications of the EMF model - transactionalEditingDomain.getCommandStack().addCommandStackListener(commandStackListener); - - // Let's listen to the resource set change - transactionalEditingDomain.addResourceSetListener(resourceSetListener); - } - - /** - * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() - * - * @throws ServiceException - */ - @Override - public void disposeService() throws ServiceException { - if (transactionalEditingDomain != null) { - // Check if commandStack is null (meaning that transactionalEditingDomain - // is disposed - CommandStack commandStack = transactionalEditingDomain.getCommandStack(); - if (commandStack != null) { - transactionalEditingDomain.getCommandStack().removeCommandStackListener(commandStackListener); - } - transactionalEditingDomain.removeResourceSetListener(resourceSetListener); - // resourceSetListener = null; - } - - // clean properties in order to help GC - inputChangedListeners.clear(); - inputChangedListeners = null; - multiDiagramEditor = null; - // servicesRegistry = null; - transactionalEditingDomain = null; - resourceSet = null; - lifeCycleEvent = null; - - postSaveListeners.clear(); - saveListeners.clear(); - preSaveListeners.clear(); - - - } - - /** - * Save the Models - * - * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - * - * @param monitor - */ - @Override - public void doSave(IProgressMonitor monitor) { - // Sent pre doSave event - lifeCycleEventsProvider.fireAboutToDoSaveEvent(lifeCycleEvent); - - // sent doSaveEvent - lifeCycleEventsProvider.fireDoSaveEvent(lifeCycleEvent); - // Perform local doSave - // TODO : put it in a listener ? - try { - // Save each associated resource - resourceSet.save(monitor); - // notify registered IsaveablePart - registeredIsaveablePart.doSave(monitor); - markSaveLocation(); - } catch (IOException e) { - log.error("Error during save", e); //$NON-NLS-1$ - } - - // Sent post Events - lifeCycleEventsProvider.firePostDoSaveEvent(lifeCycleEvent); - - } - - /** - * @see org.eclipse.ui.ISaveablePart#doSaveAs() - * - */ - @Override - public void doSaveAs() { - // Sent pre doSave event - lifeCycleEventsProvider.fireAboutToDoSaveAsEvent(lifeCycleEvent); - - // sent doSaveEvent - lifeCycleEventsProvider.fireDoSaveAsEvent(lifeCycleEvent); - // Perform local doSaveAs - - // Show a SaveAs dialog - Shell shell = multiDiagramEditor.getEditorSite().getWorkbenchWindow().getShell(); - SaveAsDialog dialog = new SaveAsDialog(shell); - dialog.setOriginalFile(((IFileEditorInput) multiDiagramEditor.getEditorInput()).getFile()); - dialog.open(); - final IPath path = dialog.getResult(); - if (path != null) { - // try to save the editor's contents under a different file name - final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - try { - new ProgressMonitorDialog(shell).run(false, // don't fork - false, // can't cancel - new WorkspaceModifyOperation() { // run this operation - - @Override - public void execute(final IProgressMonitor monitor) { - try { - // to event bad redirection after the saveAs - // see bug 319023 - EcoreUtil.resolveAll(resourceSet); - resourceSet.saveAs(path); - // notify registered IsaveablePart - registeredIsaveablePart.doSave(monitor); - } catch (IOException e) { - log.error("Unable to saveAs the resource set", e); //$NON-NLS-1$ - } - } - }); - // set input to the new file - fireEditorInputChanged(new FileEditorInput(file)); - markSaveLocation(); - } catch (InterruptedException e) { - // should not happen, since the monitor dialog is not cancelable - log.error(e); - } catch (InvocationTargetException e) { - log.error(e); - } - } - - // sent doSaveEvent - lifeCycleEventsProvider.firePostDoSaveAsEvent(lifeCycleEvent); - } - - /** - * Change the input of the underlying editor. - * - * @param fileEditorInput - */ - private void fireEditorInputChanged(FileEditorInput fileEditorInput) { - - for (IEditorInputChangedListener listener : inputChangedListeners) { - try { - listener.editorInputChanged(fileEditorInput); - } catch (Exception e) { - log.error("Can't set input for '" + listener + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - } - - /** - * Fire a PropertyChanged event to registered {@link IEditorInputChangedListener}. - * - * @param propertyId - */ - private void fireIsDirtyChanged() { - - for (IEditorInputChangedListener listener : inputChangedListeners) { - try { - listener.isDirtyChanged(); - } catch (Exception e) { - log.error("Can't call listener '" + listener + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - } - - /** - * Return true if the multiEditor is dirty, false otherwise. The dirty state - * is compute as follow: - *
    - *
  • The {@link TransactionalEditingDomain} commandStack is checked
  • - *
  • and each registered nested Isaveable.isDirty() state is checked
  • - *
  • - *
  • - *
  • - *
  • - *
- * If one of these states is false, the returned value is false.
- * If all of these states are true, the returned value is true. - * - * @see org.eclipse.ui.ISaveablePart#isDirty() - * - * @return - */ - @Override - public boolean isDirty() { - // First, look if the model part (EMF) is dirty, else look at the - // Graphical part (GEF/GMF) - if (transactionalEditingDomain == null) { - return false; - } - return ((BasicCommandStack) transactionalEditingDomain.getCommandStack()).isSaveNeeded() || registeredIsaveablePart.isDirty(); - } - - /** - * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed() - * - * @return - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded() - * - * @return - */ - @Override - public boolean isSaveOnCloseNeeded() { - return isDirty(); - } - - /** - * Mark the command stack of all sub-editors. Default implementation do - * nothing. - */ - protected void markSaveLocation() { - ((BasicCommandStack) transactionalEditingDomain.getCommandStack()).saveIsDone(); - fireIsDirtyChanged(); - } - - /** - * Register a nested {@link ISaveablePart} as a listener that will be - * notified each time a {@link #doSave(IProgressMonitor)} or {@link #doSaveAs()} is performed. Also, it will be asked for the - * dirtyState. - * - * @param saveablePart - */ - @Override - public void registerIsaveablePart(ISaveablePart saveablePart) { - registeredIsaveablePart.add(saveablePart); - } - - /** - * Remove the specified {@link ISaveablePart} from the list of listeners. - * - * @param saveablePart - */ - @Override - public void removeIsaveablePart(ISaveablePart saveablePart) { - registeredIsaveablePart.remove(saveablePart); - } - - /** - * Add a listeners on input changed event. - * - * @param inputChangedListener - */ - @Override - public void addInputChangedListener(IEditorInputChangedListener inputChangedListener) { - inputChangedListeners.add(inputChangedListener); - } - - /** - * Remove a listeners on input changed event. - * - * @param inputChangedListener - */ - @Override - public void removeInputChangedListener(IEditorInputChangedListener inputChangedListener) { - inputChangedListeners.remove(inputChangedListener); - } - - /** - * A list of {@link ISaveablePart}. - * - * @author dumoulin - * - */ - public class ISaveablePartList extends ArrayList { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Return true if one of the part is dirty, false if all part are not - * dirty. - * - * @return - */ - public boolean isDirty() { - for (ISaveablePart part : this) { - if (part.isDirty()) { - return true; - } - } - - return false; - } - - /** - * Call doSave on each registered {@link ISaveablePart}. - * - * @param monitor - */ - public void doSave(IProgressMonitor monitor) { - for (ISaveablePart part : this) { - - try { - part.doSave(monitor); - } catch (Exception e) { - log.error("Can't save ISaveablePart '" + part + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - } - - /** - * Call doSaveAs on each registered {@link ISaveablePart}. - * - * @param monitor - */ - public void doSaveAs() { - for (ISaveablePart part : this) { - try { - part.doSaveAs(); - } catch (Exception e) { - log.error("Can't save ISaveablePart '" + part + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java deleted file mode 100644 index 284d8c9e08a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor; - -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.ui.part.EditorActionBarContributor; - -/** - * Descriptor of an ActionBarContributor. This descriptor is usually loaded from - * the Eclipse extension mechanism. - * - * @author Cedric Dumoulin - * @author Patrick Tessier - * - */ -public class ActionBarContributorDescriptor { - - protected Class contextClass; - - protected String contextId; - - /** - * Instance is created when requested. - */ - protected EditorActionBarContributor instance = null; - - /** - * constructor. - * - * @return the context descriptor - * @throws BackboneException - */ - protected EditorActionBarContributor getActionBarContributor() throws BackboneException { - if (instance == null) { - instance = createActionBarContributor(); - } - - return instance; - } - - private EditorActionBarContributor createActionBarContributor() throws BackboneException { - try { - EditorActionBarContributor context = contextClass.newInstance(); - return context; - - } catch (SecurityException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } catch (InstantiationException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // Lets propagate. This is an implementation problem that should be - // solved by programmer. - throw new RuntimeException(e); - } - } - -} // end class diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java deleted file mode 100644 index bd5a9997593..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.papyrus.infra.core.extension.BadNameExtensionException; -import org.eclipse.papyrus.infra.core.extension.ExtensionException; -import org.eclipse.papyrus.infra.core.extension.ExtensionUtils; -import org.eclipse.ui.part.EditorActionBarContributor; - -/** - * A factory used to create ActionBarContributor object from Eclipse extensions - * points elements. - * - * @author Cedric Dumoulin - * @auhtor Patrick Tessier - */ -public class ActionBarContributorExtensionFactory extends ExtensionUtils { - - /** singleton eINSTANCE of this class */ - public final static ActionBarContributorExtensionFactory eINSTANCE = new ActionBarContributorExtensionFactory(); - - /** constant for the editor diagram **/ - public final static String EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT = "" + "actionBarContributor"; - - /** constant for the attribute factoryClass **/ - public final static String CONTEXTCLASS_ATTRIBUTE = "implementingClass"; - - /** constant for the attribute contextId **/ - public final static String ID_ATTRIBUTE = "id"; - - /** - * @return the eINSTANCE - */ - public static ActionBarContributorExtensionFactory getInstance() { - return eINSTANCE; - } - - /** - * Create a ContextDescriptor instance corresponding to the - * ConfigurationElement. - * - * @param element - * an {@link IConfigurationElement} see eclipse extension point - * @return a ContextDescriptor structure that contains information to the - * diagram context - * @throws BadNameExtensionException - **/ - public ActionBarContributorDescriptor createActionBarContributorDescriptor(IConfigurationElement element) throws ExtensionException { - ActionBarContributorDescriptor res; - - checkTagName(element, EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT); - - res = new ActionBarContributorDescriptor(); - res.contextClass = (Class) parseClass(element, CONTEXTCLASS_ATTRIBUTE, EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT); - res.contextId = element.getAttribute(ID_ATTRIBUTE); - - return res; - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java deleted file mode 100644 index 1bdd1f129b9..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java +++ /dev/null @@ -1,176 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor; - -import static org.eclipse.papyrus.infra.core.Activator.log; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.extension.ExtensionException; -import org.eclipse.papyrus.infra.core.extension.NotFoundException; -import org.eclipse.papyrus.infra.core.services.IService; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.ui.part.EditorActionBarContributor; - -/** - * A factory managing ActionBarContributor creation. The factory is loaded from - * ActionBarContributor declared in Eclipse extension mechanism. - * - * @author dumoulin - * - */ -public class ActionBarContributorRegistry implements IActionBarContributorFactory, IService { - - /** ID of the editor extension (schema filename) */ - public static final String EDITOR_EXTENSION_ID = "papyrusDiagram"; - - /** Namespace where to look for the extension points. */ - protected String extensionPointNamespace; - - /** - * Registered context descriptors. - */ - private Map editorContextDescriptors; - - /** - * Constructor. defaultContext, input and site are explicitly required in - * order be sure that they are initialized. The multiEditor should be - * initialized. In particular, getEditorSite(), getEditorInput() and - * getDefaultContext() should return initialized values. - * - * @param multiEditor - * the multieditor - * @param extensionPointNamespace - */ - public ActionBarContributorRegistry(String extensionPointNamespace) { - - this.extensionPointNamespace = extensionPointNamespace; - initializeEditorContextDescriptors(); - } - - /** - * - * {@inheritDoc} - */ - @Override - public EditorActionBarContributor getActionBarContributor(Object key) throws BackboneException { - try { - ActionBarContributorDescriptor desc = editorContextDescriptors.get(key); - return desc.getActionBarContributor(); - } catch (NullPointerException e) { - // no context found. - throw new NotFoundException("No ActionBarContributor registered under id '" + key + "'."); - } - } - - /** - * Get the list of descriptors. - * - * @return - * @throws BackboneException - * If a contributor fail to be loaded. - */ - public List getActionBarContributors() throws BackboneException { - List res = new ArrayList(); - for (ActionBarContributorDescriptor desc : editorContextDescriptors.values()) { - res.add(desc.getActionBarContributor()); - } - return res; - } - - /** - * - * {@inheritDoc} - */ - public void registerActionBarContributor(String contextKey, EditorActionBarContributor contributor) { - ActionBarContributorDescriptor desc = new ActionBarContributorDescriptor(); - desc.contextId = contextKey; - desc.instance = contributor; - desc.contextClass = contributor.getClass(); - - editorContextDescriptors.put(contextKey, desc); - } - - /** - * Read context descriptors from extension points. - */ - private void initializeEditorContextDescriptors() { - - editorContextDescriptors = new HashMap(); - // Reading data from plugins - IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); - - ActionBarContributorExtensionFactory extensionReader = new ActionBarContributorExtensionFactory(); - - for (IConfigurationElement ele : configElements) { - ActionBarContributorDescriptor desc; - try { - if (ActionBarContributorExtensionFactory.EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT.equals(ele.getName())) { - desc = extensionReader.createActionBarContributorDescriptor(ele); - // Check double - if (editorContextDescriptors.get(desc.contextId) != null) { - // Already exists. Check if it is the same - ActionBarContributorDescriptor existingDesc = editorContextDescriptors.get(desc.contextId); - if (desc.equals(existingDesc)) { - log.warn("More than one ActionBarContributor is registered under the name '" + desc.contextId + "', with different parameters. Extra declaration are discarded."); - } - } else { - editorContextDescriptors.put(desc.contextId, desc); - } - } - } catch (ExtensionException e) { - log.error(e.getMessage(), e); - } - } - - if (log.isDebugEnabled()) { - log.debug(this.getClass().getSimpleName() + " : contributors desc loaded [" + editorContextDescriptors.size() + "]"); - } - } - - /** - * Initialize the service. Do nothing here. - * - * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) - * - * @param servicesRegistry - */ - @Override - public void init(ServicesRegistry servicesRegistry) { - - } - - /** - * Do nothing in this implementation. {@inheritDoc} - * - * @see org.eclipse.papyrus.infra.core.services.IService#startService() - */ - @Override - public void startService() { - } - - /** - * Do nothing in this implementation. - */ - @Override - public void disposeService() { - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java deleted file mode 100644 index 51068c52408..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java +++ /dev/null @@ -1,122 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor; - -import java.util.List; - -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor.ComposedActionBarContributor; -import org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor.IMultiPageEditorActionBarContributor; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.part.EditorActionBarContributor; - -/** - * - * An ActionBarContributor composed of ActionBarContributor from multi editor. - * This ActionBarContributor switch to the contributor dedicated to the active - * editor in a MultiPageEditor environement. - * - * @author dumoulin - * - */ -public class CoreComposedActionBarContributor extends ComposedActionBarContributor implements IMultiPageEditorActionBarContributor { - - /** - * The registry. Used to initialize the registered actionBars. - */ - protected ActionBarContributorRegistry actionBarContributorRegistry; - - protected List contributors; - - /** - * Constructor. - * - * @throws BackboneException - */ - public CoreComposedActionBarContributor() throws BackboneException { - // Init the contributors - loadContributors(); - } - - /** - * - * @throws BackboneException - */ - private void loadContributors() throws BackboneException { - actionBarContributorRegistry = new ActionBarContributorRegistry(Activator.PLUGIN_ID); - - contributors = actionBarContributorRegistry.getActionBarContributors(); - } - - /** - * @return the actionBarContributorRegistry - */ - public ActionBarContributorRegistry getActionBarContributorRegistry() { - return actionBarContributorRegistry; - } - - /** - * Dispose all nested ActionBarContributors. - */ - @Override - public void dispose() { - // Dispose nested contributors. - for (EditorActionBarContributor contributor : contributors) { - contributor.dispose(); - } - super.dispose(); - } - - /** - * Call the same method on each registered nested ActionBarContributors. - */ - @Override - public void init(IActionBars bars, IWorkbenchPage page) { - super.init(bars, page); - buildActions(); - - // init nested contributors. - for (EditorActionBarContributor contributor : contributors) { - contributor.init(bars, page); - // remove GMF GlobalSaveAction from bar, fix bug 407854 - [Editor] The save action is disabled in Papyrus - bars.setGlobalActionHandler("save", null); // GMF is not using IWorkbenchCommandConstants.FILE_SAVE as ID //$NON-NLS-1$ - } - - } - - /** - * Load default actions (undo/redo/delete) - * - * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions() - */ - protected void buildActions() { - // getActionBars().getToolBarManager().add(new UndoRetargetAction()); - // getActionBars().getToolBarManager().add(new RedoRetargetAction()); - } - - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - for (EditorActionBarContributor contributor : contributors) { - if (part != null) { - contributor.setActiveEditor(part); - } - } - - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/IActionBarContributorFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/IActionBarContributorFactory.java deleted file mode 100644 index 15577561153..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/multidiagram/actionbarcontributor/IActionBarContributorFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor; - -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.ui.part.EditorActionBarContributor; - -/** - * Interface used to get an ActionBarContributor from its ID. - * - * @author dumoulin - * - */ -public interface IActionBarContributorFactory { - - /** - * Get an ActionBarContributor by its key. If an ActionBarContributor - * already exists for this key, return it. - * - * @param key - * @return - */ - public EditorActionBarContributor getActionBarContributor(Object key) throws BackboneException; -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java index 31fd7a1f4b7..d743fde87e1 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java @@ -1,6 +1,16 @@ -/** +/***************************************************************************** + * Copyright (c) 2011, 2016 CEA LIST, Atos, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ package org.eclipse.papyrus.infra.core.resource; import java.io.IOException; @@ -15,7 +25,7 @@ import org.eclipse.emf.ecore.xmi.IllegalValueException; import org.eclipse.papyrus.infra.core.Activator; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import com.google.common.base.Function; import com.google.common.collect.Collections2; @@ -43,7 +53,7 @@ public class ModelUtils { @Deprecated public static ModelSet getModelSet() { try { - return ServiceUtilsForActionHandlers.getInstance().getModelSet(); + return ServiceUtils.getInstance().getModelSet(null); } catch (ServiceException e) { return null; } @@ -65,7 +75,7 @@ public class ModelUtils { */ @Deprecated public static ModelSet getModelSetChecked() throws ServiceException { - return ServiceUtilsForActionHandlers.getInstance().getModelSet(); + return ServiceUtils.getInstance().getModelSet(null); } /** diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashLayoutCommandFactory.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashLayoutCommandFactory.java deleted file mode 100644 index facbe085f31..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashLayoutCommandFactory.java +++ /dev/null @@ -1,225 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.resource.sasheditor; - -import java.util.ArrayList; - -import org.eclipse.emf.common.command.AbstractCommand; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.UnexecutableCommand; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; -import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; -import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; -import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; - -/** - * A factory for commands that manipulate the configuration of the sash editor layout. - */ -public class SashLayoutCommandFactory { - private final IMultiDiagramEditor editor; - - public SashLayoutCommandFactory(IMultiDiagramEditor editor) { - super(); - - this.editor = editor; - } - - /** - * Creates a command that toggles whether the sash model is stored in the private - * workspace metadata area or in the shared {@code *.di} file. - * - * @return a toggle command for the private layout storage - */ - public Command createTogglePrivateLayoutCommand() { - Command result = UnexecutableCommand.INSTANCE; - - ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); - org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel sashModel = SashModelUtils.getSashModel(modelSet); - if (sashModel != null) { - result = new AbstractToggleCommand("Toggle Private Editor Layout") { - private Command toggleRestoreActivePage; - - { - // If we are toggling off private mode, make sure that we stop - // tracking the active page selection if we were tracking it. - // And remember that for undo - if (!sashModel.isLegacyMode()) { - SashWindowsMngr sash = DiUtils.lookupSashWindowsMngr(sashModel.getResource()); - if ((sash != null) && (sash.getSashModel() != null) && sash.getSashModel().isRestoreActivePage()) { - toggleRestoreActivePage = createToggleRestoreActivePageCommand(); - } - } - } - - @Override - public void execute() { - // First, if we need to toggle restoring the active page, do that - if ((toggleRestoreActivePage != null) && toggleRestoreActivePage.canExecute()) { - toggleRestoreActivePage.execute(); - } - - SashWindowsMngr toMove = DiUtils.lookupSashWindowsMngr(sashModel.getResource()); - - // We don't record changes in the sash model for undo/redo, - // so we cannot assume that any changes to the current page selections - // are undoable in the usual way - if (!sashModel.isLegacyMode()) { - Resource sashResource = toMove.eResource(); - URI sharedURI = sashModel.getSharedResourceURI(); - - // Move the contents into the DI model. If the DI resource isn't loaded, - // give up because something is seriously wrong in that case - Resource diResource = modelSet.getResource(sharedURI, false); - if ((diResource != null) && diResource.isLoaded()) { - moveContents(sashResource, diResource); - - if (sashResource.getContents().isEmpty()) { - // Schedule deletion on save - modelSet.getResourcesToDeleteOnSave().add(sashResource.getURI()); - } - } - } else { - Resource sashResource; - URI privateURI = sashModel.getPrivateResourceURI(); - - // Move the contents into the sash model. If the sash resource isn't loaded - // or doesn't exist, it will have to be handled - if (modelSet.getURIConverter().exists(privateURI, null)) { - sashResource = modelSet.getResource(privateURI, true); - } else { - sashResource = modelSet.createResource(privateURI); - } - - // In case we had marked it for deletion, earlier - modelSet.getResourcesToDeleteOnSave().remove(privateURI); - - Resource diResource = toMove.eResource(); - moveContents(diResource, sashResource); - } - - // Re-load from the new resource. Snippets might find this odd, but - // it would be even more odd for there to be any snippets on this model - sashModel.loadModel(modelSet.getURIWithoutExtension()); - } - }; - } - - return result; - } - - void moveContents(Resource fromResource, Resource toResource) { - // Safe copy to allow concurrent modifications - for (EObject root : new ArrayList<>(fromResource.getContents())) { - EObject toReplace = (EObject) EcoreUtil.getObjectByType(toResource.getContents(), root.eClass()); - if (toReplace != null) { - EcoreUtil.replace(toReplace, root); - } else { - if (root instanceof SashWindowsMngr) { - // This one is expected always to be first - toResource.getContents().add(0, root); - } else { - toResource.getContents().add(root); - } - } - } - - } - - /** - * Creates a command that toggles whether the sash model records the currently - * active page to restore it on next opening. - * - * @return a toggle command for the restore-active-page behaviour - */ - public Command createToggleRestoreActivePageCommand() { - Command result = UnexecutableCommand.INSTANCE; - - ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); - SashWindowsMngr sashWindows = SashModelUtils.getSashWindowsMngr(modelSet); - ISashWindowsContainer container = editor.getAdapter(ISashWindowsContainer.class); - - SashModel sashModel = sashWindows.getSashModel(); - if (sashModel != null) { - // We don't record the tracking of the active page for undo/redo, - // so we cannot assume that any changes to the current page selections - // are undoable in the usual way - result = new AbstractToggleCommand("Toggle Restore Active Page") { - - @Override - public void execute() { - boolean oldValue = sashModel.isRestoreActivePage(); - - if (oldValue) { - // Clear each tab folder's selection - container.getIFolderList().stream() - .map(f -> f.getRawModel()) - .filter(TabFolder.class::isInstance).map(TabFolder.class::cast) - .filter(f -> f.getCurrentSelection() != null) - .forEach(f -> f.setCurrentSelection(null)); - } else { - // Set each tab folder's selection. - // The 'visible pages' are the current selection in each folder - container.getVisiblePages().stream() - .map(p -> p.getRawModel()) - .filter(PageRef.class::isInstance).map(PageRef.class::cast) - .filter(p -> p.getParent().getCurrentSelection() != p) - .forEach(p -> p.getParent().setCurrentSelection(p)); - } - - // The basic toggle - sashModel.setRestoreActivePage(!oldValue); - } - }; - } - - return result; - } - - // - // Nested types - // - - private static abstract class AbstractToggleCommand extends AbstractCommand { - - AbstractToggleCommand(String label) { - super(label); - } - - @Override - protected boolean prepare() { - // Nothing to prepare - return true; - } - - @Override - public void undo() { - // It's a toggle, so yeah, just execute again - execute(); - } - - @Override - public void redo() { - execute(); - } - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java index 6a01b5ef27b..1b8bffb9923 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2011, 2015 LIFL, CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2011, 2016 LIFL, 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 @@ -10,6 +10,7 @@ * LIFL - Initial API and implementation * Christian W. Damus - bug 434983 * Christian W. Damus - bug 469188 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.core.resource.sasheditor; @@ -23,7 +24,7 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.core.utils.ServiceUtils; /** * Set of utility methods linked to Trace for ControlMode @@ -49,7 +50,7 @@ public class SashModelUtils { public static SashModel getSashModel() { try { - return (SashModel) ServiceUtilsForActionHandlers.getInstance().getModelSet().getModel(SashModel.MODEL_ID); + return (SashModel) ServiceUtils.getInstance().getModelSet(null).getModel(SashModel.MODEL_ID); } catch (ServiceException e) { return null; } @@ -72,7 +73,7 @@ public class SashModelUtils { @Deprecated public static SashModel getSashModelChecked() throws ServiceException { - return (SashModel) ServiceUtilsForActionHandlers.getInstance().getModelSet().getModel(SashModel.MODEL_ID); + return (SashModel) ServiceUtils.getInstance().getModelSet(null).getModel(SashModel.MODEL_ID); } /** diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleEventListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleEventListener.java deleted file mode 100644 index 4615f48e9d9..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleEventListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Christian W. Damus - bug 469188 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.services; - -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; - -/** - * Listens to the Lifecycle of an {@link IMultiDiagramEditor} - * - * @author Camille Letavernier - * - */ -public interface EditorLifecycleEventListener { - - /** - * The ServicesRegistry is successfully started - * - * @param editor - */ - public void postInit(IMultiDiagramEditor editor); - - /** - * All the editors are constructed, but not yet displayed - * - * @param editor - */ - public default void preDisplay(IMultiDiagramEditor editor) { - // Pass - } - - /** - * All the editors are displayed - * - * @param editor - */ - public void postDisplay(IMultiDiagramEditor editor); - - /** - * The editor is about to be closed - * - * @param editor - */ - public void beforeClose(IMultiDiagramEditor editor); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleManager.java deleted file mode 100644 index dcf449c8f51..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/EditorLifecycleManager.java +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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.services; - -/** - * The LifecycleManager for IMultiDiagramEditor - * - * It notifies its listeners when the state of the editor changes - * - * @author Camille Letavernier - * - */ -public interface EditorLifecycleManager extends IService { - - public void addEditorLifecycleEventsListener(EditorLifecycleEventListener listener); - - public void removeEditorLifecycleEventsListener(EditorLifecycleEventListener listener); - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/Messages.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/Messages.java deleted file mode 100644 index eb79ec467f9..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/Messages.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.services; - -import org.eclipse.osgi.util.NLS; - -/** - * Translatable strings. - */ -class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.core.services.messages"; //$NON-NLS-1$ - public static String SaveLayoutBeforeClose_0; - public static String SaveLayoutBeforeClose_1; - public static String SaveLayoutBeforeClose_2; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/ResourceUpdateService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/ResourceUpdateService.java deleted file mode 100644 index eeaadecc2e9..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/ResourceUpdateService.java +++ /dev/null @@ -1,289 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2014 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation - * Christian W. Damus (CEA) - bug 437217 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.services; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.ConcurrentMap; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor.DirtyPolicy; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.progress.IWorkbenchSiteProgressService; -import org.eclipse.ui.progress.UIJob; - -import com.google.common.collect.Maps; - -/** - * A Service to check workspace modifications on current resources - * - * @author Camille Letavernier - * - */ -public class ResourceUpdateService implements IService, IPartListener { - - protected ServicesRegistry registry; - - protected ModelSet modelSet; - - static int[] handledTypes = new int[] { IResourceChangeEvent.POST_CHANGE, IResourceChangeEvent.PRE_DELETE, IResourceChangeEvent.PRE_CLOSE }; - - protected boolean isSaving; - - protected ConcurrentMap pendingEditorCloseJobs = Maps.newConcurrentMap(); - - private final ISaveEventListener preSaveListener = new ISaveEventListener() { - - @Override - public void doSaveAs(DoSaveEvent event) { - isSaving = true; - } - - @Override - public void doSave(DoSaveEvent event) { - isSaving = true; - } - }; - - private final ISaveEventListener postSaveListener = new ISaveEventListener() { - - @Override - public void doSaveAs(DoSaveEvent event) { - isSaving = false; - } - - @Override - public void doSave(DoSaveEvent event) { - isSaving = false; - } - }; - - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - this.registry = servicesRegistry; - } - - @Override - public void startService() throws ServiceException { - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - modelSet = registry.getService(ModelSet.class); - registry.getService(ILifeCycleEventsProvider.class).addAboutToDoSaveListener(preSaveListener); - registry.getService(ILifeCycleEventsProvider.class).addPostDoSaveListener(postSaveListener); - } - - @Override - public void disposeService() throws ServiceException { - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - modelSet = null; - } - - protected void closeEditor() { - closeEditor(Collections. emptyList(), false); - } - - protected void closeEditor(final Collection triggeringResources, final boolean reopen) { - try { - if (!reopen) { - registry.remove(SaveLayoutBeforeClose.class.getName()); - } - - final IMultiDiagramEditor editor = registry.getService(IMultiDiagramEditor.class); - if (editor != null) { - final IWorkbenchPartSite site = editor.getSite(); - UIJob closeEditorJob = new UIJob(site.getShell().getDisplay(), NLS.bind("Reload editor {0}", editor.getTitle())) { - - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - // Remove the pending job - pendingEditorCloseJobs.remove(editor); - - IStatus result = Status.OK_STATUS; - monitor = SubMonitor.convert(monitor, IProgressMonitor.UNKNOWN); - - try { - IReloadableEditor.ReloadReason reason = reopen ? IReloadableEditor.ReloadReason.RESOURCES_CHANGED : IReloadableEditor.ReloadReason.RESOURCES_DELETED; - - DirtyPolicy dirtyPolicy = DirtyPolicy.getDefault(); - if (!reopen && !editor.isDirty()) { - // Check whether we're deleting one of our own resources. If so, just close - URI principalURI = modelSet.getURIWithoutExtension(); - for (Resource next : triggeringResources) { - if (next.getURI().trimFileExtension().equals(principalURI)) { - dirtyPolicy = DirtyPolicy.DO_NOT_SAVE; - break; - } - } - } - - try { - IReloadableEditor.Adapter.getAdapter(editor).reloadEditor(triggeringResources, reason, dirtyPolicy); - } catch (CoreException e) { - result = e.getStatus(); - } - } finally { - monitor.done(); - } - - return result; - } - }; - - // We are notified usually of at least three resources (*.di, *.notation, *.uml) that are unloaded, but - // there's no need to close and re-open the same editor three times - if (pendingEditorCloseJobs.putIfAbsent(editor, closeEditorJob) == null) { - // Async execution to avoid lock conflicts on the Workspace (Probably owned by this thread, and not the UI thread) - IWorkbenchSiteProgressService progressService = (IWorkbenchSiteProgressService) site.getService(IWorkbenchSiteProgressService.class); - progressService.schedule(closeEditorJob); - } - } - } catch (ServiceException ex) { - // Nothing - } - } - - protected void handleResourcesRemoved(Collection emfResources) { - closeEditor(emfResources, false); - } - - protected void handleResourceChanged(Collection emfResources) { - closeEditor(emfResources, true); - } - - // Copied from org.eclipse.emf.ecore.presentation.EcoreEditor - protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { - - @Override - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - - protected Collection changedResources = new ArrayList(); - - protected Collection removedResources = new ArrayList(); - - @Override - public boolean visit(final IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED) { - URI resourceURI = URI.createPlatformResourceURI(delta.getFullPath().toString(), true); - Resource resource = modelSet.getResource(resourceURI, false); - if (resource == null) { - // try again, with a pluginURI, see bug 418428 - URI pluginURI = URI.createPlatformPluginURI(delta.getFullPath().toString(), true); - resource = modelSet.getResource(pluginURI, false); - } - if (resource != null) { - - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } else { - if ((delta.getFlags() & IResourceDelta.MARKERS) != 0) { - // Skip markers - // DiagnosticDecorator.DiagnosticAdapter.update(resource, markerHelper.getMarkerDiagnostics(resource, (IFile)delta.getResource())); - } - if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { - // if(!savedResources.remove(resource)) { - // changedResources.add(resource); - // } - if (!isSaving) { - changedResources.add(resource); - } - } - } - } - } - return false; - } - - return true; - } - - public Collection getChangedResources() { - return changedResources; - } - - public Collection getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - handleResourcesRemoved(visitor.getRemovedResources()); - } - - if (!visitor.getChangedResources().isEmpty()) { - handleResourceChanged(visitor.getChangedResources()); - } - } catch (CoreException exception) { - Activator.log.error(exception); - } - } - }; - - @Override - public void partActivated(IWorkbenchPart part) { - // Nothing - } - - @Override - public void partBroughtToTop(IWorkbenchPart part) { - // Nothing - } - - @Override - public void partClosed(IWorkbenchPart part) { - // Nothing - } - - @Override - public void partDeactivated(IWorkbenchPart part) { - // Nothing - } - - @Override - public void partOpened(IWorkbenchPart part) { - // Nothing - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/SaveLayoutBeforeClose.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/SaveLayoutBeforeClose.java deleted file mode 100644 index 4ac4f1c4437..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/SaveLayoutBeforeClose.java +++ /dev/null @@ -1,215 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Christian W. Damus - bug 434983 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.services; - -import java.io.IOException; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.internal.commands.TogglePageLayoutStorageHandler; -import org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences; -import org.eclipse.papyrus.infra.core.internal.preferences.YesNo; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; - -/** - * This service automatically saves the current SashModel before closing the Papyrus editor - * - * This is useful, as modifications to the SashModel do not dirty the editor - * - * The save action is not executed if the editor is dirty when it is closed (To ensure model consistency) - * - * Bug 430976: [SashEditor] Editor layout is not exactly the same when reopening the model - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430976 - * - * @author Camille Letavernier - */ -public class SaveLayoutBeforeClose implements IService { - - private ServicesRegistry registry; - - private EditorLifecycleManager lifecycleManager; - - private EditorLifecycleEventListener lifecycleListener; - - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - this.registry = servicesRegistry; - } - - @Override - public void startService() throws ServiceException { - installSaveOnClose(); - } - - protected void installSaveOnClose() { - try { - lifecycleManager = registry.getService(EditorLifecycleManager.class); - if (lifecycleManager == null) { - return; - } - } catch (ServiceException ex) { - return; - } - - lifecycleListener = new EditorLifecycleEventListener() { - - @Override - public void postInit(IMultiDiagramEditor editor) { - // Nothing - } - - @Override - public void postDisplay(IMultiDiagramEditor editor) { - checkSharedLayout(editor); - } - - @Override - public void beforeClose(IMultiDiagramEditor editor) { - saveBeforeClose(editor); - } - }; - - lifecycleManager.addEditorLifecycleEventsListener(lifecycleListener); - } - - public void saveBeforeClose(IMultiDiagramEditor editor) { - if (editor.isDirty()) { - return; // User explicitly quit without saving. Do nothing (And if user wants to save during exit, the sashmodel will be saved anyway) - } - - ModelSet modelSet; // Required - LifeCycleEventsProvider internalLifecycleEventsProvider = null; // Optional - - try { - modelSet = registry.getService(ModelSet.class); - } catch (ServiceException ex) { - return; - } - - try { - ILifeCycleEventsProvider eventsProvider = registry.getService(ILifeCycleEventsProvider.class); - if (eventsProvider instanceof LifeCycleEventsProvider) { - internalLifecycleEventsProvider = (LifeCycleEventsProvider) eventsProvider; - } - } catch (ServiceException ex) { - // Ignore: the service is optional - } - - SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); - - try { - // We need to send pre- and post-save events, but we can only do that with the internal LifecycleEventsProvider - // The ISaveAndDirtyService can only save the whole model, but we just want to save the sash - DoSaveEvent event = new DoSaveEvent(registry, editor, true); - if (internalLifecycleEventsProvider != null) { - internalLifecycleEventsProvider.fireAboutToDoSaveEvent(event); - internalLifecycleEventsProvider.fireDoSaveEvent(event); - } - sashModel.saveModel(); - if (internalLifecycleEventsProvider != null) { - internalLifecycleEventsProvider.firePostDoSaveEvent(event); - } - } catch (IOException ex) { - Activator.log.error(ex); - } - } - - private void checkSharedLayout(IMultiDiagramEditor editor) { - try { - ModelSet modelSet = registry.getService(ModelSet.class); - SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); - - if (sashModel.isLegacyMode()) { - // Have we ever created the private sash model file? - URI privateURI = sashModel.getPrivateResourceURI(); - if (!modelSet.getURIConverter().exists(privateURI, null)) { - // Prompt the user - promptToEnablePrivateStorage(editor); - } - } - } catch (ServiceException ex) { - // Shared layout doesn't matter if there's no model-set - } - } - - private void promptToEnablePrivateStorage(IMultiDiagramEditor editor) { - YesNo preference = EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); - - if (preference == YesNo.PROMPT) { - MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoCancelQuestion(editor.getSite().getShell(), - Messages.SaveLayoutBeforeClose_0, - Messages.SaveLayoutBeforeClose_1, - Messages.SaveLayoutBeforeClose_2, false, null, null); - - switch (dlg.getReturnCode()) { - case IDialogConstants.YES_ID: - preference = YesNo.YES; - break; - case IDialogConstants.NO_ID: - preference = YesNo.NO; - break; - default: - // User cancelled - preference = YesNo.PROMPT; - break; - } - - if (dlg.getToggleState()) { - EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(preference); - } - } - - switch (preference) { - case YES: - // Change the storage to private - new TogglePageLayoutStorageHandler().togglePrivatePageLayout(editor); - - // And save the new layout scheme - saveBeforeClose(editor); - break; - case NO: - // Just create the empty resource and save it - try { - ModelSet modelSet = editor.getServicesRegistry().getService(ModelSet.class); - SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); - modelSet.createResource(sashModel.getPrivateResourceURI()); - saveBeforeClose(editor); - } catch (ServiceException e) { - // Without a model-set, much else is going wrong, so there's no need to deal - // with this here - } - break; - default: - // User cancelled - break; - } - } - - @Override - public void disposeService() throws ServiceException { - registry = null; - if (lifecycleManager != null) { - lifecycleManager.removeEditorLifecycleEventsListener(lifecycleListener); - lifecycleListener = null; - lifecycleManager = null; - } - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/EditorLifecycleManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/EditorLifecycleManagerImpl.java deleted file mode 100644 index 3c37096f881..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/EditorLifecycleManagerImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Christian W. Damus - bug 469188 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.services.internal; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleEventListener; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleManager; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; - - -public class EditorLifecycleManagerImpl implements EditorLifecycleManager, InternalEditorLifecycleManager { - - private final Set listeners = new HashSet(); - - @Override - public void init(ServicesRegistry servicesRegistry) throws ServiceException { - // Nothing - } - - @Override - public void startService() throws ServiceException { - // Nothing - } - - @Override - public void disposeService() throws ServiceException { - listeners.clear(); - } - - @Override - public void addEditorLifecycleEventsListener(EditorLifecycleEventListener listener) { - listeners.add(listener); - } - - @Override - public void removeEditorLifecycleEventsListener(EditorLifecycleEventListener listener) { - listeners.remove(listener); - } - - @Override - public void firePostInit(final IMultiDiagramEditor editor) { - for (final EditorLifecycleEventListener listener : listeners) { - SafeRunner.run(new ISafeRunnable() { - - @Override - public void run() throws Exception { - listener.postInit(editor); - } - - @Override - public void handleException(Throwable exception) { - // Already logged by the SafeRunner - } - }); - } - } - - @Override - public void firePreDisplay(final IMultiDiagramEditor editor) { - for (final EditorLifecycleEventListener listener : listeners) { - SafeRunner.run(new ISafeRunnable() { - - @Override - public void run() throws Exception { - listener.preDisplay(editor); - } - - @Override - public void handleException(Throwable exception) { - // Already logged by the SafeRunner - } - }); - } - } - - @Override - public void firePostDisplay(final IMultiDiagramEditor editor) { - for (final EditorLifecycleEventListener listener : listeners) { - SafeRunner.run(new ISafeRunnable() { - - @Override - public void run() throws Exception { - listener.postDisplay(editor); - } - - @Override - public void handleException(Throwable exception) { - // Already logged by the SafeRunner - } - }); - } - } - - @Override - public void fireBeforeClose(final IMultiDiagramEditor editor) { - for (final EditorLifecycleEventListener listener : listeners) { - SafeRunner.run(new ISafeRunnable() { - - @Override - public void run() throws Exception { - listener.beforeClose(editor); - } - - @Override - public void handleException(Throwable exception) { - // Already logged by the SafeRunner - } - }); - } - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/InternalEditorLifecycleManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/InternalEditorLifecycleManager.java deleted file mode 100644 index eab2e1272ea..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/InternalEditorLifecycleManager.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Christian W. Damus - bug 469188 - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.services.internal; - -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.services.IService; - - -public interface InternalEditorLifecycleManager extends IService { - - /** - * Sends the postInit notification for this editor - * - * @param editor - */ - void firePostInit(IMultiDiagramEditor editor); - - /** - * Sets the preDisplay notification for this editor - * - * @param editor - */ - void firePreDisplay(IMultiDiagramEditor editor); - - /** - * Sends the postDisplay notification for this editor - * - * @param editor - */ - void firePostDisplay(IMultiDiagramEditor editor); - - /** - * Sends the beforeClose notification for this Editor - * - * @param editor - */ - void fireBeforeClose(IMultiDiagramEditor editor); -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/messages.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/messages.properties deleted file mode 100644 index a6f77150932..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/messages.properties +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2015 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 -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Christian W. Damus - Initial API and implementation -# - -SaveLayoutBeforeClose_0=Editor Layout Storage -SaveLayoutBeforeClose_1=This model stores the editor page layout in the DI resource, which if managed in a source control system will share the layout with others. Convert to local (private) storage of the page layout? -SaveLayoutBeforeClose_2=Remember my decision diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/spi/IContextualServiceRegistryTracker.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/spi/IContextualServiceRegistryTracker.java new file mode 100644 index 00000000000..1150740f204 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/spi/IContextualServiceRegistryTracker.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.services.spi; + +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; + +/** + * Protocol for a service that can provide the {@link ServicesRegistry} + * that is associated with the user's current editing context, if any. + * When the user is not editing any Papyrus model, then presumably there + * is no need for any service registry. + */ +@FunctionalInterface +public interface IContextualServiceRegistryTracker { + /** + * Obtains the contextual service registry, if any. + * + * @return the contextual service registry, or {@code null} if none + */ + ServicesRegistry getServiceRegistry(); +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java index 2ce85f89fc6..d52f56b2859 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2015 LIFL & CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 2016 LIFL, CEA LIST, Christian W. Damus, and others. * * * All rights reserved. This program and the accompanying materials @@ -10,20 +10,19 @@ * Contributors: * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation * Christian W. Damus - bug 468030 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.core.utils; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.papyrus.infra.core.Activator; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.ui.IEditorPart; +import org.eclipse.papyrus.infra.core.services.spi.IContextualServiceRegistryTracker; /** * Set of utility methods for accessing core Services. This class provide @@ -50,30 +49,26 @@ public abstract class AbstractServiceUtils { abstract public ServicesRegistry getServiceRegistry(T from) throws ServiceException; /** - * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. + * Obtains the service registry determined automatically from the context of which + * Papyrus editor or view is active (implying the model that the user is currently editing). + * + * @return the contextual service registry, or {@code null} if none can be determined */ - public TransactionalEditingDomain getTransactionalEditingDomain(T from) throws ServiceException { - return getServiceRegistry(from).getService(TransactionalEditingDomain.class); + protected ServicesRegistry getContextualServiceRegistry() { + IContextualServiceRegistryTracker tracker = Activator.getDefault().getContextualServiceRegistryTracker(); + return (tracker == null) ? null : tracker.getServiceRegistry(); } /** - * Gets the {@link IPageMngr} registered in the {@link ServicesRegistry}. + * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. * * @param from * @return * @throws ServiceException * If an error occurs while getting the requested service. - * - * @deprecated Use {@link #getIPageManager(Object)} instead */ - @Deprecated - public IPageMngr getIPageMngr(T from) throws ServiceException { - return getServiceRegistry(from).getService(IPageMngr.class); + public TransactionalEditingDomain getTransactionalEditingDomain(T from) throws ServiceException { + return getServiceRegistry(from).getService(TransactionalEditingDomain.class); } /** @@ -100,42 +95,6 @@ public abstract class AbstractServiceUtils { return getServiceRegistry(from).getService(ModelSet.class); } - /** - * Gets the {@link ILifeCycleEventsProvider} registered in the {@link ServicesRegistry}. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public ILifeCycleEventsProvider getILifeCycleEventsProvider(T from) throws ServiceException { - return getServiceRegistry(from).getService(ILifeCycleEventsProvider.class); - } - - /** - * Gets the {@link ISashWindowsContainer} registered in the {@link ServicesRegistry}. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public ISashWindowsContainer getISashWindowsContainer(T from) throws ServiceException { - return getServiceRegistry(from).getService(ISashWindowsContainer.class); - } - - /** - * Gets the {@link IEditorPart} of the currently nested active editor. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public IEditorPart getNestedActiveIEditorPart(T from) throws ServiceException { - return getISashWindowsContainer(from).getActiveEditor(); - } - /** * Returns an implementation of the requested service, from the specified context * 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 deleted file mode 100644 index 0beb30b5507..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.utils; - -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 { - - /** - * Gets the shared label provider. - * - * @return Get the current {@link ILabelProvider} or null if - * not found - */ - public static ILabelProvider getLabelProvider() { - try { - ServicesRegistry registry = EditorUtils.getServiceRegistry(); - return registry == null ? null : registry.getService(ILabelProvider.class); - } catch (IllegalStateException e) { - // Registry can't be found, do nothing. - Activator.log.error(e); - } catch (ServiceException 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 deleted file mode 100644 index 6ec71fd83c0..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java +++ /dev/null @@ -1,721 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, 2013 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * Thomas Szadel: Code simplification and NPE - * management. - * Christian W. Damus (CEA LIST) - API for determining URI of a resource in an editor - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.utils; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -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; -import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; -import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -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.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IURIEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -/** - * Set of utility methods for the CoreEditor.
- * WARNING : Some of these methods rely on - * PlatformUI.getWorkbench().getActiveWorkbenchWindow()getActivePage() to lookup - * for shared objects owned by the main editor. This doesn't work during the - * initialization of the main editor because the main editor is not yet - * registered in the Eclipse workbench. This can lead to a null or an exception, - * and sometime this can lead to getting the shared object of another main - * editor ! - * - * @author cedric dumoulin - * @author Thomas Szadel - */ -// FIXME throws Exception (eg: NotFoundException) instead of null -public class EditorUtils { - - /** - * Gets the opened multi-diagram editors. - * - * @return The opened {@link IMultiDiagramEditor} or null if an error - * occured. - */ - public static IMultiDiagramEditor[] getMultiDiagramEditors() { - // Lookup ServiceRegistry - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (workbenchWindow == null) { - return null; - } - IWorkbenchPage page = workbenchWindow.getActivePage(); - if (page == null) { - return null; - } - List list = new ArrayList(); - for (IEditorReference editorRef : page.getEditorReferences()) { - IEditorPart editorPart = editorRef.getEditor(false); - if (editorPart instanceof IMultiDiagramEditor) { - list.add((IMultiDiagramEditor) editorPart); - } - } - return list.toArray(new IMultiDiagramEditor[list.size()]); - } - - /** - * Returns the editors that are related to to given file.
- * - * @param file - * The file (model, di or notation). - * @return The associated editors. - */ - public static IMultiDiagramEditor[] getRelatedEditors(IFile file) { - // Get the DI file - IFile diFile = DiModelUtils.getRelatedDiFile(file); - if (diFile == null || !diFile.exists()) { - return new IMultiDiagramEditor[0]; - } - - IMultiDiagramEditor[] openedEditors = EditorUtils.getMultiDiagramEditors(); - if (openedEditors == null) { - return new IMultiDiagramEditor[0]; - } - List list = new ArrayList(openedEditors.length); - - for (IMultiDiagramEditor editorPart : openedEditors) { - if (editorPart.getEditorInput() instanceof IFileEditorInput && diFile.equals(((IFileEditorInput) editorPart.getEditorInput()).getFile())) { - list.add(editorPart); - } - } - return list.toArray(new IMultiDiagramEditor[list.size()]); - } - - /** - * 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 IPageManager getIPageMngr(Resource diResource) { - return DiSashModelMngr.createIPageMngr(diResource); - } - - - // ////////////////////////////////////////// - // 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 - // ////////////////////////////////////////// - - /** - * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active - * editor, if possible, or null if not possible.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if there is no active editor, or if the editor is - * not instance of IMultiDiagramEditor.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * 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; - } - } - - /** - * Lookup the currently active Diagram from the Papyrus editor. Return the - * current Diagram or null if none is active.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if the ServicesRegistry can not be found.
- * TODO This method introduce dependency on GMF. It can be moved to a GMF - * plugin. - * - * @return The active diagram or null if not found. - * - * @deprecated The core do make suppositions about the type of nested - * 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(); - // } - - /** - * Lookup the currently active Diagram from the Papyrus editor. Return the - * current Diagram or null if none is active.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if the ServicesRegistry can not be found.
- * TODO This method introduce dependency on GMF. It can be moved to a GMF - * plugin. - * - * @return the active diagram editor or null if not found. - * - * @deprecated The core do make suppositions about the type of nested - * 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(); - // // Check if it is a GMF DiagramEditor - // if(activeEditor instanceof DiagramEditor) { - // return ((DiagramEditor)activeEditor); - // } else { - // // Not found - // return null; - // } - // - // } - - /** - * Lookup the currently active {@link IEditorPart} from the Papyrus editor. - * Return the current nested editor part, or null if it can not be found.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if the ServicesRegistry can not be found.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * In any case, a check should be done on the returned value that can be - * null. An alternative is to use - * serviceRegistry.getService(ISashWindowsContainer - * .class).getActiveEditor();
- * It is preferable to retrieve the ServiceRegistry from elsewhere whenever - * it is possible.
- * - * - * @return - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - public static IEditorPart lookupActiveNestedIEditor() { - // Get the sashwindow container - ISashWindowsContainer container = getSashWindowContainer(); - // Get the active page within the sashcontainer - return container == null ? null : container.getActiveEditor(); - } - - /** - * Lookup the currently active IEditor in the SashSystem. If the currently - * eclipse active editor doesn't contains a {@link ISashWindowsContainer}, - * return null. If the current SashSystem page is not a IEditor, return - * null.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if the ServicesRegistry can not be found.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * In any case, a check should be done on the returned value that can be - * null. An alternative is to use - * serviceRegistry.getService(ISashWindowsContainer - * .class).getActiveSashWindowsPage();
- * It is preferable to retrieve the ServiceRegistry from elsewhere whenever - * it is possible. - * - * @return - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - public static IPage lookupActiveNestedPage() { - - // Get the sashwindow container - ISashWindowsContainer container = getSashWindowContainer(); - // Get the active page within the sashcontainer - return container == null ? null : container.getActiveSashWindowsPage(); - } - - /** - * - * @return - */ - private static ISashWindowsContainer getSashWindowContainer() { - - try { - return getServiceRegistryChecked().getService(ISashWindowsContainer.class); - } catch (ServiceException e) { - // The contract says that we return null if not found - return null; - } - } - - /** - * Gets the di resource set. - * - * @return Get the current {@link DiResourceSet} or null if not found. - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - public static DiResourceSet getDiResourceSet() { - try { - ServicesRegistry registry = getServiceRegistry(); - return registry == null ? null : registry.getService(DiResourceSet.class); - } catch (ServiceException e) { - Activator.log.error(e); - } - return null; - } - - /** - * Gets the {@link TransactionalEditingDomain} of the current active Eclipse - * Editor. This method should be used only when it is sure that the active - * editor exist, and that you want the EditingDomain of this editor.
- * This method return null if the TransactionalEditingDomain can not be - * found.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * In any case, a check should be done on the returned value that can be - * null. An alternative is to use {@link #getTransactionalEditingDomainChecked()} and to catch the - * exception.
- * It is preferable to use {@link #getTransactionalEditingDomain(ServicesRegistry)} whenever it is - * possible.
- * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved - * with methods from - * org.eclipse.papyrus.uml.diagram.common.util.DiagramCoreServiceUtils
- * 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 Get the current {@link TransactionalEditingDomain} or null if not - * found - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - public static TransactionalEditingDomain getTransactionalEditingDomain() { - try { - ServicesRegistry registry = getServiceRegistry(); - return registry == null ? null : registry.getService(TransactionalEditingDomain.class); - } catch (IllegalStateException e) { - // Registry can't be found, do nothing. - } catch (ServiceException e) { - Activator.log.error(e); - } - return null; - } - - /** - * Gets the {@link TransactionalEditingDomain} of the current active Eclipse - * Editor. This method should be used only when it is sure that the active - * editor exist, and that you want the EditingDomain of this editor.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * It is preferable to use {@link #getTransactionalEditingDomain(ServicesRegistry)} whenever it is - * possible.
- * This method throw a {@link ServiceException} if the - * TransactionalEditingDomain can not be found.
- * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved - * with methods from - * org.eclipse.papyrus.uml.diagram.common.util.DiagramCoreServiceUtils - * - * - * WARNING: This method throws an exception when no Active Editor is found. - * This happen during the editor initialization, especially when there is no - * other editor opened. - * - * @return Get the current {@link TransactionalEditingDomain} - * @throws ServiceException - * @throws ServiceNotFoundException - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - public static TransactionalEditingDomain getTransactionalEditingDomainChecked() throws ServiceException { - try { - ServicesRegistry registry = getServiceRegistryChecked(); - return registry.getService(TransactionalEditingDomain.class); - } catch (IllegalStateException e) { - throw new ServiceException(e); - } catch (Exception e) { - throw new ServiceException(e); - } - } - - /** - * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. - * - * @param servicesRegistry - * @return - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
- */ - @Deprecated - public static TransactionalEditingDomain getTransactionalEditingDomain(ServicesRegistry registry) { - try { - return registry.getService(TransactionalEditingDomain.class); - } catch (IllegalStateException e) { - // Registry can't be found, do nothing. - } catch (ServiceException e) { - Activator.log.error(e); - } - return null; - } - - /** - * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. - * - * @param servicesRegistry - * @return - * @throws ServiceException - * If the TransactionalEditingDomain can not be found. - * @deprecated Check - * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments - * /cookbook/PapyrusCookBook.odt and use one of the replacement: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
- */ - @Deprecated - public static TransactionalEditingDomain getTransactionalEditingDomainChecked(ServicesRegistry registry) throws ServiceException { - return registry.getService(TransactionalEditingDomain.class); - } - - /** - * Get the {@link ServicesRegistry}of the currently active eclipse editor.
- * WARNING - This method doesn't work during the initialization of the main - * editor. See note in class doc.
- * This method return null if the ServicesRegistry can not be found.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * 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.
- * It is preferable to retrieve the ServiceRegistry from elsewhere whenever - * it is possible.
- * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved - * with methods from - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF - * - *
- * 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: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @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.
- * 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: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @Deprecated - static public ServicesRegistry getServiceRegistryChecked() throws ServiceException { - // Lookup ServiceRegistry - IMultiDiagramEditor editor = getMultiDiagramEditor(); - if (editor == null) { - throw new ServiceException("Can't get ServiceRegistry"); //$NON-NLS-1$ - } - - return (ServicesRegistry) editor.getAdapter(ServicesRegistry.class); - } - - /** - * Get the ISashWindowsContentProvider of the active Eclipse Editor, if - * possible.
- * This method return null if the ServiceRegistry can not be found or if an - * error occur.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * 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: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @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.
- * This method return null if the ServiceRegistry can not be found or if an - * error occur.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * This method should not be used during the editor initialization phase.
- * 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: - *
    - *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • - *
  • - * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • - *
  • - * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • - *
- */ - @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.
- * 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.
- * This method is designed to be used by ui actions that interact with the - * active editor.
- * - * - * @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."); //$NON-NLS-1$ - } - - 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() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Obtains the URI of the EMF resource identified by the given editor reference. - * - * @param editorRef - * an editor reference - * - * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined, - * including the case when the editor input could not be obtained from the reference - */ - public static URI getResourceURI(IEditorReference editorRef) { - try { - return getResourceURI(editorRef.getEditorInput()); - } catch (PartInitException e) { - Activator.log.error("Could not obtain editor input from editor reference.", e); //$NON-NLS-1$ - return null; - } - } - - /** - * Obtains the URI of the EMF resource edited by the given {@code editor}. - * - * @param editor - * an open editor - * - * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined, - * such as if the editor input could not be obtained from the editor - */ - public static URI getResourceURI(IEditorPart editor) { - return getResourceURI(editor.getEditorInput()); - } - - /** - * Obtains the URI of the EMF resource identified by the given editor input. - * - * @param editorInput - * an editor input - * - * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined - */ - public static URI getResourceURI(IEditorInput editorInput) { - URI result = null; - - if (editorInput instanceof IFileEditorInput) { - result = URI.createPlatformResourceURI(((IFileEditorInput) editorInput).getFile().getFullPath().toString(), true); - } else if (editorInput instanceof URIEditorInput) { - result = ((URIEditorInput) editorInput).getURI(); - } else if (editorInput instanceof IURIEditorInput) { - result = URI.createURI(((IURIEditorInput) editorInput).getURI().toASCIIString(), true); - } else if (editorInput != null) { - // desperation - Object adapter = editorInput.getAdapter(URI.class); - if (adapter instanceof URI) { - result = (URI) adapter; - } - } - - return result; - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/PapyrusImageUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/PapyrusImageUtils.java deleted file mode 100644 index 63dfdec757a..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/PapyrusImageUtils.java +++ /dev/null @@ -1,67 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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: - * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.utils; - -import java.io.IOException; -import java.net.URL; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.papyrus.infra.core.Activator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -/** - * Services to access to Papyrus images - * - * @author tristan faure - * - */ -public class PapyrusImageUtils { - - private static final String default_icon_32 = "/icons/papyrus/32x32/Papyrus_32x32_t.gif"; //$NON-NLS-1$ - - private static final String default_icon = "/icons/papyrus/Papyrus.gif"; //$NON-NLS-1$ - - /** - * get the default icon for Papyrus the image does not have to be disposed - * as it is registered in an ImageRegistry - * - * @return the Image - */ - public static Image getDefaultIcon() { - return getIcon(default_icon); - } - - /** - * get the default icon 32x32 for Papyrus the image does not have to be - * disposed as it is registered in an ImageRegistry - * - * @return the Image - */ - public static Image getDefaultIcon32() { - return getIcon(default_icon_32); - } - - private static Image getIcon(String path) { - String key = Activator.PLUGIN_ID + path; - Image result = JFaceResources.getImageRegistry().get(key); - if (result == null) { - URL url = Activator.getDefault().getBundle().getEntry(path); - try { - result = new Image(Display.getDefault(), url.openStream()); - JFaceResources.getImageRegistry().put(key, result); - } catch (IOException e) { - } - } - return result; - } -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtils.java index 41beab9ae57..4c6cf904a7c 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtils.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtils.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 LIFL & CEA LIST. - * + * Copyright (c) 2010, 2016 LIFL, 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 @@ -9,6 +8,7 @@ * * Contributors: * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -38,12 +38,13 @@ public class ServiceUtils extends AbstractServiceUtils { * @see org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils#getServiceRegistry(java.lang.Object) * * @param from + * the service registry, or {@code null} to try to get the contextual default service registry * @return * @throws ServiceException */ @Override public ServicesRegistry getServiceRegistry(ServicesRegistry from) throws ServiceException { - return from; + return (from != null) ? from : getContextualServiceRegistry(); } } 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 deleted file mode 100644 index a628765e8f1..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java +++ /dev/null @@ -1,162 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.utils; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr; -import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; -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.tools.util.WorkbenchPartHelper; -import org.eclipse.ui.IEditorPart; - -/** - * Set of utility methods for accessing core Services. This class provide - * methods to access the Papyrus well known services. This class is designed to - * be used from ui Action Handlers or from any code relying on the Eclipse - * Active Editor.
- * All methods from this class rely on the Eclipse Active Editor, which should - * be an instance of {@link IMultiDiagramEditor}. If this is not the case, - * methods throw an exception {@link ServiceException}. - * - * @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(); - - /** - * Get the singleton instance of the class. - * - * @return - */ - public static final ServiceUtilsForActionHandlers getInstance() { - return instance; - } - - /** - * Get the service registry from the specified parameter. - * - * @param from - * @return - */ - public ServicesRegistry getServiceRegistry() throws ServiceException { - IEditorPart editor = WorkbenchPartHelper.getCurrentActiveEditorPart(); - if (editor != null) { - ServicesRegistry serviceRegistry = (ServicesRegistry) editor.getAdapter(ServicesRegistry.class); - if (serviceRegistry != null) { - return serviceRegistry; - } - } - - // Not found - throw new ServiceNotFoundException("Can't get the ServiceRegistry from current Eclipse Active Editor"); //$NON-NLS-1$ - } - - /** - * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. - * - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public TransactionalEditingDomain getTransactionalEditingDomain() throws ServiceException { - return getServiceRegistry().getService(TransactionalEditingDomain.class); - } - - /** - * Gets the {@link IPageMngr} registered in the {@link ServicesRegistry}. - * - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - * - * @deprecated Use {@link #getIPageManager} instead - */ - @Deprecated - public IPageMngr getIPageMngr() throws ServiceException { - return getServiceRegistry().getService(IPageMngr.class); - } - - /** - * Gets the {@link IPageManager} registered in the {@link ServicesRegistry}. - * - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public IPageManager getIPageManager() throws ServiceException { - return getServiceRegistry().getService(IPageManager.class); - } - - /** - * Gets the {@link IPageMngr} registered in the {@link ServicesRegistry}. - * - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public ModelSet getModelSet() throws ServiceException { - return getServiceRegistry().getService(ModelSet.class); - } - - /** - * Gets the {@link ILifeCycleEventsProvider} registered in the {@link ServicesRegistry}. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public ILifeCycleEventsProvider getILifeCycleEventsProvider() throws ServiceException { - return getServiceRegistry().getService(ILifeCycleEventsProvider.class); - } - - /** - * Gets the {@link ISashWindowsContainer} registered in the {@link ServicesRegistry}. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public ISashWindowsContainer getISashWindowsContainer() throws ServiceException { - return getServiceRegistry().getService(ISashWindowsContainer.class); - } - - /** - * Gets the {@link IEditorPart} of the currently nested active editor. - * - * @param from - * @return - * @throws ServiceException - * If an error occurs while getting the requested service. - */ - public IEditorPart getNestedActiveIEditorPart() throws ServiceException { - return getISashWindowsContainer().getActiveEditor(); - } -} 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 deleted file mode 100644 index 1af16660ca3..00000000000 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java +++ /dev/null @@ -1,62 +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.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 { - - @Override - public ServicesRegistry getServiceRegistry(IWorkbenchPage from) throws ServiceException { - IAdaptable adaptable = null; - if (from instanceof IAdaptable) { - adaptable = (IAdaptable) from; - } else if (from != null) { - // 421392: [Model Explorer] Link with Editor does not work properly - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=421392 - - // Since Eclipse 4.4, the concrete WorkbenchPage is not IAdaptable anymore. - // Try the ActivePart - adaptable = from.getActivePart(); - } - - if (adaptable != null) { - ServicesRegistry registry = (ServicesRegistry) adaptable.getAdapter(ServicesRegistry.class); - if (registry != null) { - return registry; - } - } - - - throw new ServiceException("Cannot resolve the ServiceRegistry from the IWorkbenchPage. Page: " + from); //$NON-NLS-1$ - } - - public static ServiceUtilsForWorkbenchPage getInstance() { - return instance; - } - - private static ServiceUtilsForWorkbenchPage instance = new ServiceUtilsForWorkbenchPage(); - - private ServiceUtilsForWorkbenchPage() { - // Singleton - } - -} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java index c8fc6d5a3d4..add383bc3fe 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java @@ -8,32 +8,24 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Christian W. Damus (CEA) - bug 429826 - * Christian W. Damus (CEA) - bug 408491 - * Christian W. Damus (CEA) - bug 433320 - * Christian W. Damus - bug 451557 - * Christian W. Damus - bug 457560 - * Christian W. Damus - bug 461629 - * Christian W. Damus - bug 463564 - * Christian W. Damus - bug 466997 - * Christian W. Damus - bug 465416 + * Christian W. Damus (CEA) - bugs 429826, 408491, 433320 + * Christian W. Damus - bugs 451557, 457560, 461629, 463564, 466997, 465416, 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.core.utils; -import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.Executor; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.emf.common.util.WrappedException; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RollbackException; import org.eclipse.emf.transaction.Transaction; import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; import org.eclipse.emf.transaction.impl.TransactionImpl; -import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis; import com.google.common.collect.Maps; @@ -46,7 +38,7 @@ import com.google.common.collect.Sets; * @author Camille Letavernier * */ -public class TransactionHelper extends org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper { +public class TransactionHelper { // Refactoring needed. The sasheditor contentprovider should have dependencies to infra.EMF... @@ -62,6 +54,38 @@ public class TransactionHelper extends org.eclipse.papyrus.infra.core.sasheditor public static final String TRANSACTION_OPTION_MERGE_NESTED_READ = "papyrus.merge_nested_read"; //$NON-NLS-1$ + public static void run(EditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException { + if (domain instanceof TransactionalEditingDomain) { + run((TransactionalEditingDomain) domain, writeOperation); + } else { + writeOperation.run(); + } + } + + public static void run(TransactionalEditingDomain domain, final Runnable writeOperation) throws InterruptedException, RollbackException { + if (domain instanceof InternalTransactionalEditingDomain) { + run((InternalTransactionalEditingDomain) domain, writeOperation); + } else { + // Shouldn't happen, as all TransactionalEditingDomain implementations should also implement InternalTransactionalEditingDomain + domain.getCommandStack().execute(new RecordingCommand(domain) { + + @Override + protected void doExecute() { + writeOperation.run(); + } + }); + } + } + + public static void run(InternalTransactionalEditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException { + Transaction transaction = domain.startTransaction(false, Collections.emptyMap()); + try { + writeOperation.run(); + } finally { + transaction.commit(); + } + } + /** * Queries whether an editing {@code domain} has been disposed. * @@ -356,58 +380,6 @@ public class TransactionHelper extends org.eclipse.papyrus.infra.core.sasheditor return (value instanceof Boolean) ? (Boolean) value : false; } - /** - * Create a privileged runnable with progress, which is like a regular {@linkplain TransactionalEditingDomain#createPrivilegedRunnable(Runnable) - * privileged runnable} except that it is given a progress monitor for progress reporting. - * This enables execution of monitored runnables on the modal-context thread using the transaction borrowed from the UI thread. - * - * @param domain - * an editing domain - * @param runnable - * a runnable with progress that is to borrow the {@code domain}'s active transaction on the modal context thread - * @return the privileged runnable, ready to pass into the progress service or other such API - */ - public static IRunnableWithProgress createPrivilegedRunnableWithProgress(TransactionalEditingDomain domain, final IRunnableWithProgress runnable) { - final IProgressMonitor monitorHolder[] = { null }; - - final Runnable privileged = domain.createPrivilegedRunnable(new Runnable() { - - @Override - public void run() { - try { - runnable.run(monitorHolder[0]); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new WrappedException(e); - } - } - }); - - return new IRunnableWithProgress() { - - @Override - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitorHolder[0] = monitor; - - try { - privileged.run(); - } catch (OperationCanceledException e) { - throw new InterruptedException(e.getLocalizedMessage()); - } catch (WrappedException e) { - Exception unwrapped = e.exception(); - if (unwrapped instanceof InvocationTargetException) { - throw (InvocationTargetException) unwrapped; - } else if (unwrapped instanceof InterruptedException) { - throw (InterruptedException) unwrapped; - } else { - throw e; - } - } - } - }; - } - /** * Creates an {@link Executor} that executes {@link Runnable}s at the pre-commit phase of the active write * transaction of the specified editing {@code domain} or at some other time if no write transaction is active. diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/META-INF/MANIFEST.MF b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/META-INF/MANIFEST.MF index 9c3983ce1b8..c450e20c54b 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/META-INF/MANIFEST.MF +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/META-INF/MANIFEST.MF @@ -19,7 +19,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.views.properties;bundle-version="1.2.0", - org.eclipse.papyrus.infra.editor.welcome;bundle-version="1.2.0" + org.eclipse.papyrus.infra.editor.welcome;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/hyperlink/HyperlinkNavigationAction.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/hyperlink/HyperlinkNavigationAction.java index b5236901c8d..9866ae5632e 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/hyperlink/HyperlinkNavigationAction.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/hyperlink/HyperlinkNavigationAction.java @@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.selection.action.AbstractMouseSelectionAction; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.editor.welcome.nattable.ServiceConfigAttributes; import org.eclipse.papyrus.infra.services.navigation.service.NavigationService; import org.eclipse.swt.events.MouseEvent; diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/widgets/FormTable.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/widgets/FormTable.java index 00315ec53fb..c462564f8d8 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/widgets/FormTable.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable/src/org/eclipse/papyrus/infra/editor/welcome/nattable/widgets/FormTable.java @@ -38,8 +38,7 @@ import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum; import org.eclipse.nebula.widgets.nattable.style.Style; import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.editor.welcome.nattable.ServiceConfigAttributes; import org.eclipse.papyrus.infra.editor.welcome.nattable.painter.LabelPainter; @@ -52,6 +51,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.navigation.service.NavigationService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.views.properties.modelelement.DataSource; import org.eclipse.papyrus.views.properties.modelelement.ModelElement; import org.eclipse.swt.SWT; diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/META-INF/MANIFEST.MF b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/META-INF/MANIFEST.MF index 40b0a921a9c..d1a24cbd597 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/META-INF/MANIFEST.MF +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/META-INF/MANIFEST.MF @@ -26,7 +26,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.core.databinding;bundle-version="1.6.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.emf.transaction;bundle-version="1.9.0", - org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0" + org.eclipse.papyrus.infra.widgets;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", + org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.papyrus.infra.editor.welcome.internal.constraints" Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/plugin.xml b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/plugin.xml index c702fdd5a23..727d059d870 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/plugin.xml +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/plugin.xml @@ -24,15 +24,15 @@ serviceKeyRef="org.eclipse.papyrus.infra.core.resource.ModelSet"> + serviceKeyRef="org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager"> + serviceKeyRef="org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> Reset Welcome Page menu command. diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/SaveDefaultWelcomePageHandler.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/SaveDefaultWelcomePageHandler.java index b554132a04e..c91a303cf7c 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/SaveDefaultWelcomePageHandler.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/SaveDefaultWelcomePageHandler.java @@ -14,8 +14,8 @@ package org.eclipse.papyrus.infra.editor.welcome.internal.commands; import org.eclipse.core.runtime.CoreException; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.editor.welcome.IWelcomePageService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.ui.statushandlers.IStatusAdapterConstants; import org.eclipse.ui.statushandlers.StatusAdapter; import org.eclipse.ui.statushandlers.StatusManager; diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/ShowWelcomePageHandler.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/ShowWelcomePageHandler.java index 4e835244c9a..25a8b38c20c 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/ShowWelcomePageHandler.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/commands/ShowWelcomePageHandler.java @@ -13,10 +13,10 @@ package org.eclipse.papyrus.infra.editor.welcome.internal.commands; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.IPageUtils; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; import org.eclipse.papyrus.infra.editor.welcome.IWelcomePageService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; /** * Handler for the Show Welcome Page menu command. diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/dnd/WelcomeSectionTransfer.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/dnd/WelcomeSectionTransfer.java index c098eb742e4..71ad20bf3e0 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/dnd/WelcomeSectionTransfer.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/dnd/WelcomeSectionTransfer.java @@ -13,7 +13,7 @@ package org.eclipse.papyrus.infra.editor.welcome.internal.dnd; -import org.eclipse.papyrus.infra.tools.dnd.PapyrusTransfer; +import org.eclipse.papyrus.infra.ui.dnd.PapyrusTransfer; import org.eclipse.ui.forms.widgets.Section; /** diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/AbstractPageLayoutToggleValue.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/AbstractPageLayoutToggleValue.java index fb056e69e61..bafbdd05081 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/AbstractPageLayoutToggleValue.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/AbstractPageLayoutToggleValue.java @@ -21,18 +21,18 @@ import org.eclipse.core.databinding.observable.value.AbstractObservableValue; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashLayoutCommandFactory; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; -import org.eclipse.papyrus.infra.core.services.SaveLayoutBeforeClose; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.editor.welcome.internal.Activator; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.internal.commands.SashLayoutCommandFactory; +import org.eclipse.papyrus.infra.ui.services.SaveLayoutBeforeClose; /** * Non-transactional boolean-valued observable properties of the page layout diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/LanguagesObservableList.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/LanguagesObservableList.java index 3b051203ab3..0c897ead6f0 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/LanguagesObservableList.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/LanguagesObservableList.java @@ -17,13 +17,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.stream.Collectors; -import org.eclipse.papyrus.infra.core.Activator; import org.eclipse.papyrus.infra.core.language.ILanguage; import org.eclipse.papyrus.infra.core.language.ILanguageChangeListener; import org.eclipse.papyrus.infra.core.language.ILanguageService; import org.eclipse.papyrus.infra.core.language.LanguageChangeEvent; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.editor.welcome.internal.Activator; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.tools.databinding.WritableListWithIterator; diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/PrivateLayoutValue.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/PrivateLayoutValue.java index 87fc82a0577..d1e557dbe8e 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/PrivateLayoutValue.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/PrivateLayoutValue.java @@ -21,9 +21,9 @@ import java.beans.PropertyChangeListener; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.emf.common.command.Command; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashLayoutCommandFactory; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.ui.internal.commands.SashLayoutCommandFactory; /** * Encapsulation of the "shared layout" property of the Papyrus Editor. diff --git a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/RestoreActivePageValue.java b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/RestoreActivePageValue.java index e7b2c42ae4a..5782f65d473 100644 --- a/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/RestoreActivePageValue.java +++ b/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome/src/org/eclipse/papyrus/infra/editor/welcome/internal/modelelements/RestoreActivePageValue.java @@ -15,9 +15,9 @@ package org.eclipse.papyrus.infra.editor.welcome.internal.modelelements; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.emf.common.command.Command; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashLayoutCommandFactory; import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.ui.internal.commands.SashLayoutCommandFactory; /** * Encapsulation of the "restore active page" property of the Papyrus Editor. 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 1df66b9ee5a..e4acf402212 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,11 +5,13 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.gmf.runtime.notation;bundle-version="1.5.0", org.eclipse.emf.transaction;bundle-version="1.4.0", org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0", org.eclipse.core.commands;bundle-version="3.6.1", org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0" + org.eclipse.papyrus.infra.core.log;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/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 95553fb86f0..65cc2685b15 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 @@ -23,13 +23,13 @@ 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.Activator; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.IPluggableEditorFactory; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; 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; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory; /** * Base class for create diagram Handlers. diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF index 54b2a39e6c8..5f652aca106 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.papyrus.infra.onefile;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.papyrus.infra.tools;bundle-version="1.2.0" + org.eclipse.papyrus.infra.tools;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/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java index 34de737df89..eebb9793f98 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2011, 2015 Atos Origin, Christian W. Damus, and others. - * + * Copyright (c) 2011, 2016 Atos Origin, 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 @@ -10,6 +9,7 @@ * Contributors: * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation * Christian W. Damus - bug 463564 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.emf.readonly; @@ -19,8 +19,7 @@ import java.util.concurrent.Executor; import org.eclipse.core.runtime.Plugin; import org.eclipse.papyrus.infra.core.log.LogHelper; import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler; -import org.eclipse.papyrus.infra.tools.util.UIUtil; -import org.eclipse.swt.widgets.Display; +import org.eclipse.papyrus.infra.tools.util.CoreExecutors; import org.osgi.framework.BundleContext; /** @@ -46,11 +45,6 @@ public class Activator extends Plugin { public Activator() { } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ @Override public void start(BundleContext context) throws Exception { super.start(context); @@ -58,11 +52,6 @@ public class Activator extends Plugin { log = new LogHelper(this); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ @Override public void stop(BundleContext context) throws Exception { plugin = null; @@ -87,7 +76,7 @@ public class Activator extends Plugin { public synchronized Executor getReadOnlyCacheExecutor() { if (readOnlyCacheExecutor == null) { // The default executor is one that runs tasks on the display's event queue - readOnlyCacheExecutor = UIUtil.createUIExecutor(Display.getDefault()); + readOnlyCacheExecutor = CoreExecutors.getUIExecutorService(); } return readOnlyCacheExecutor; } diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java index 1a068ef24d5..1377317e949 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java @@ -42,11 +42,6 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener; -import org.eclipse.papyrus.infra.core.editor.reload.IReloadContextProvider; import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler; import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler; import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2; @@ -56,6 +51,11 @@ import org.eclipse.papyrus.infra.core.resource.ReadOnlyEvent; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; +import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener; +import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider; import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java index 1582a7a9a97..4f627676eff 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java @@ -23,12 +23,12 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.infra.core.editor.reload.IReloadContextProvider; import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler; import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis; import org.eclipse.papyrus.infra.emf.readonly.internal.messages.Messages; +import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider; import org.eclipse.swt.widgets.Display; import com.google.common.base.Optional; 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 6df6c79fa58..95ded3a267b 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 @@ -24,7 +24,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0", com.google.guava;bundle-version="11.0.0", org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0", - org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0" + org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml index d7c9c6fbd2a..bf405510fb0 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml @@ -1,7 +1,7 @@ @@ -65,9 +66,9 @@ - - + null if not found - */ - @Override - protected ConvertedValueContainer doDeduceValueFromString(final Object feature, final String valueAsString) { - final EClassifier featureType = getFeatureType(feature); - if (feature instanceof EStructuralFeature) { - return deduceValueFromString(feature, featureType, valueAsString); - } - return null; - } - - /** - * - * @param feature - * @param featureType - * @param valueAsString - * @return - */ - protected ConvertedValueContainer deduceValueFromString(final Object feature, final EClassifier featureType, final String valueAsString) { - ConvertedValueContainer realValue = null; - // if(feature instanceof EStructuralFeature) { - final int upperbound = getFeatureUpperBound(feature); - boolean isMany = (upperbound > 1 || upperbound == -1); - if (featureType instanceof EDataType) { - if (featureType instanceof EEnum) { - realValue = deduceEEnumLiteralValue((EEnum) featureType, isMany, valueAsString); - } - final String typeName = featureType.getName(); - if (TypesConstants.STRING.equals(typeName) || EMFContants.ESTRING.equals(typeName)) { - realValue = deduceStringValue(isMany, valueAsString); - } else if (EMFContants.EBOOLEAN.equals(typeName) || TypesConstants.BOOLEAN.equals(typeName)) { - realValue = deduceBooleanValue(isMany, valueAsString); - } else if (EMFContants.EINT.equals(typeName) || TypesConstants.INTEGER.equals(typeName)) { - realValue = deduceIntValue(isMany, valueAsString); - } else if (EMFContants.EDOUBLE.equals(typeName)) { - realValue = deduceDoubleValue(isMany, valueAsString); - } - } else if (featureType instanceof EClass) { - realValue = deduceEObjectValue(getResolutionContext(), feature, (EClass) featureType, isMany, valueAsString); - } - return realValue; - } - - protected int getFeatureUpperBound(final Object feature) { - return ((EStructuralFeature) feature).getUpperBound(); - } - - - - /** - * - * @param resolutionContext - * the context used for the resolution - * @param feature - * the feature - * @param featureType - * the type of the feature - * @param isMany - * true if the feature isMany - * @param valueAsString - * the string value to resolve - * @return - * a value container referencing the eobject represented by the string - * @throws StringValueSolverException - */ - protected ConvertedValueContainer deduceEObjectValue(EObject resolutionContext, Object feature, EClass featureType, boolean isMany, String valueAsString) { - if (valueAsString == null || valueAsString.equals("")) { - return new ConvertedValueContainer(null, Status.OK_STATUS); - } - final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_VALUE_X_CANT_BE_RESOLVED, valueAsString)); - return new ConvertedValueContainer(null, status); - } - - /** - * - * @param feature - * an object representing a feature - * @return - * the type of the feature - */ - protected EClassifier getFeatureType(final Object feature) { - final EClassifier featureType; - if (feature instanceof EStructuralFeature) { - return ((EStructuralFeature) feature).getEType(); - } else { - featureType = null; - } - return featureType; - } - - /** - * - * @param eenum - * the enumeration - * @param isMany - * true if the feature is many - * @param valueAsString - * the value to convert - * @return - * the converted value - */ - protected ConvertedValueContainer deduceEEnumLiteralValue(final EEnum eenum, final boolean isMany, final String valueAsString) { - ConvertedValueContainer returnedValue = null; - IStatus iStatus = Status.OK_STATUS; - final Collection unresolvedValues = new ArrayList(); - if (isMany) { - final Collection values = new ArrayList(); - for (final String str : valueAsString.split(this.multiValueSeparator)) { - final EEnumLiteral literal = eenum.getEEnumLiteral(str); - if (literal != null) { - values.add(literal); - } else { - unresolvedValues.add(str); - } - } - if (!unresolvedValues.isEmpty()) { - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, EMFContants.EENUM_LITERAL), unresolvedValues); - } - returnedValue = new MultiConvertedValueContainer(values, iStatus); - } else { - final EEnumLiteral literal = eenum.getEEnumLiteral(valueAsString); - if (literal != null) { - // returnedValue = new ConvertedValueContainer(literal, iStatus); - // fix a bug on enumerator - returnedValue = new ConvertedValueContainer(literal.getInstance(), iStatus); - } else { - unresolvedValues.add(valueAsString); - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, EMFContants.EENUM_LITERAL), unresolvedValues); - returnedValue = new ConvertedValueContainer(null, iStatus); - } - } - return returnedValue; - } - - /** - * - * @param isMany - * true if the feature isMany - * @param valueAsString - * the value to parse - * @return - * the result of the parsing - */ - protected ConvertedValueContainer deduceBooleanValue(final boolean isMany, final String valueAsString) { - ConvertedValueContainer returnedValue = null; - IStatus iStatus = Status.OK_STATUS; - final Collection unresolvedValues = new ArrayList(); - if (isMany) { - final Collection values = new ArrayList(); - for (final String str : valueAsString.split(this.multiValueSeparator)) { - if (BooleanHelper.isBoolean(str)) { - values.add(Boolean.valueOf(valueAsString)); - } else { - unresolvedValues.add(str); - } - } - if (!unresolvedValues.isEmpty()) { - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.BOOLEAN), unresolvedValues); - } - returnedValue = new MultiConvertedValueContainer(values, iStatus); - } else { - if (BooleanHelper.isBoolean(valueAsString)) { - returnedValue = new ConvertedValueContainer(Boolean.valueOf(valueAsString), iStatus); - } else { - unresolvedValues.add(valueAsString); - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.BOOLEAN), unresolvedValues); - returnedValue = new ConvertedValueContainer(null, iStatus); - } - } - return returnedValue; - } - - /** - * - * @param isMany - * true if the feature isMany - * @param valueAsString - * the value to parse - * @return - * the result of the parsing - */ - protected ConvertedValueContainer deduceDoubleValue(final boolean isMany, final String valueAsString) { - ConvertedValueContainer returnedValue = null; - IStatus iStatus = Status.OK_STATUS; - final Collection unresolvedValues = new ArrayList(); - if (isMany) { - final Collection values = new ArrayList(); - for (final String str : valueAsString.split(this.multiValueSeparator)) { - final Double value = Double.valueOf(str); - if (value != null) { - values.add(value); - } else { - unresolvedValues.add(str); - } - } - if (!unresolvedValues.isEmpty()) { - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.DOUBLE), unresolvedValues); - } - returnedValue = new MultiConvertedValueContainer(values, iStatus); - } else { - try { - returnedValue = new ConvertedValueContainer(Double.valueOf(valueAsString), iStatus); - } catch (final NumberFormatException e) { - unresolvedValues.add(valueAsString); - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.DOUBLE), unresolvedValues); - returnedValue = new ConvertedValueContainer(null, iStatus); - } - } - return returnedValue; - } - - /** - * - * @param isMany - * true if the feature isMany - * @param valueAsString - * the value to parse - * @return - * the result of the parsing - */ - protected ConvertedValueContainer deduceIntValue(final boolean isMany, final String valueAsString) { - ConvertedValueContainer returnedValue = null; - IStatus iStatus = Status.OK_STATUS; - final Collection unresolvedValues = new ArrayList(); - if (isMany) { - final Collection values = new ArrayList(); - for (final String str : valueAsString.split(this.multiValueSeparator)) { - try { - values.add(Integer.valueOf(str)); - } catch (final NumberFormatException e) { - unresolvedValues.add(str); - } - } - if (!unresolvedValues.isEmpty()) { - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.INTEGER), unresolvedValues); - } - returnedValue = new MultiConvertedValueContainer(values, iStatus); - } else { - try { - returnedValue = new ConvertedValueContainer(Integer.valueOf(valueAsString), iStatus); - } catch (final NumberFormatException e) { - unresolvedValues.add(valueAsString); - iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.INTEGER), unresolvedValues); - returnedValue = new ConvertedValueContainer(null, iStatus); - } - } - return returnedValue; - } - - - /** - * - * @param isMany - * true if the feature is many - * @param valueAsString - * the value as string - * @return - * the value container with the real value(s) - */ - protected ConvertedValueContainer deduceStringValue(final boolean isMany, final String valueAsString) { - ConvertedValueContainer returnedValue = null; - final IStatus iStatus = Status.OK_STATUS; - if (isMany) { - final Collection values = new ArrayList(); - for (final String str : valueAsString.split(this.multiValueSeparator)) { - values.add(str); - } - returnedValue = new MultiConvertedValueContainer(values, iStatus); - } else { - returnedValue = new ConvertedValueContainer(valueAsString, iStatus); - } - return returnedValue; - } - -} 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 index b3068b03106..6c853bfe9f2 100644 --- 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 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012 CEA LIST. + * Copyright (c) 2012, 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,16 +8,20 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.infra.emf.utils; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.expressions.IEvaluationContext; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; 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.IEditorPart; import org.eclipse.ui.ISources; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartSite; @@ -38,6 +42,18 @@ public class ServiceUtilsForHandlers extends AbstractServiceUtils collec = (Collection) Platform.getAdapterManager().getAdapter(selectedObj, Collection.class); + Collection collec = Platform.getAdapterManager().getAdapter(selectedObj, Collection.class); if (collec != null) { for (Object o : collec) { if (o instanceof IFile) { @@ -123,7 +124,7 @@ public class SelectionHelper { IPageManager pageManager = null; try { - pageManager = ServiceUtilsForSelection.getInstance().getIPageManager(receiver); + pageManager = ServiceUtilsForSelection.getInstance().getService(IPageManager.class, receiver); } catch (ServiceException e) { // Ignore service exception } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.classpath b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.project b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.project new file mode 100644 index 00000000000..41ce0a64ca8 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.infra.gmfdiag.gef + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..e556885ead6 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.infra.gmfdiag.gef.internal;x-internal:=true, + org.eclipse.papyrus.infra.gmfdiag.gef.internal.editor;x-internal:=true +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui;bundle-version="3.100.0", + org.eclipse.ui.ide;bundle-version="3.12.0", + org.eclipse.gef;bundle-version="3.10.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.emf.edit;bundle-version="2.12.0" +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Version: 1.2.0.qualifier +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.gef.internal.Activator +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.gef;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/about.html b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/about.html new file mode 100644 index 00000000000..dd3c089a94c --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

November 14, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/build.properties new file mode 100644 index 00000000000..d4d9bf8dafa --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/build.properties @@ -0,0 +1,21 @@ +# +# Copyright (c) 2016 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Christian W. Damus - Initial API and implementation +# +bin.includes = META-INF/,\ + plugin.properties,\ + about.html,\ + .,\ + plugin.xml +output..=bin/ +jars.compile.order=. +src.includes = about.html +source.. = src/ +bin..=bin/ diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.properties new file mode 100644 index 00000000000..20c75f5c328 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.properties @@ -0,0 +1,13 @@ +# +# Copyright (c) 2016 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Christian W. Damus - Initial API and implementation +# +pluginName=Papyrus GMF Diagrams GEF 3 Connector +providerName=Eclipse Modeling Project diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.xml new file mode 100644 index 00000000000..0ca5f7d8aef --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/plugin.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/pom.xml new file mode 100644 index 00000000000..983819332af --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + org.eclipse.papyrus.releng + org.eclipse.papyrus + 1.2.0-SNAPSHOT + ../../../../releng/main + + org.eclipse.papyrus.infra.gmfdiag.gef + org.eclipse.papyrus + 1.2.0-SNAPSHOT + eclipse-plugin + \ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/Activator.java new file mode 100644 index 00000000000..15477d5ca61 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/Activator.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.gef.internal; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + public static final String ID = "org.eclipse.papyrus.infra.gmfdiag.gef"; //$NON-NLS-1$ + + private static Activator plugin; + + public Activator() { + } + + /** Logging helper */ + public static LogHelper log; + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + // register the login helper + log = new LogHelper(this); + } + + @Override + public void stop(BundleContext context) throws Exception { + log = null; + plugin = null; + super.stop(context); + } + + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/CoreMultiDiagramEditorAdapterFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/CoreMultiDiagramEditorAdapterFactory.java new file mode 100644 index 00000000000..fcaeff59d89 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/CoreMultiDiagramEditorAdapterFactory.java @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.gef.internal.editor; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.gef.ui.actions.ActionRegistry; +import org.eclipse.papyrus.infra.ui.editor.CoreMultiDiagramEditor; + +/** + * Adapter factory for GEF-specific adapters of the {@code CoreMultiDiagramEditor}. + */ +public class CoreMultiDiagramEditorAdapterFactory implements IAdapterFactory { + private final Class[] adapterTypes = { ActionRegistry.class }; + + public CoreMultiDiagramEditorAdapterFactory() { + super(); + } + + @Override + public T getAdapter(Object adaptableObject, Class adapterType) { + T result = null; + + if (adapterType == ActionRegistry.class) { + if (adaptableObject instanceof CoreMultiDiagramEditor) { + result = adapterType.cast(MultiDiagramEditorGefDelegate.getInstance( + (CoreMultiDiagramEditor) adaptableObject).get()); + } + } + + return result; + } + + @Override + public Class[] getAdapterList() { + return adapterTypes; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/MultiDiagramEditorGefDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/MultiDiagramEditorGefDelegate.java new file mode 100644 index 00000000000..364e369b046 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/src/org/eclipse/papyrus/infra/gmfdiag/gef/internal/editor/MultiDiagramEditorGefDelegate.java @@ -0,0 +1,117 @@ +/***************************************************************************** + * Copyright (c) 2008, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.gef.internal.editor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +import org.eclipse.gef.ui.actions.ActionRegistry; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.papyrus.infra.ui.editor.CoreMultiDiagramEditor; + + +/** + * Provide methods and services needed for Gef Editors. + * This class is intended to be used as a delegate inside classes providing MultiDiagramEditor. + * + * @author dumoulin + * + */ +public class MultiDiagramEditorGefDelegate implements Supplier { + + private static final Map instances = new HashMap<>(); + + private final CoreMultiDiagramEditor editor; + + /** The registry holding actions associated to the main editor */ + protected ActionRegistry actionRegistry; + + /** List of listeners on SelectionChanged event */ + private List selectionListeners = new ArrayList(1); + + + protected MultiDiagramEditorGefDelegate(CoreMultiDiagramEditor editor) { + super(); + + this.editor = editor; + editor.onClose(this::dispose); + } + + static MultiDiagramEditorGefDelegate getInstance(CoreMultiDiagramEditor editor) { + return instances.computeIfAbsent(editor, MultiDiagramEditorGefDelegate::new); + } + + /** + * This method should be called by the containing class. + */ + public void dispose() { + instances.remove(editor); + + selectionListeners.clear(); + if (actionRegistry != null) { + actionRegistry.dispose(); + } + } + + /** + * Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered. + * + * @param listener + * a selection changed listener + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionListeners.add(listener); + } + + @Override + public ActionRegistry get() { + return getActionRegistry(); + } + + /** + * Lazily creates and returns the action registry. + * + * @return the action registry + */ + public ActionRegistry getActionRegistry() { + if (actionRegistry == null) { + actionRegistry = new ActionRegistry(); + } + return actionRegistry; + } + + /** + * Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered. + * + * @param listener + * the selection changed listener to be removed + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionListeners.remove(listener); + } + + /** + * Sets the current selection for this selection provider. + * + * @param selection + * the new selection + */ + public void setSelection(ISelection selection) { + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF index 28ef95f5c19..ae0c7298ef5 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF @@ -16,7 +16,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink, org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies, org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java index 83753f6b0fd..e03aa2cc6f7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java @@ -26,8 +26,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.LabelProvider; -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.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -41,6 +39,8 @@ import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell; import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkException; import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; import org.eclipse.ui.plugin.AbstractUIPlugin; /** diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperlinkNavigationMenuEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperlinkNavigationMenuEditPolicy.java index 03cf2f11cde..4dfcd471761 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperlinkNavigationMenuEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperlinkNavigationMenuEditPolicy.java @@ -28,8 +28,6 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.LabelProvider; -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.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -46,6 +44,8 @@ import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell; import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkException; import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java index 27fe0bc19a4..6c33721c402 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2015 Atos Origin, CEA, Christian W. Damus, and others. - * + * Copyright (c) 2010, 2016 Atos Origin, CEA, 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 @@ -12,7 +11,7 @@ * Patrick Tessier (CEA LIST)-modification * Christian W. Damus (CEA) - bug 421411 * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 454386 - * Christian W. Damus - bug 460583 + * Christian W. Damus - bugs 460583, 485220 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies; @@ -41,30 +40,24 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.commands.CreationCommandDescriptor; import org.eclipse.papyrus.commands.INonDirtying; import org.eclipse.papyrus.commands.util.NonDirtyingUtils; -import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry; -import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart; import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator; -import org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui.AdvancedHLManager; -import org.eclipse.papyrus.infra.gmfdiag.navigation.ExistingNavigableElement; import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigableElement; -import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationHelper; import org.eclipse.papyrus.infra.gmfdiag.navigation.preference.INavigationPreferenceConstant; import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper; import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory; -import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject; import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkService; import org.eclipse.papyrus.infra.hyperlink.ui.EditorNavigationDialog; import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell; import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; /** * This class is used to open a new diagram when the double click is detected. @@ -144,7 +137,7 @@ public class NavigationEditPolicy extends OpenEditPolicy { } } - + // test which kind of navigation by consulting preference String navigationKind = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore().getString(INavigationPreferenceConstant.PAPYRUS_NAVIGATION_DOUBLECLICK_KIND); @@ -165,7 +158,7 @@ public class NavigationEditPolicy extends OpenEditPolicy { } } } - + if (defaultHyperLinkObject.size() == 1) { // open the diagram final HyperLinkObject hyperlinkObject = defaultHyperLinkObject.get(0); @@ -299,31 +292,33 @@ public class NavigationEditPolicy extends OpenEditPolicy { return new NavigateHyperlinksCommand(); } - + // No default hyperlinks, so we open the manager shell if the clicked-on object is not a diagram shotcut if (!(semanticElement instanceof Diagram)) { if (defaultHyperLinkObject.size() == 0) { class AddHyperlinkCommand extends Command { private Command addLinkCommand; - + private AddHyperlinkCommand() { super("Add hyperlink"); } - + + @Override public void execute() { addLinkCommand = new Command("Add Hyperlink") { @Override public void execute() { - HyperLinkManagerShell hyperLinkManagerShell = new HyperLinkManagerShell(createEditorRegistry(), ((IGraphicalEditPart) getHost()).getEditingDomain(), (EModelElement) ((IGraphicalEditPart) getHost()).getNotationView().getElement(), + HyperLinkManagerShell hyperLinkManagerShell = new HyperLinkManagerShell(createEditorRegistry(), ((IGraphicalEditPart) getHost()).getEditingDomain(), + (EModelElement) ((IGraphicalEditPart) getHost()).getNotationView().getElement(), ((IGraphicalEditPart) getHost()).getNotationView(), hyperlinkHelperFactory); hyperLinkManagerShell.setInput(hyperLinkObjectList); hyperLinkManagerShell.open(); // TODO cannot click Ok } }; - + addLinkCommand.execute(); } - + @Override public void undo() { if (addLinkCommand != null && addLinkCommand.canUndo()) { @@ -347,8 +342,9 @@ public class NavigationEditPolicy extends OpenEditPolicy { super.dispose(); } - }; - + } + ; + return new AddHyperlinkCommand(); } } @@ -421,7 +417,7 @@ public class NavigationEditPolicy extends OpenEditPolicy { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { try { - IPageManager pageMngr = ServiceUtilsForEObject.getInstance().getIPageManager(diagramToOpen); + IPageManager pageMngr = ServiceUtilsForEObject.getInstance().getService(IPageManager.class, diagramToOpen); if (pageMngr.isOpen(diagramToOpen)) { pageMngr.selectPage(diagramToOpen); } else { diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/SpecificViewContentProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/SpecificViewContentProvider.java index 7ab0d3c200e..2c4899215d1 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/SpecificViewContentProvider.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/SpecificViewContentProvider.java @@ -22,7 +22,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java index 512503a9b85..d1a914287ea 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java @@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry; import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor; import org.eclipse.papyrus.infra.hyperlink.ui.AbstractHyperLinkTab; import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; /** * diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java index 13f0fc44581..50689a10cb8 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java @@ -108,7 +108,7 @@ public class LocalDefaultLinkDiagramTab extends AbstractHyperLinkTab { /** * @return the composite that contains the table - * **/ + **/ public Composite getDefaultHyperlinkComposite() { return defaultHyperlinkComposite; } @@ -160,7 +160,7 @@ public class LocalDefaultLinkDiagramTab extends AbstractHyperLinkTab { * get the command to create diagrams from the selection done into the table * * @return the command in charge of the creation of the diagrams - * **/ + **/ public ICommand getCommand() { return command; } @@ -349,7 +349,7 @@ public class LocalDefaultLinkDiagramTab extends AbstractHyperLinkTab { * @return the creation command registry */ protected static ICreationCommandRegistry getCreationCommandRegistry() { - return CreationCommandRegistry.getInstance(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); + return CreationCommandRegistry.getInstance(org.eclipse.papyrus.infra.ui.Activator.PLUGIN_ID); } @Override diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF index df644154d9a..adee178f3f9 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.7.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0" + org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.gmfdiag.menu, org.eclipse.papyrus.infra.gmfdiag.menu.handlers, org.eclipse.papyrus.infra.gmfdiag.menu.utils diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/AbstractDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/AbstractDiagramHandler.java index d083706430d..e897fc0b837 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/AbstractDiagramHandler.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/AbstractDiagramHandler.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.infra.gmfdiag.menu.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; -import org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; import org.eclipse.ui.IWorkbenchPart; /** diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF index eaff189f2d8..3060fab76f2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", - org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0" + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/DuplicateDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/DuplicateDiagramHandler.java index c8df938df4f..cd42a2b5ea7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/DuplicateDiagramHandler.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/DuplicateDiagramHandler.java @@ -24,7 +24,7 @@ import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages.Messages; /** 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 9f0cf30520d..5f10ca41dab 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 @@ -16,7 +16,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.openelement;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.labelprovider;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" Export-Package: org.eclipse.papyrus.infra.gmfdiag.navigation, org.eclipse.papyrus.infra.gmfdiag.navigation.decorator, org.eclipse.papyrus.infra.gmfdiag.navigation.editpolicy, diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menuContributor/OwnedDiagramsButton.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menuContributor/OwnedDiagramsButton.java index 0a5b35a8c2a..c5e650dbd03 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menuContributor/OwnedDiagramsButton.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menuContributor/OwnedDiagramsButton.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) - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -20,7 +21,7 @@ import java.util.List; 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.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -43,14 +44,14 @@ public class OwnedDiagramsButton implements NavigationMenuContributor { */ public List getButtons(Object fromElement) { List buttons = new LinkedList(); - + if (fromElement != null) { List diagrams = getOwnedDiagrams(fromElement); if (!diagrams.isEmpty()) { buttons.add(new NavigationSubMenuButton("Owned diagrams...", null, "Show owned diagrams", diagrams)); } } - + return buttons; } @@ -64,15 +65,17 @@ public class OwnedDiagramsButton implements NavigationMenuContributor { try { List ownedDiagrams = new LinkedList(); - IPageManager pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(eObject); + IPageManager pageManager = ServiceUtilsForEObject.getInstance().getService(IPageManager.class, eObject); for (Object pageObject : pageManager.allPages()) { if (pageObject instanceof Diagram) { Diagram diagram = (Diagram) pageObject; // Avoid navigation to the current diagram - /*if (currentView != null && currentView.getDiagram() == diagram) { - continue; - }*/ + /* + * if (currentView != null && currentView.getDiagram() == diagram) { + * continue; + * } + */ if (diagram.getElement() == eObject) { ownedDiagrams.add(diagram); 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 9833aa178b4..d516d8a81b4 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 @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.2.0" + org.eclipse.papyrus.infra.emf;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/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/plugin.xml index 55b5d31f13c..a011447dff8 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/plugin.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/plugin.xml @@ -15,7 +15,7 @@ --> Initial Key "+key+"--> "+ newKey); - return Platform.getPreferencesService().get(newKey, null, getPreferenceNodes(true)); - } - - @Override - public boolean getDefaultBoolean(String name) { - - return super.getDefaultBoolean(findKeyWithADefaultValue(name)); - } - - @Override - public double getDefaultDouble(String name) { - return super.getDefaultDouble(findKeyWithADefaultValue(name)); - } - - @Override - public float getDefaultFloat(String name) { - return super.getDefaultFloat(findKeyWithADefaultValue(name)); - }; - - @Override - public int getDefaultInt(String name) { - return super.getDefaultInt(findKeyWithADefaultValue(name)); - } - - @Override - public long getDefaultLong(String name) { - return super.getDefaultLong(findKeyWithADefaultValue(name)); - } - - @Override - public String getDefaultString(String name) { - return super.getDefaultString(findKeyWithADefaultValue(name)); - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/PapyrusScopedPreferenceStore.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/PapyrusScopedPreferenceStore.java deleted file mode 100644 index 6680226dbeb..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/PapyrusScopedPreferenceStore.java +++ /dev/null @@ -1,858 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.preferences; - -/*************************************************************************** - Copyright (c) 2010 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: - * the code is copy from ScopedPreferenceStore but I have open some methods in order to be - * available for the overload - * - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - * - *******************************************************************************/ - -import java.io.IOException; - -import org.eclipse.core.commands.common.EventManager; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener; -import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent; -import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.jface.preference.IPersistentPreferenceStore; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.util.SafeRunnable; -import org.eclipse.ui.internal.WorkbenchMessages; -import org.osgi.service.prefs.BackingStoreException; - -/** - * The ScopedPreferenceStore is an IPreferenceStore that uses the scopes - * provided in org.eclipse.core.runtime.preferences. - *

- * A ScopedPreferenceStore does the lookup of a preference based on it's search scopes and sets the value of the preference based on its store scope. - *

- *

- * The default scope is always included in the search scopes when searching for preference values. - *

- * - * @see org.eclipse.core.runtime.preferences - * @since 3.1 - */ -public class PapyrusScopedPreferenceStore extends EventManager implements IPreferenceStore, IPersistentPreferenceStore { - - /** - * The storeContext is the context where values will stored with the - * setValue methods. If there are no searchContexts this will be the search - * context. (along with the "default" context) - */ - protected IScopeContext storeContext; - - /** - * The searchContext is the array of contexts that will be used by the get - * methods for searching for values. - */ - protected IScopeContext[] searchContexts; - - /** - * A boolean to indicate the property changes should not be propagated. - */ - protected boolean silentRunning = false; - - /** - * The listener on the IEclipsePreferences. This is used to forward updates - * to the property change listeners on the preference store. - */ - protected IEclipsePreferences.IPreferenceChangeListener preferencesListener; - - /** - * The default context is the context where getDefault and setDefault - * methods will search. This context is also used in the search. - */ - protected IScopeContext defaultContext = DefaultScope.INSTANCE; - - /** - * The nodeQualifer is the string used to look up the node in the contexts. - */ - protected String nodeQualifier; - - /** - * The defaultQualifier is the string used to look up the default node. - */ - protected String defaultQualifier; - - /** - * Boolean value indicating whether or not this store has changes to be - * saved. - */ - private boolean dirty; - - /** - * Create a new instance of the receiver. Store the values in context in the - * node looked up by qualifier. NOTE: Any instance of - * ScopedPreferenceStore should call - * - * @param context - * the scope to store to - * @param qualifier - * the qualifier used to look up the preference node - * @param defaultQualifierPath - * the qualifier used when looking up the defaults - */ - public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) { - this(context, qualifier); - this.defaultQualifier = defaultQualifierPath; - } - - /** - * Create a new instance of the receiver. Store the values in context in the - * node looked up by qualifier. - * - * @param context - * the scope to store to - * @param qualifier - * the qualifer used to look up the preference node - */ - public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier) { - storeContext = context; - this.nodeQualifier = qualifier; - this.defaultQualifier = qualifier; - - ((IEclipsePreferences) getStorePreferences().parent()).addNodeChangeListener(getNodeChangeListener()); - } - - /** - * Return a node change listener that adds a removes the receiver when nodes - * change. - * - * @return INodeChangeListener - */ - private INodeChangeListener getNodeChangeListener() { - return new IEclipsePreferences.INodeChangeListener() { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences - * .NodeChangeEvent) - */ - public void added(NodeChangeEvent event) { - if (nodeQualifier.equals(event.getChild().name()) && isListenerAttached()) { - getStorePreferences().addPreferenceChangeListener(preferencesListener); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences. - * IEclipsePreferences.NodeChangeEvent) - */ - public void removed(NodeChangeEvent event) { - // Do nothing as there are no events from removed node - } - }; - } - - /** - * Initialize the preferences listener. - */ - private void initializePreferencesListener() { - if (preferencesListener == null) { - preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime. - * preferences.IEclipsePreferences.PreferenceChangeEvent) - */ - public void preferenceChange(PreferenceChangeEvent event) { - - if (silentRunning) { - return; - } - - Object oldValue = event.getOldValue(); - Object newValue = event.getNewValue(); - String key = event.getKey(); - if (newValue == null) { - newValue = getDefault(key, oldValue); - } else if (oldValue == null) { - oldValue = getDefault(key, newValue); - } - firePropertyChangeEvent(event.getKey(), oldValue, newValue); - } - }; - getStorePreferences().addPreferenceChangeListener(preferencesListener); - } - - } - - /** - * Does its best at determining the default value for the given key. Checks - * the given object's type and then looks in the list of defaults to see if - * a value exists. If not or if there is a problem converting the value, the - * default default value for that type is returned. - * - * @param key - * the key to search - * @param obj - * the object who default we are looking for - * @return Object or null - */ - protected Object getDefault(String key, Object obj) { - IEclipsePreferences defaults = getDefaultPreferences(); - if (obj instanceof String) { - return defaults.get(key, STRING_DEFAULT_DEFAULT); - } else if (obj instanceof Integer) { - return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); - } else if (obj instanceof Double) { - return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); - } else if (obj instanceof Float) { - return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); - } else if (obj instanceof Long) { - return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); - } else if (obj instanceof Boolean) { - return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; - } else { - return null; - } - } - - /** - * Return the IEclipsePreferences node associated with this store. - * - * @return the preference node for this store - */ - protected IEclipsePreferences getStorePreferences() { - return storeContext.getNode(nodeQualifier); - } - - /** - * Return the default IEclipsePreferences for this store. - * - * @return this store's default preference node - */ - protected IEclipsePreferences getDefaultPreferences() { - return defaultContext.getNode(defaultQualifier); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { - initializePreferencesListener();// Create the preferences listener if it - // does not exist - addListenerObject(listener); - } - - /** - * Return the preference path to search preferences on. This is the list of - * preference nodes based on the scope contexts for this store. If there are - * no search contexts set, then return this store's context. - *

- * Whether or not the default context should be included in the resulting list is specified by the includeDefault parameter. - *

- * - * @param includeDefault - * true if the default context should be included - * and false otherwise - * @return IEclipsePreferences[] - * @since 3.4 public, was added in 3.1 as private method - */ - public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) { - // if the user didn't specify a search order, then return the scope that - // this store was created on. (and optionally the default) - if (searchContexts == null) { - if (includeDefault) { - return new IEclipsePreferences[] { getStorePreferences(), getDefaultPreferences() }; - } - return new IEclipsePreferences[] { getStorePreferences() }; - } - // otherwise the user specified a search order so return the appropriate - // nodes based on it - int length = searchContexts.length; - if (includeDefault) { - length++; - } - IEclipsePreferences[] preferences = new IEclipsePreferences[length]; - for (int i = 0; i < searchContexts.length; i++) { - preferences[i] = searchContexts[i].getNode(nodeQualifier); - } - if (includeDefault) { - preferences[length - 1] = getDefaultPreferences(); - } - return preferences; - } - - /** - * Set the search contexts to scopes. When searching for a value the seach - * will be done in the order of scope contexts and will not search the - * storeContext unless it is in this list. - *

- * If the given list is null, then clear this store's search contexts. This means that only this store's scope context and default scope will be used during preference value searching. - *

- *

- * The defaultContext will be added to the end of this list automatically and MUST NOT be included by the user. - *

- * - * @param scopes - * a list of scope contexts to use when searching, or null - */ - public void setSearchContexts(IScopeContext[] scopes) { - this.searchContexts = scopes; - if (scopes == null) { - return; - } - - // Assert that the default was not included (we automatically add it to - // the end) - for (int i = 0; i < scopes.length; i++) { - if (scopes[i].equals(defaultContext)) { - Assert.isTrue(false, WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String) - */ - public boolean contains(String name) { - if (name == null) { - return false; - } - return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(true))) != null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, - * java.lang.Object, java.lang.Object) - */ - public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { - // important: create intermediate array to protect against listeners - // being added/removed during the notification - final Object[] list = getListeners(); - if (list.length == 0) { - return; - } - final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); - for (int i = 0; i < list.length; i++) { - final IPropertyChangeListener listener = (IPropertyChangeListener) list[i]; - SafeRunner.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$ - - public void run() { - listener.propertyChange(event); - } - }); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String) - */ - public boolean getBoolean(String name) { - String value = internalGet(name); - return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value).booleanValue(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String) - */ - public boolean getDefaultBoolean(String name) { - return getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String) - */ - public double getDefaultDouble(String name) { - return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String) - */ - public float getDefaultFloat(String name) { - return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String) - */ - public int getDefaultInt(String name) { - return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String) - */ - public long getDefaultLong(String name) { - return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String) - */ - public String getDefaultString(String name) { - return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String) - */ - public double getDouble(String name) { - String value = internalGet(name); - if (value == null) { - return DOUBLE_DEFAULT_DEFAULT; - } - try { - return Double.parseDouble(value); - } catch (NumberFormatException e) { - return DOUBLE_DEFAULT_DEFAULT; - } - } - - /** - * Return the string value for the specified key. Look in the nodes which - * are specified by this object's list of search scopes. If the value does - * not exist then return null. - * - * @param key - * the key to search with - * @return String or null if the value does not exist. - */ - protected String internalGet(String key) { - return Platform.getPreferencesService().get(key, null, getPreferenceNodes(true)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String) - */ - public float getFloat(String name) { - String value = internalGet(name); - if (value == null) { - return FLOAT_DEFAULT_DEFAULT; - } - try { - return Float.parseFloat(value); - } catch (NumberFormatException e) { - return FLOAT_DEFAULT_DEFAULT; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String) - */ - public int getInt(String name) { - String value = internalGet(name); - if (value == null) { - return INT_DEFAULT_DEFAULT; - } - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - return INT_DEFAULT_DEFAULT; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String) - */ - public long getLong(String name) { - String value = internalGet(name); - if (value == null) { - return LONG_DEFAULT_DEFAULT; - } - try { - return Long.parseLong(value); - } catch (NumberFormatException e) { - return LONG_DEFAULT_DEFAULT; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String) - */ - public String getString(String name) { - String value = internalGet(name); - return value == null ? STRING_DEFAULT_DEFAULT : value; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String) - */ - public boolean isDefault(String name) { - if (name == null) { - return false; - } - return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(false))) == null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving() - */ - public boolean needsSaving() { - return dirty; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, - * java.lang.String) - */ - public void putValue(String name, String value) { - try { - // Do not notify listeners - silentRunning = true; - getStorePreferences().put(name, value); - } finally { - // Be sure that an exception does not stop property updates - silentRunning = false; - dirty = true; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - removeListenerObject(listener); - if (!isListenerAttached()) { - disposePreferenceStoreListener(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * double) - */ - public void setDefault(String name, double value) { - getDefaultPreferences().putDouble(name, value); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * float) - */ - public void setDefault(String name, float value) { - getDefaultPreferences().putFloat(name, value); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * int) - */ - public void setDefault(String name, int value) { - getDefaultPreferences().putInt(name, value); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * long) - */ - public void setDefault(String name, long value) { - getDefaultPreferences().putLong(name, value); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * java.lang.String) - */ - public void setDefault(String name, String defaultObject) { - getDefaultPreferences().put(name, defaultObject); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, - * boolean) - */ - public void setDefault(String name, boolean value) { - getDefaultPreferences().putBoolean(name, value); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String) - */ - public void setToDefault(String name) { - - String oldValue = getString(name); - String defaultValue = getDefaultString(name); - try { - silentRunning = true;// Turn off updates from the store - // removing a non-existing preference is a no-op so call the Core - // API directly - getStorePreferences().remove(name); - if (!oldValue.equals(defaultValue)) { - dirty = true; - firePropertyChangeEvent(name, oldValue, defaultValue); - } - - } finally { - silentRunning = false;// Restart listening to preferences - } - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * double) - */ - public void setValue(String name, double value) { - double oldValue = getDouble(name); - if (oldValue == value) { - return; - } - try { - silentRunning = true;// Turn off updates from the store - if (getDefaultDouble(name) == value) { - getStorePreferences().remove(name); - } else { - getStorePreferences().putDouble(name, value); - } - dirty = true; - firePropertyChangeEvent(name, new Double(oldValue), new Double(value)); - } finally { - silentRunning = false;// Restart listening to preferences - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * float) - */ - public void setValue(String name, float value) { - float oldValue = getFloat(name); - if (oldValue == value) { - return; - } - try { - silentRunning = true;// Turn off updates from the store - if (getDefaultFloat(name) == value) { - getStorePreferences().remove(name); - } else { - getStorePreferences().putFloat(name, value); - } - dirty = true; - firePropertyChangeEvent(name, new Float(oldValue), new Float(value)); - } finally { - silentRunning = false;// Restart listening to preferences - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * int) - */ - public void setValue(String name, int value) { - int oldValue = getInt(name); - if (oldValue == value) { - return; - } - try { - silentRunning = true;// Turn off updates from the store - if (getDefaultInt(name) == value) { - getStorePreferences().remove(name); - } else { - getStorePreferences().putInt(name, value); - } - dirty = true; - firePropertyChangeEvent(name, Integer.valueOf(oldValue), Integer.valueOf(value)); - } finally { - silentRunning = false;// Restart listening to preferences - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * long) - */ - public void setValue(String name, long value) { - long oldValue = getLong(name); - if (oldValue == value) { - return; - } - try { - silentRunning = true;// Turn off updates from the store - if (getDefaultLong(name) == value) { - getStorePreferences().remove(name); - } else { - getStorePreferences().putLong(name, value); - } - dirty = true; - firePropertyChangeEvent(name, Long.valueOf(oldValue), Long.valueOf(value)); - } finally { - silentRunning = false;// Restart listening to preferences - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * java.lang.String) - */ - public void setValue(String name, String value) { - // Do not turn on silent running here as Strings are propagated - if (getDefaultString(name).equals(value)) { - getStorePreferences().remove(name); - } else { - getStorePreferences().put(name, value); - } - dirty = true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, - * boolean) - */ - public void setValue(String name, boolean value) { - boolean oldValue = getBoolean(name); - if (oldValue == value) { - return; - } - try { - silentRunning = true;// Turn off updates from the store - if (getDefaultBoolean(name) == value) { - getStorePreferences().remove(name); - } else { - getStorePreferences().putBoolean(name, value); - } - dirty = true; - firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE); - } finally { - silentRunning = false;// Restart listening to preferences - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPersistentPreferenceStore#save() - */ - public void save() throws IOException { - try { - getStorePreferences().flush(); - dirty = false; - } catch (BackingStoreException e) { - throw new IOException(e.getMessage()); - } - - } - - /** - * Dispose the receiver. - */ - private void disposePreferenceStoreListener() { - - IEclipsePreferences root = (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE); - try { - if (!(root.nodeExists(nodeQualifier))) { - return; - } - } catch (BackingStoreException e) { - return;// No need to report here as the node won't have the - // listener - } - - IEclipsePreferences preferences = getStorePreferences(); - if (preferences == null) { - return; - } - if (preferencesListener != null) { - preferences.removePreferenceChangeListener(preferencesListener); - preferencesListener = null; - } - } - -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractApplyValueOnPreferenceKeyDialog.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractApplyValueOnPreferenceKeyDialog.java deleted file mode 100644 index 932b3188bb6..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractApplyValueOnPreferenceKeyDialog.java +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.preferences.ui.dialog; - -import java.util.ArrayList; - -/** - * The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys - */ -public abstract class AbstractApplyValueOnPreferenceKeyDialog extends AbstractPreferenceKeyDialog { - - /** The checked key. */ - protected ArrayList checkedKey; - - /** - * Instantiates a new apply value on preference key dialog. - * - * @param keys - * the keys - */ - public AbstractApplyValueOnPreferenceKeyDialog(String[] keys) { - super(keys); - checkedKey = new ArrayList(); - } - - /** - * Gets the key to remove. - * - * @return the key to remove - */ - public ArrayList getKeyToRemove() { - return checkedKey; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ - @Override - protected void okPressed() { - for (int i = 0; i < keyTable.getItems().length; i++) { - if (keyTable.getItems()[i].getChecked()) { - checkedKey.add((String) keyTable.getItems()[i].getData()); - } - } - super.okPressed(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#cancelPressed() - */ - @Override - protected void cancelPressed() { - super.cancelPressed(); - checkedKey = new ArrayList(); - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractPreferenceKeyDialog.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractPreferenceKeyDialog.java deleted file mode 100644 index 94703ea1859..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/preferences/ui/dialog/AbstractPreferenceKeyDialog.java +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 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 - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.preferences.ui.dialog; - -import java.util.Arrays; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.papyrus.infra.tools.Activator; -import org.eclipse.papyrus.infra.tools.messages.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * The Class AbstractPreferenceKeyDialog display all preference key that are given in parameters - */ -public abstract class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.StatusDialog { - - /** The key table. */ - protected Table keyTable; - - /** The table viewer. */ - protected TableViewer tableViewer; - - /** The keys. */ - protected String[] keys; - - /** - * Instantiates a new abstract preference key dialog. - * - * @param keys - * the array of preference jy to display - */ - public AbstractPreferenceKeyDialog(String[] keys) { - super(new Shell()); - this.keys = Arrays.copyOf(keys, keys.length); - setStatusLineAboveButtons(true); - updateStatus(new Status(IStatus.INFO, Activator.PLUGIN_ID, Messages.AbstractPreferenceKeyDialog_WouldYouLikeOverloadPreferences)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - keyTable = new Table(composite, SWT.CHECK | SWT.BORDER); - tableViewer = new TableViewer(keyTable); - tableViewer.setLabelProvider(createLabelProvider()); - tableViewer.setContentProvider(createContentProvider()); - - TableColumn column = new TableColumn(keyTable, SWT.NONE); - column.setWidth(150); - column.setText(Messages.AbstractPreferenceKeyDialog_Pref_Kind); - - column = new TableColumn(keyTable, SWT.NONE); - column.setWidth(90); - column.setText(Messages.AbstractPreferenceKeyDialog_Level); - - column = new TableColumn(keyTable, SWT.NONE); - column.setWidth(200); - column.setText(Messages.AbstractPreferenceKeyDialog_Localization); - tableViewer.setInput(keys); - keyTable.setHeaderVisible(true); - - - return composite; - - } - - /** - * - * @return - * the label provider for the table viewer - */ - protected abstract IBaseLabelProvider createLabelProvider(); - - /** - * - * @return - * the content provider for the table viewer - */ - protected abstract IContentProvider createContentProvider(); - -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/spi/IExecutorServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/spi/IExecutorServiceFactory.java new file mode 100644 index 00000000000..cc2ff542665 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/spi/IExecutorServiceFactory.java @@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.tools.spi; + +import org.eclipse.papyrus.infra.tools.util.IExecutorService; + +/** + * An OSGi service protocol for creation of an executor service on the UI thread. + */ +@FunctionalInterface +public interface IExecutorServiceFactory { + /** Creates an executor service that posts runnables on the SWT UI thread. */ + IExecutorService createExecutor(); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/AbstractCreateMenuFromCommandCategory.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/AbstractCreateMenuFromCommandCategory.java deleted file mode 100644 index fded1dd0e7f..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/AbstractCreateMenuFromCommandCategory.java +++ /dev/null @@ -1,135 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.Category; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.common.NotDefinedException; -import org.eclipse.core.expressions.EvaluationResult; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.papyrus.infra.tools.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.menus.CommandContributionItem; -import org.eclipse.ui.menus.CommandContributionItemParameter; -import org.eclipse.ui.menus.ExtensionContributionFactory; -import org.eclipse.ui.menus.IContributionRoot; -import org.eclipse.ui.services.IServiceLocator; - -/** - * Abstract Class to create menu from an Eclipse Command category - * - * @author VL222926 - * - */ -public abstract class AbstractCreateMenuFromCommandCategory extends ExtensionContributionFactory { - - /** the category of the command contributing to this menu */ - protected final String commandCateogyId; - - /** - * - * Constructor. - * - * @param commandCategoryId - * the category of the command contributing to this menu - */ - public AbstractCreateMenuFromCommandCategory(final String commandCategoryId) { - this.commandCateogyId = commandCategoryId; - } - - /** - * - * @see org.eclipse.ui.menus.AbstractContributionFactory#createContributionItems(org.eclipse.ui.services.IServiceLocator, org.eclipse.ui.menus.IContributionRoot) - * - * @param serviceLocator - * @param additions - */ - @Override - public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { - // test to know if we can create elements if it is possible... - Expression visibleWhen = new Expression() { - - @Override - public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { - return EvaluationResult.TRUE; - } - }; - for (final CommandContributionItem item : addCreationItems(serviceLocator, additions, null)) { - additions.addContributionItem(item, visibleWhen); - } - } - - /** - * - * @param serviceLocator - * @param additions - * @param parent - * @return - */ - protected List addCreationItems(final IServiceLocator serviceLocator, final IContributionRoot additions, IContributionManager parent) { - final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); - final List items = new ArrayList(); - final Category category = commandService.getCategory(this.commandCateogyId); - final Set commands = new TreeSet(); - commands.addAll(Arrays.asList(commandService.getDefinedCommands())); - for (Command command : commands) { - Category currentCategory = null; - try { - currentCategory = command.getCategory(); - } catch (NotDefinedException e) { - Activator.log.debug(e.getLocalizedMessage()); - continue; - } - if (command.isDefined() && category.equals(currentCategory)) { - final IHandler handler = command.getHandler(); - if (handler instanceof AbstractHandler) { - - // required!?!?! in some case can avoid the message for handler conflicting (ex : Allocate in SysML NatTable Allocation - ((AbstractHandler) handler).setEnabled(null); - boolean isEnabled = handler.isEnabled(); - command.setEnabled(null); - ((AbstractHandler) handler).setEnabled(null); - - isEnabled = handler.isEnabled(); - try { - if (isEnabled) { - CommandContributionItemParameter p = new CommandContributionItemParameter(serviceLocator, "", command.getId(), SWT.PUSH); //$NON-NLS-1$ - p.label = command.getDescription(); - p.icon = EclipseCommandUtils.getCommandIcon(command); - CommandContributionItem item = new CommandContributionItem(p); - items.add(item); - } - } catch (NotDefinedException e) { - Activator.log.debug(e.getLocalizedMessage()); - } - } - } - } - return items; - } - -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/CoreExecutors.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/CoreExecutors.java new file mode 100644 index 00000000000..14604007bc2 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/CoreExecutors.java @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.tools.util; + +import java.util.concurrent.Executor; + +import org.eclipse.papyrus.infra.tools.Activator; + +/** + * A provider of {@link Executor}s offering various synchronous and asynchronous + * execution characteristics. + */ +public class CoreExecutors { + + // Not instantiable by clients + private CoreExecutors() { + super(); + } + + /** + * Obtains a service that posts tasks for asynchronous execution on the + * SWT display thread, if there is one. If there is no display, then + * a default background-thread executor is supplied by the Java platform. + * + * @return an executor service on the UI thread (if there is a UI). Never + * {@code null} and always the same instance. Clients may not shut down + * this executor; attempting to do so will result in {@link IllegalStateException}s + */ + public static IExecutorService getUIExecutorService() { + return Activator.getDefault().getUIExecutorService(); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java deleted file mode 100644 index c49980ab877..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java +++ /dev/null @@ -1,137 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.util; - -import java.util.Collection; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.core.commands.Category; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.State; -import org.eclipse.core.commands.common.NotDefinedException; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.tools.Activator; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommandImageService; -import org.eclipse.ui.commands.ICommandService; - -/** - * This class provides useful methods to manipulate Eclipse Command - * - * @author vl222926 - * - */ -public class EclipseCommandUtils { - - private EclipseCommandUtils() { - // to prevent instanciation - } - - public static final String TOGGLE_STATE = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$ - - public static final String RADIO_STATE = "org.eclipse.ui.commands.radioState"; //$NON-NLS-1$ - - public static final String DELETE_COMMAND = "org.eclipse.ui.edit.delete"; //$NON-NLS-1$ - - /** - * - * @param categoryId - * a category id - * @return - * all commands defined for this category - */ - public static final Collection getAllExistingCommandsInCategory(final String categoryId) { - final Set commands = new TreeSet(); - final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); - final Category category = commandService.getCategory(categoryId); - for (final Command command : commandService.getDefinedCommands()) { - Category currentCategory = null; - try { - currentCategory = command.getCategory(); - } catch (NotDefinedException e) { - Activator.log.debug(e.getLocalizedMessage()); - continue; - } - if (/* command.isDefined() && */category.equals(currentCategory)) { - commands.add(command); - } - } - return commands; - } - - /** - * - * @param command - * an Eclipse command - * @return - * the image descriptor associated to this command - */ - public static final ImageDescriptor getCommandIcon(final Command command) { - final IWorkbench workbench = PlatformUI.getWorkbench(); - final ICommandImageService service = (ICommandImageService) workbench.getService(ICommandImageService.class); - final ImageDescriptor imageDescriptor = service.getImageDescriptor(command.getId()); - return imageDescriptor; - } - - /** - * - * @param command - * an eclipse command - * @param newValue - * the new boolean value to set to the state of this command - */ - public static final void updateToggleCommandState(final org.eclipse.core.commands.Command command, final boolean newValue) { - if (command != null) { - final State state = command.getState(TOGGLE_STATE); - if (state != null) { - state.setValue(newValue); - } - } - } - - /** - * - * @param command - * an eclipse command - * @param newValue - * the new value to set to the state of this command - */ - public static final void updateRadioCommandState(final org.eclipse.core.commands.Command command, final Object newValue) { - if (command != null) { - final State state = command.getState(RADIO_STATE); - if (state != null) { - state.setValue(newValue); - } - } - } - - /** - * - * @return - * the eclipse command service - */ - public static final ICommandService getCommandService() { - IWorkbench wb = PlatformUI.getWorkbench(); - if (wb != null) { - IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); - if (ww != null) { - return (ICommandService) ww.getService(ICommandService.class); - } - } - return null; - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EditorHelper.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EditorHelper.java deleted file mode 100644 index e363778fabf..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EditorHelper.java +++ /dev/null @@ -1,71 +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: - * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.util; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * - * a helper for the Editor - * - */ -public class EditorHelper { - - private EditorHelper() { - // nothing to do - } - - /** - * - * @return - * the current editor or null if not found - */ - public static final IEditorPart getCurrentEditor() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); - if (activeWorkbench != null) { - final IWorkbenchPage activePage = activeWorkbench.getActivePage(); - if (activePage != null) { - return activePage.getActiveEditor(); - } - } - } - return null; - } - - /** - * - * @return - * the current active part or null if not found - */ - public static final IWorkbenchPart getActivePart() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); - if (activeWorkbench != null) { - final IWorkbenchPage activePage = activeWorkbench.getActivePage(); - if (activePage != null) { - return activePage.getActivePart(); - } - } - } - return null; - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ICallableWithProgress.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ICallableWithProgress.java deleted file mode 100644 index 2efd39b53ed..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ICallableWithProgress.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.tools.util; - -import java.lang.reflect.InvocationTargetException; -import java.util.concurrent.Callable; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; - -/** - * The {@link Callable} analogue of an {@link IRunnableWithProgress}. - */ -public interface ICallableWithProgress { - /** - * Invokes me in a runnable context with a progress monitor. - * - * @param monitor - * the progress monitor to use to display progress and receive - * requests for cancellation - * @exception InvocationTargetException - * if the run method must propagate a checked exception, - * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically - * wrapped in an InvocationTargetException by the calling context - * @exception InterruptedException - * if the operation detects a request to cancel, - * using IProgressMonitor.isCanceled(), it should exit by throwing InterruptedException - * - * @see UIUtil#call(IRunnableContext, ICallableWithProgress) - * @see IRunnableContext#run - */ - V call(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException; -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/IExecutorService.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/IExecutorService.java new file mode 100644 index 00000000000..4e833f8bf76 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/IExecutorService.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.tools.util; + +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +/** + * A specialized {@link ExecutorService} that also provides for synchronous + * execution of tasks, with the possibility that these could be optimized + * where appropriate (such as in a UI-thread executor to use a {@code syncExec} + * call). + */ +public interface IExecutorService extends ExecutorService { + /** + * Synchronously executes a {code task}. The task will run on the + * appropriate executor thread, as usual, but control will return + * to the caller only when its execution is complete. + * + * @param task + * the task to execute + * + * @throws InterruptedException + * on interruption, as per {@link Future#get()} + * @throws ExecutionException + * on failed execution, as per {@link Future#get()} + */ + void syncExec(Runnable task) throws InterruptedException, ExecutionException; + + /** + * Synchronously invokes a {code callable}. The callable will run on the + * appropriate executor thread, as usual, but control will return + * to the caller only when its execution is complete. + * + * @param callable + * the task to execute + * + * @throws InterruptedException + * on interruption, as per {@link Future#get()} + * @throws ExecutionException + * on failed execution, as per {@link Future#get()} + */ + V syncCall(Callable callable) throws InterruptedException, ExecutionException; +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/LocalMemento.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/LocalMemento.java deleted file mode 100644 index e9ac7b68167..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/LocalMemento.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.tools.util; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.ui.IMemento; - - -/** - * Invocation handler for the dynamic local memento implementation. - */ -class LocalMemento implements InvocationHandler { - - private static final Class[] INTERFACES = { IMemento.class }; - - private static final Map delegates = createDelegates(); - - private final String type; - - private final String id; - - private final List children = new ArrayList(); - - private final Map attributes = new HashMap(); - - private String textData; - - LocalMemento(String type, String id) { - super(); - - this.type = type; - this.id = id; - } - - static IMemento createMemento(String type, String id) { - LocalMemento handler = new LocalMemento(type, id); - return (IMemento) Proxy.newProxyInstance(LocalMemento.class.getClassLoader(), INTERFACES, handler); - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Object result = null; - - Method implementation = delegates.get(method); - if (implementation == null) { - throw new UnsupportedOperationException("dynamic proxy handler does not understand " + method.getName()); //$NON-NLS-1$ - } else { - result = implementation.invoke(this, args); - } - - return result; - } - - @API - String getType() { - return type; - } - - @API - String getID() { - return id; - } - - @API - IMemento createChild(String type) { - return createChild(type, null); - } - - @API - IMemento createChild(String type, String id) { - IMemento result = createMemento(type, id); - children.add(result); - return result; - } - - @API - IMemento getChild(String type) { - IMemento result = null; - for (IMemento next : children) { - if (type.equals(next.getType())) { - result = next; - break; - } - } - return result; - } - - @API - IMemento[] getChildren() { - return children.toArray(new IMemento[children.size()]); - } - - @API - IMemento[] getChildren(String type) { - List result = new ArrayList(children.size()); - for (IMemento next : children) { - if (type.equals(next.getType())) { - result.add(next); - } - } - return result.toArray(new IMemento[result.size()]); - } - - @API - Float getFloat(String key) { - return coerce(attributes.get(key), Float.class); - } - - private T coerce(Object value, Class type) { - Object result; - - if (value == null) { - result = value; - } else if (type.isInstance(value)) { - result = value; - } else if (Number.class.isAssignableFrom(type) && (value instanceof Number)) { - Number number = (Number) value; - if (type == Integer.class) { - result = number.intValue(); - } else if (type == Float.class) { - result = number.floatValue(); - } else { - throw new IllegalArgumentException("unsupported numeric type: " + type.getSimpleName()); //$NON-NLS-1$ - } - } else if (Number.class.isAssignableFrom(type) && (value instanceof String)) { - String string = (String) value; - if (type == Integer.class) { - result = Integer.valueOf(string); - } else if (type == Float.class) { - result = Float.valueOf(string); - } else { - throw new IllegalArgumentException("unsupported numeric type: " + type.getSimpleName()); //$NON-NLS-1$ - } - } else if (type == Boolean.class) { - // We know the value isn't a Boolean, otherwise we would have handled it already - if (value instanceof String) { - result = Boolean.valueOf((String) value); - } else { - throw new IllegalArgumentException("unsupported boolean conversion from type: " + ((value == null) ? "null" : value.getClass().getSimpleName())); //$NON-NLS-1$ - } - } else if (type == String.class) { - result = String.valueOf(value); - } else { - throw new IllegalArgumentException("unsupported attribute type: " + type.getSimpleName()); //$NON-NLS-1$ - } - - return type.cast(result); - } - - @API - Integer getInteger(String key) { - return coerce(attributes.get(key), Integer.class); - } - - @API - String getString(String key) { - return coerce(attributes.get(key), String.class); - } - - @API - Boolean getBoolean(String key) { - return coerce(attributes.get(key), Boolean.class); - } - - @API - String getTextData() { - return textData; - } - - @API - String[] getAttributeKeys() { - return attributes.keySet().toArray(new String[attributes.size()]); - } - - @API - void putFloat(String key, float value) { - attributes.put(key, value); - } - - @API - void putInteger(String key, int value) { - attributes.put(key, value); - } - - @API - void putString(String key, String value) { - attributes.put(key, value); - } - - @API - void putBoolean(String key, boolean value) { - attributes.put(key, value); - } - - @API - void putTextData(String data) { - textData = data; - } - - private boolean isLocalMemento(IMemento memento) { - return (memento != null) && Proxy.isProxyClass(memento.getClass()) && ((Proxy.getInvocationHandler(memento) instanceof LocalMemento)); - } - - @API - void putMemento(IMemento memento) { - if (!isLocalMemento(memento)) { - throw new IllegalArgumentException("memento is not a local memento"); //$NON-NLS-1$ - } - children.add(memento); - } - - @Override - @API(owner = Object.class) - public String toString() { - StringBuilder result = new StringBuilder(); - - append(result, 0); - - return result.toString(); - } - - private void append(StringBuilder buf, int depth) { - // Indent - for (int i = 0; i < depth; i++) { - buf.append(" "); //$NON-NLS-1$ - } - - buf.append("LocalMemento(");//$NON-NLS-1$ - buf.append(type); - if (id != null) { - buf.append('[').append(id).append(']'); - } - buf.append(") ").append(attributes); //$NON-NLS-1$ - buf.append('\n'); - - final int nextDepth = depth + 1; - for (IMemento next : children) { - ((LocalMemento) Proxy.getInvocationHandler(next)).append(buf, nextDepth); - } - } - - private static Map createDelegates() { - Map result = new HashMap(); - - for (Method implementation : LocalMemento.class.getDeclaredMethods()) { - if (implementation.isAnnotationPresent(API.class)) { - try { - Method api = implementation.getAnnotation(API.class).owner().getMethod(implementation.getName(), implementation.getParameterTypes()); - result.put(api, implementation); - } catch (NoSuchMethodException e) { - throw new LinkageError("Incompatible IMemento API change: " + implementation.getName()); - } - } - } - - return result; - } - - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - private @interface API { - - Class owner() default IMemento.class; - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/SelectionHelper.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/SelectionHelper.java deleted file mode 100644 index defd22c6814..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/SelectionHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 CEA LIST 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.tools.util; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * @author VL222926 - * - */ -public class SelectionHelper { - - /** - * Constructor. - * - */ - private SelectionHelper() { - // to avoid instanciation - } - - /** - * - * @return - * the selection service or null if not found - * - */ - public static final ISelectionService getSelectionService() { - IWorkbench wb = PlatformUI.getWorkbench(); - if (wb != null) { - // don't work - // ISelectionService s1 = (ISelectionService) wb.getService(ISelectionService.class); - IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); - if (ww != null) { - return (ISelectionService) ww.getService(ISelectionService.class); - } - } - return null; - } - - /** - * - * @return - * the current selection or an empty selection. can't be null - */ - public static final ISelection getCurrentSelection() { - ISelectionService selectionService = getSelectionService(); - if (selectionService != null) { - ISelection currentSelection = selectionService.getSelection(); - if (currentSelection != null) { - return currentSelection; - } - } - return StructuredSelection.EMPTY; - } - - /** - * - * @param viewId - * the id of the view for which we want the selection - * @return - * the current selection for the view, the returned value can't be null - */ - public static final ISelection getCurrentSelection(String viewId) { - ISelectionService selectionService = getSelectionService(); - if (selectionService != null) { - ISelection currentSelection = selectionService.getSelection(viewId); - if (currentSelection != null) { - return currentSelection; - } - } - return StructuredSelection.EMPTY; - } - - /** - * - * @return - * a structured selection. - * the returned value can't be null - */ - public static final IStructuredSelection getCurrentStructuredSelection() { - ISelection selection = getCurrentSelection(); - if (selection instanceof IStructuredSelection) { - return (IStructuredSelection) selection; - } - return StructuredSelection.EMPTY; - } - - /** - * - * @param viewId - * the id of the view for which we want the selection - * @return - * the current selection for the view, the returned value can't be null - */ - public static final IStructuredSelection getCurrentStructuredSelection(String viewId) { - ISelection selection = getCurrentSelection(viewId); - if (selection instanceof IStructuredSelection) { - return (IStructuredSelection) selection; - } - return StructuredSelection.EMPTY; - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/UIUtil.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/UIUtil.java deleted file mode 100644 index 3c6823a4528..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/UIUtil.java +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2014 CEA, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * Christian W. Damus - bug 399859 - * Christian W. Damus - bug 451557 - * - */ -package org.eclipse.papyrus.infra.tools.util; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.concurrent.AbstractExecutorService; -import java.util.concurrent.Callable; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.core.databinding.observable.Realm; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.emf.common.util.AbstractTreeIterator; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IMemento; - -import com.google.common.collect.Iterators; - - -/** - * Miscellaneous general-purpose UI utilities. - */ -public class UIUtil { - - /** - * Not instantiable by clients. - */ - private UIUtil() { - super(); - } - - /** - * Create an executor that runs tasks asynchronously on the UI thread. If you need synchronous execution, schedule {@link Future}s and {@linkplain Future#get() wait} for them. - * - * @param display - * the display on which thread to execute tasks - * - * @return the executor - */ - public static ExecutorService createUIExecutor(Display display) { - return new DisplayExecutorService(display); - } - - /** - * Create an executor that runs tasks asynchronously on an observable {@link Realm}. If you need synchronous execution, schedule {@link Future}s and {@linkplain Future#get() wait} for them. - * - * @param realm - * the observable realm on which thread to execute tasks - * - * @return the executor - */ - public static ExecutorService createObservableExecutor(Realm realm) { - return new RealmExecutorService(realm); - } - - /** - * Creates a local memento that is not persistable and is not based on an XML document. This is useful for capturing the - * state of UI elements locally in cases where persistence of the memento is not required. - * - * @return the memento - */ - public static IMemento createLocalMemento() { - return LocalMemento.createMemento("__anonymous__", null); //$NON-NLS-1$ - } - - /** - * Synchronously invokes a {@code callable} on the given {@code display}'s thread. - * - * @param display - * a display - * @param callable - * a callable to invoke - * @return the callable's result (which, because this method is synchronous, will be ready) - * - * @see #asyncCall(Display, Callable) - * @see #createUIExecutor(Display) - */ - public static Future syncCall(Display display, Callable callable) { - final FutureTask result = new FutureTask(callable); - display.syncExec(result); - return result; - } - - /** - * Synchronously invokes a {@code callable} on the default display thread. - * - * @param callable - * a callable to invoke - * @return the callable's result (which, because this method is synchronous, will be ready) - * - * @see #syncCall(Display, Callable) - * @see #asyncCall(Callable) - * @see #createUIExecutor(Display) - */ - public static Future syncCall(Callable callable) { - return syncCall(Display.getDefault(), callable); - } - - /** - * Asynchronously invokes a {@code callable} on the given {@code display}'s thread. - * - * @param display - * a display - * @param callable - * a callable to invoke - * @return the callable's result - * - * @see #syncCall(Display, Callable) - * @see #createUIExecutor(Display) - */ - public static Future asyncCall(Display display, Callable callable) { - final FutureTask result = new FutureTask(callable); - display.asyncExec(result); - return result; - } - - /** - * Asynchronously invokes a {@code callable} on the default display thread. - * - * @param callable - * a callable to invoke - * @return the callable's result - * - * @see #asyncCall(Display, Callable) - * @see #syncCall(Callable) - * @see #createUIExecutor(Display) - */ - public static Future asyncCall(Callable callable) { - return asyncCall(Display.getDefault(), callable); - } - - /** - * Calls a {@code callable} in the given {@code context}. - * - * @param fork - * {@code true} if the runnable should be run in a separate thread, - * and {@code false} to run in the same thread - * @param cancelable - * {@code true} to enable the cancellation, and {@code false} to make the operation uncancellable - * @param runnable - * the runnable to run - * - * @exception InvocationTargetException - * wraps any exception or error which occurs - * while running the runnable - * @exception InterruptedException - * propagated by the context if the runnable - * acknowledges cancellation by throwing this exception. This should not be thrown - * if {@code cancelable} is {@code false}. - */ - public static V call(IRunnableContext context, boolean fork, boolean cancelable, ICallableWithProgress callable) throws InvocationTargetException, InterruptedException { - class RunnableWrapper implements IRunnableWithProgress { - final ICallableWithProgress delegate; - - V result; - - RunnableWrapper(ICallableWithProgress delegate) { - this.delegate = delegate; - } - - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - result = delegate.call(monitor); - } - } - - RunnableWrapper wrapper = new RunnableWrapper(callable); - context.run(fork, cancelable, wrapper); - return wrapper.result; - } - - /** - * Obtains a simple executor that asynchronously executes at most one task on the default - * display thread. While any task is still pending execution on this executor, - * all others are silently discarded. This is useful for cases where, for example, UI - * refreshes are posted repeatedly from independent events that aren't aware of each other - * but where each refresh task would repeat the same work. - * - * @param display - * a display on which thread to execute tasks - * - * @return the executor - * - * @see #createAsyncOnceExecutor(Display) - */ - public static Executor createAsyncOnceExecutor() { - return createAsyncOnceExecutor(Display.getDefault()); - } - - /** - * Obtains a simple executor that asynchronously executes at most one task on the given {@code display}'s thread. While any task is still pending execution on this executor, - * all others are silently discarded. This is useful for cases where, for example, UI - * refreshes are posted repeatedly from independent events that aren't aware of each other - * but where each refresh task would repeat the same work. - * - * @param display - * a display on which thread to execute tasks - * - * @return the executor - */ - public static Executor createAsyncOnceExecutor(final Display display) { - return new Executor() { - private final AtomicBoolean pending = new AtomicBoolean(); - - public void execute(final Runnable task) { - if (pending.compareAndSet(false, true)) { - display.asyncExec(new Runnable() { - - public void run() { - pending.set(false); - task.run(); - } - }); - } - } - }; - } - - /** - * Obtains a tree iterator over all of the controls contained within a given {@code root} control, not including that {@code root}. - * - * @param root - * a control to iterate - * @return an unmodifiable iterator over all of its nested controls, which naturally will be empty if the {@code root} is not a {@link Composite} - */ - public static TreeIterator allChildren(Control root) { - return new AbstractTreeIterator(root, false) { - private static final long serialVersionUID = 1L; - - @Override - protected Iterator getChildren(Object object) { - return (object instanceof Composite) ? Iterators.forArray(((Composite) object).getChildren()) : Iterators. emptyIterator(); - } - }; - } - - /** - * Obtains a tree iterator over all of the controls of a particular type contained within a given {@code root} control, not including that {@code root}. - * - * @param root - * a control to iterate - * @param type - * the type of children to include in the iteration - * - * @return an unmodifiable iterator over all of its nested controls, which naturally will be empty if the {@code root} is not a {@link Composite} - */ - public static TreeIterator allChildren(Control root, final Class type) { - return Iterators2.filter(allChildren(root), type); - } - - // - // Nested types - // - - private static abstract class UIExecutorService extends AbstractExecutorService { - - private final Lock lock = new ReentrantLock(); - - private final Condition emptyCond = lock.newCondition(); - - private final Queue pending = new LinkedList(); - - private volatile boolean shutdown; - - UIExecutorService() { - super(); - } - - public void execute(Runnable command) { - if (isShutdown()) { - throw new RejectedExecutionException("Executor service is shut down"); //$NON-NLS-1$ - } - - asyncExec(enqueue(command)); - } - - abstract void asyncExec(Runnable runnable); - - public List shutdownNow() { - List result = new ArrayList(); - - shutdown(); - - for (Runnable dequeued = dequeue(); dequeued != null; dequeued = dequeue()) { - result.add(dequeued); - } - - return result; - } - - private RunnableWrapper enqueue(Runnable task) { - RunnableWrapper result = new RunnableWrapper(task); - - lock.lock(); - try { - boolean wasEmpty = pending.isEmpty(); - pending.offer(result); - if (wasEmpty) { - // Now not empty - emptyCond.signalAll(); - } - } finally { - lock.unlock(); - } - - return result; - } - - private RunnableWrapper dequeue() { - RunnableWrapper result = null; - - lock.lock(); - try { - result = pending.poll(); - if (result == null) { - // Now empty - emptyCond.signalAll(); - } - } finally { - lock.unlock(); - } - - return result; - } - - boolean dequeue(RunnableWrapper task) { - boolean result = false; - - lock.lock(); - try { - result = pending.remove(task); - if (result && pending.isEmpty()) { - // Now empty - emptyCond.signalAll(); - } - } finally { - lock.unlock(); - } - - return result; - } - - public void shutdown() { - shutdown = true; - } - - public boolean isTerminated() { - lock.lock(); - try { - return isShutdown() && pending.isEmpty(); - } finally { - lock.unlock(); - } - } - - public boolean isShutdown() { - return shutdown; - } - - public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { - if (timeout < 0L) { - throw new IllegalArgumentException("negative timeout"); //$NON-NLS-1$ - } - - final Date deadline = (timeout == 0L) ? null : new Date(System.currentTimeMillis() + unit.toMillis(timeout)); - boolean result = false; - - lock.lock(); - try { - boolean stillWaiting = true; - for (result = isTerminated(); !result && stillWaiting; result = isTerminated()) { - if (deadline == null) { - emptyCond.await(); - } else { - stillWaiting = emptyCond.awaitUntil(deadline); - } - } - } finally { - lock.unlock(); - } - - return result; - } - - // - // Nested types - // - - private class RunnableWrapper implements Runnable { - - private final Runnable delegate; - - RunnableWrapper(Runnable delegate) { - this.delegate = delegate; - } - - public void run() { - // Don't run if I was cancelled by shutdown - if (dequeue(this)) { - delegate.run(); - } - } - } - }; - - private static class DisplayExecutorService extends UIExecutorService { - private final Display display; - - DisplayExecutorService(Display display) { - super(); - - this.display = display; - } - - @Override - void asyncExec(Runnable runnable) { - display.asyncExec(runnable); - } - } - - private static class RealmExecutorService extends UIExecutorService { - private final Realm realm; - - RealmExecutorService(Realm realm) { - super(); - - this.realm = realm; - } - - @Override - void asyncExec(Runnable runnable) { - realm.asyncExec(runnable); - } - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/WorkbenchPartHelper.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/WorkbenchPartHelper.java deleted file mode 100644 index 2ed1bbbbb9f..00000000000 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/WorkbenchPartHelper.java +++ /dev/null @@ -1,71 +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: - * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.tools.util; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * - * a helper for the Eclipse workbench part - * - */ -public class WorkbenchPartHelper { - - private WorkbenchPartHelper() { - // nothing to do - } - - /** - * - * @return - * the current IWorkbenchPart or null if not found - */ - public static final IWorkbenchPart getCurrentActiveWorkbenchPart() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); - if (activeWorkbench != null) { - final IWorkbenchPage activePage = activeWorkbench.getActivePage(); - if (activePage != null) { - return activePage.getActivePart(); - } - } - } - return null; - } - - /** - * - * @return - * the current IEditorPart or null if not found - */ - public static final IEditorPart getCurrentActiveEditorPart() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); - if (activeWorkbench != null) { - final IWorkbenchPage activePage = activeWorkbench.getActivePage(); - if (activePage != null) { - return activePage.getActiveEditor(); - } - } - } - return null; - } -} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui.resources/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/META-INF/MANIFEST.MF index 0527924d3bd..28133fde488 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui.resources/META-INF/MANIFEST.MF +++ b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - com.google.guava;bundle-version="11.0.0" + com.google.guava;bundle-version="11.0.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/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/DirtyEditorChange.java b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/DirtyEditorChange.java index 60d11329ccb..210e6cca717 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/DirtyEditorChange.java +++ b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/DirtyEditorChange.java @@ -20,8 +20,8 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.swt.widgets.Display; diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/RenameModelChange.java b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/RenameModelChange.java index f4f3ed6ae18..423ca667e16 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/RenameModelChange.java +++ b/plugins/infra/org.eclipse.papyrus.infra.ui.resources/src/org/eclipse/papyrus/infra/ui/resources/refactoring/RenameModelChange.java @@ -53,7 +53,6 @@ import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.modelsetquery.IModelSetQueryAdapter; import org.eclipse.papyrus.infra.core.modelsetquery.ModelSetQuery; import org.eclipse.papyrus.infra.core.resource.ModelSet; @@ -63,13 +62,14 @@ import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; import org.eclipse.papyrus.infra.services.controlmode.mm.history.ControledResource; import org.eclipse.papyrus.infra.services.controlmode.mm.history.historyPackage; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.ui.resources.Activator; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.part.FileEditorInput; diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/.classpath b/plugins/infra/org.eclipse.papyrus.infra.ui/.classpath index 098194ca4b7..eca7bdba8f0 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/.classpath +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/org.eclipse.papyrus.infra.ui/.settings/org.eclipse.jdt.core.prefs index 9ca8e68231b..62a08f4494d 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,10 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF index d49f783633d..b6b0ad24536 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF @@ -1,18 +1,45 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.ui, - org.eclipse.papyrus.infra.ui.menu + org.eclipse.papyrus.infra.ui.contentoutline, + org.eclipse.papyrus.infra.ui.converter, + org.eclipse.papyrus.infra.ui.dnd, + org.eclipse.papyrus.infra.ui.editor, + org.eclipse.papyrus.infra.ui.editor.reload, + org.eclipse.papyrus.infra.ui.editorsfactory, + org.eclipse.papyrus.infra.ui.extension.commands, + org.eclipse.papyrus.infra.ui.extension.diagrameditor, + org.eclipse.papyrus.infra.ui.internal.commands;x-internal:=true, + org.eclipse.papyrus.infra.ui.internal.preferences;x-internal:=true, + org.eclipse.papyrus.infra.ui.lifecycleevents, + org.eclipse.papyrus.infra.ui.menu, + org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor, + org.eclipse.papyrus.infra.ui.preferences, + org.eclipse.papyrus.infra.ui.preferences.dialog, + org.eclipse.papyrus.infra.ui.services, + org.eclipse.papyrus.infra.ui.services.internal;x-internal:=true, + org.eclipse.papyrus.infra.ui.util Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Bundle-Name: %pluginName Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.ui;bundle-version="3.107.0", org.eclipse.core.runtime;bundle-version="3.10.0", org.eclipse.core.expressions;bundle-version="3.4.600", org.eclipse.emf.ecore, - org.eclipse.emf.transaction + org.eclipse.emf.transaction, + com.google.guava;bundle-version="11.0.0", + org.eclipse.core.databinding;bundle-version="1.6.0", + org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", + org.eclipse.ui.ide;bundle-version="3.12.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0", + org.eclipse.emf.edit.ui;bundle-version="2.12.0", + org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0", + org.eclipse.ui.views.properties.tabbed;bundle-version="3.7.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier Eclipse-BuddyPolicy: dependent diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/build.properties b/plugins/infra/org.eclipse.papyrus.infra.ui/build.properties index d1e73b0471a..0129c1a0b6a 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/build.properties +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/build.properties @@ -4,5 +4,7 @@ bin.includes = plugin.xml,\ META-INF/,\ .,\ about.html,\ - plugin.properties + plugin.properties,\ + icons/,\ + schema/ src.includes = about.html diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/PapyrusLogo32x32.png b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/PapyrusLogo32x32.png new file mode 100644 index 00000000000..57e441b344c Binary files /dev/null and b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/PapyrusLogo32x32.png differ diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/Papyrus_32x32_t.gif b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/Papyrus_32x32_t.gif new file mode 100644 index 00000000000..50cd9a142ee Binary files /dev/null and b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/32x32/Papyrus_32x32_t.gif differ diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus.gif b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus.gif new file mode 100644 index 00000000000..8a31f458379 Binary files /dev/null and b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus.gif differ diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus_16x16.gif b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus_16x16.gif new file mode 100644 index 00000000000..8a31f458379 Binary files /dev/null and b/plugins/infra/org.eclipse.papyrus.infra.ui/icons/papyrus/Papyrus_16x16.gif differ diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.properties b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.properties index 76d4e448199..31d899f9131 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.properties +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.properties @@ -1,2 +1,13 @@ -pluginName=Papyrus Generic menus/commands +# +# Copyright (c) 2015, 2015 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# CEA LIST - initial API and implementation +# Christian W. Damus - bug 485220 +# +pluginName=Papyrus Infrastructure Base UI providerName=Eclipse Modeling Project diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml index 6eb3e1f4e3a..c61a524a867 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml @@ -8,6 +8,9 @@ $Id$ --> + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/schema/contentOutline.exsd b/plugins/infra/org.eclipse.papyrus.infra.ui/schema/contentOutline.exsd new file mode 100644 index 00000000000..0b84e1af92c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/schema/contentOutline.exsd @@ -0,0 +1,144 @@ + + + + + + + + + Specify the content outline to be used by the Papyrus backbone. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A human readable description. + + + + + + + The class implementing the contentOutline. +Class must extends org.eclipse.papyrus.ui.core.contentoutline.IPapyrusContentOutlinePage. + + + + + + + + + + An integer value representing the priority of the contentOutline. +Only one contentOutline is shown. The one with the highest priority is choosen. + + + + + + + ID of the ActionBarContributor requested by the outline. +The ID must match a declared ActionBarContributor. +If no ID is set, use the main ActionBarContributor (the one associated to the MultiEditor). + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + /******************************************************************************* + * Copyright (c) 2008 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: + * CEA List - initial API and implementation + *******************************************************************************/ + + + + diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/schema/papyrusDiagram.exsd b/plugins/infra/org.eclipse.papyrus.infra.ui/schema/papyrusDiagram.exsd new file mode 100644 index 00000000000..241fe0c27f1 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/schema/papyrusDiagram.exsd @@ -0,0 +1,342 @@ + + + + + + + + + <p> +The <code>org.eclipse.papyrus.infra.ui.papyrusDiagram</code> extension point is used to register a new diagram editor within Papyrus. Once diagram editor is registered it can be used in the Papyrus multi-page diagram editor. The editor can have its own icon, label, a button for the creation action in the toolbar, and the possibility to be created using new Papyrus Model wizard. +</p> + +<p>Papyrus uses the term "<b>Diagram Category</b>" to categorize domain models and the term "<b>Diagram Kind</b>" to specialize a diagram editor for a domain model. Each Diagram Kind belongs to exactly one Diagram Category, Diagram Category can contains many Diagram Kinds. Papyrus supports <b>UML</b>, <b>Profile</b> and <b>SysML</b> diagram categories. +</p> + +<p>Besides, for a given diagram category the user can specify template models - a predefined model whose content is copied into a newly created diagram. Templates can be registered using <code>org.eclipse.papyrus.wizards.templates</code> extension point. Diagram kinds and available templates are filtered in the wizard in accordance with the chosen category. For example, if the user choses <i>Profile</i> category, then only Profile diagram kind are available on DiagramKindPage and only ProfileWithBasicTypes template is displayed in the list of available templates. +</p> + +<p>The user is free to use the already existing diagram categories as well as implement his own. +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A diagram editor that can be used in the Papyrus multi-page diagram editor. + + + + + + + a name of the fully qualified class that implements <samp> org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory</samp>. It is used to create an instance of the editor. + + + + + + + + + + The ID of an ActionBarContributor. If no ID is set, the main ActionBarContributor is used (the one associated to the MultiEditor). + + + + + + + a relative path of an icon used to visually represent the diagram in outline tree. The path is relative to the location of the plugin.xml file of the contributing plug-in. + + + + + + + + + + The order of this factory. The order is used when several factories can handle the same element. An order of 0 is a very high priority, whereas an order of 50 is lower. Factories with a higher order (lower priority) can still be used e.g. via the Open with... menu + + + + + + + + + + A ActionBarContributor defines the actions for one or more editors or Views. + + + + + + + a unique identifier used as a reference for this ActionBarContributor. It is used to associate the ActionBarContributor to editors(see <code>actionBarContributorId</code> attribute of <code>editorDiagram</code> extension point) + + + + + + + a name of the fully qualified class that implements <samp>org.eclipse.ui.IEditorActionBarContributor</samp>. + + + + + + + + + + + + + A "creationCommand" is a command used to create a new diagram. + + + + + + + a unique identifier used as a reference for this creation command. + + + + + + + + + + a translatable name of the creation command. It is displayed in the toolbar as a button text of CreateDiagramAction, this label is also i the New Wizard while selecting the Diagram Kind. + + + + + + + a name of the fully qualified class that implements <samp>org.eclipse.papyrus.commands.ICreationCommand</samp>. + + + + + + + + + + a relative path of an icon used to visually represent the command. The path is relative to the location of the plugin.xml file of the contributing plug-in. + + + + + + + + + + the action in the diagram creation menu is disabled if this condition is evaluated to false. + + + + + + + + + + the id of a diagramCategory the creation command belongs to. + + + + + + + + + + + + + The category of a domain model. The registered category is available in New papyrus Model Wizard and it customizes creation of a domain model. It is also used to filter diagram kinds and model templates. + + + + + + + a unique identifier used as a reference for this diagram category. It is used to filter model templates and diagram kinds. + + + + + + + a name of the fully qualified class that implements <samp>org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand</samp>. + + + + + + + + + + the file extension. + + + + + + + a translatable name of the diagram category, it is displayed in the New Papyrus Model Wizard to select a Diagram Category. + + + + + + + a description of the diagram category is to be displayed as a tooltip next ti its label. + + + + + + + a relative path of an icon used to visually represent the diagram category. The path is relative to the location of the plugin.xml file of the contributing plug-in. + + + + + + + + + + + + + + + 0.7 + + + + + + + + + <pre> +<extension point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + <diagramCategory + id="sysml" + class="org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand" + label="SysML" + description="SysML diagrams" + icon="icons/category_sysml.gif"> + </diagramCategory> + + <editorDiagram + actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor" + factoryClass="org.eclipse.papyrus.sysml.diagram.requirement.RequirementDiagramEditorFactory" + icon="icons/obj16/Diagram_Requirement.gif"> + </editorDiagram> + + <creationCommand + id="org.eclipse.papyrus.sysml.diagram.requirement.CreateCommand" + creationCommandClass="org.eclipse.papyrus.sysml.diagram.requirement.RequirementDiagramCreateCommand" + icon="icons/obj16/Diagram_Requirement.gif" + label="SysML Requirement Diagram" + language="sysml"> + </creationCommand> +</extension> +</pre> +In this example, a specific editor for SysML Requirement diagram is registered. +Besides, a diagram category for SysML diagrams is defined, it has <code>sysml</code> id. The category specifies a customized creation command <code>org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand</code> which applies a profile to the newly-created model. In this example, the category <code>sysml</code> containes only one diagram kind - Requirement diagram created with <code>org.eclipse.papyrus.sysml.diagram.requirement.CreateCommand</code>, but it can be used by other diagrams as well. +As Requirement diagram belongs to SysML category it will be created with a SysML profile applied to its root. + + + + + + + + + <p>The value of the <code>class</code> attribute of <code>diagramCategory</code> must represent a class that implements the <code>org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand</code> interface. There are a few default implementations of <code>IModelCreationCommand</code> that may be useful to users of this extension point: +<ul> +<li><code>org.eclipse.papyrus.commands.ModelCreationCommandBase</code> - an abstract implementation of a basic <code>IModelCreationCommand</code>.</li> +<li><code>org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand</code></li> - implementation of IModelCreationCommand that creates a UML model. +<li><code>org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand</code> - a subclass of CreateUMLModelCommand which creates Profile as a root element</li> +<li><code>org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand</code> - a subclass of CreateUMLModelCommand which applies SysML profile to the root element</li> +</ul> +</p> + +<p>The value of the <code>creationCommandClass</code> attribute of <code>creationCommand</code> + must represent a class that implements the <code>org.eclipse.papyrus.commands.ICreationCommand</code> interface. +<ul> +<li><code>org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler</code> - an abstract implementation of a basic <code>ICreationCommand</code> for GMF diagrams. All CreationCommands for Papyrus diagrams extend this class.</li> +</ul> +</p> + + + + + + + + + + Copyright (c) 2008, 2010 CEA List.<br> +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 <a +href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> + + + + diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/Activator.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/Activator.java index 27101698e64..730eea20ada 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/Activator.java +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/Activator.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2011 CEA LIST. + * Copyright (c) 2011, 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,12 +8,22 @@ * * Contributors: * Francois Le Fevre (CEA LIST) francois.le-fevre@cea.fr - Initial API and implementation + * Christian W. Damus = bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.infra.ui; import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.core.services.spi.IContextualServiceRegistryTracker; +import org.eclipse.papyrus.infra.tools.spi.IExecutorServiceFactory; +import org.eclipse.papyrus.infra.ui.util.UIUtil; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorPart; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; /** * The activator class controls the plug-in life cycle @@ -33,31 +43,46 @@ public class Activator extends AbstractUIPlugin { */ public static LogHelper log; + private ServiceRegistration executorFactoryReg; + private ServiceRegistration serviceRegistryTrackerReg; + /** * The constructor */ public Activator() { } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; log = new LogHelper(this); + + IExecutorServiceFactory executorFactory = () -> UIUtil.createUIExecutor(Display.getDefault()); + executorFactoryReg = context.registerService(IExecutorServiceFactory.class, executorFactory, null); + + IContextualServiceRegistryTracker serviceRegistryTracker = () -> { + ServicesRegistry result = null; + IEditorPart editor = WorkbenchPartHelper.getCurrentActiveEditorPart(); + if (editor != null) { + result = editor.getAdapter(ServicesRegistry.class); + } + return result; + }; + serviceRegistryTrackerReg = context.registerService(IContextualServiceRegistryTracker.class, serviceRegistryTracker, null); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ @Override public void stop(BundleContext context) throws Exception { + if (serviceRegistryTrackerReg != null) { + serviceRegistryTrackerReg.unregister(); + serviceRegistryTrackerReg = null; + } + if (executorFactoryReg != null) { + executorFactoryReg.unregister(); + executorFactoryReg = null; + } + plugin = null; super.stop(context); } diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/ContentOutlineRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/ContentOutlineRegistry.java new file mode 100644 index 00000000000..1fb84925184 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/ContentOutlineRegistry.java @@ -0,0 +1,263 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.contentoutline; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.extension.BadClassNameException; +import org.eclipse.papyrus.infra.core.extension.NotFoundException; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.EditorDescriptorExtensionFactory; +import org.osgi.framework.Bundle; + +public class ContentOutlineRegistry { + + /** ID of the editor extension (schema filename) */ + public static final String EDITOR_EXTENSION_ID = "papyrusContentOutline"; + + private static String classAttributeName = "class"; + + private static String actionBarContributorIdPropertyName = "actionBarContributorId"; + + /** Namespace where to look for the extension points. */ + protected String extensionPointNamespace; + + /** + * The selected content outline. + */ + protected IPapyrusContentOutlinePage contentOutline; + + /** + * Associated editor. + */ + private IMultiDiagramEditor multiEditor; + + /** + * Constructor. defaultContext, input and site are explicitly required in + * order be sure that they are initialized. The multiEditor should be + * initialized. In particular, getEditorSite(), getEditorInput() and + * getDefaultContext() should return initialized values. + * + * @param multiEditor + * @param defaultContext + * @param input + * @param site + * @param extensionPointNamespace + */ + public ContentOutlineRegistry(IMultiDiagramEditor multiEditor, String extensionPointNamespace) { + this.multiEditor = multiEditor; + this.extensionPointNamespace = extensionPointNamespace; + } + + /** + * Returns the single instance of the content outline. Creates one if + * necessary. + * + * @return the contentOutline the single instance of the content outline + * @throws BackboneException + * exception thrown when the outline can not be created. + */ + public IPapyrusContentOutlinePage getContentOutline() throws BackboneException { + if (contentOutline == null) { + createContentOutline(); + } + return contentOutline; + } + + /** + * Return the {@link ContentOutlineDescriptor} with the highest priority. + * + * @return + * @throws BackboneException + * @throws NotFoundException + * If no ContentOutline can be found in extensions + */ + private ContentOutlineDescriptor getContentOutlineDescriptor() throws BackboneException { + IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); + ContentOutlineDescriptor found = null; + + // look for the one with the highest priority + for (IConfigurationElement ele : configElements) { + ContentOutlineDescriptor desc = new ContentOutlineDescriptor(ele); + if (desc.isHigher(found)) { + found = desc; + } + } + + // Instanciate the object + if (found == null) { + throw new NotFoundException("No ContentOutline registered."); //$NON-NLS-1$ + } + + return found; + + } + + /** + * Creates the content outline from the selected extension. + * + * @throws BackboneException + * exception thrown when the outline can not be created. + */ + private void createContentOutline() throws BackboneException { + + ContentOutlineDescriptor found = getContentOutlineDescriptor(); + // Instanciate the object + if (found != null) { + contentOutline = found.createContentOutlinePage(); + } + } + + /** + * Inner Descriptor for content outline. This class load data from Eclipse + * extension mechanism TODO Change the parent class. It is here just to have + * quick code. + */ + protected class ContentOutlineDescriptor extends EditorDescriptorExtensionFactory { + + private int priority; + + private String className; + + private String actionBarContributorID; + + private IConfigurationElement element; + + /** + * Instance is created when requested. + */ + protected IPapyrusContentOutlinePage instance = null; + + /** + * Create a descriptor backuped by the config element. + */ + protected ContentOutlineDescriptor(IConfigurationElement element) throws BackboneException { + String tagName = "contentoutline"; + checkTagName(element, tagName); + this.className = element.getAttribute(classAttributeName); + this.actionBarContributorID = element.getAttribute(actionBarContributorIdPropertyName); + try { + this.priority = Integer.parseInt(element.getAttribute("priority")); + } catch (NumberFormatException e) { + this.priority = 0; + } + + this.element = element; + // check parameters + if (className == null) { + throw new BadClassNameException("Class name must be set", "contentoutline", classAttributeName); //$NON-NLS-1$ //$NON-NLS-2$ + } + + } + + /** + * Compare priority. The highest priority win. + */ + public boolean isHigher(ContentOutlineDescriptor found) { + if (found == null) { + return true; + } + return this.getPriority() > found.getPriority(); + } + + /** + * Return the higher value of the descriptor. This value is used to + * order the contentOutline. The highest priority win. + */ + private int getPriority() { + return priority; + } + + /** + * @return the actionBarContributorID + */ + public String getActionBarContributorID() { + return actionBarContributorID; + } + + /** + * Returns the content outline page instance (lazy initialization) + * + * @return the context outline page + * @throws BackboneException + * exception thrown when a problem occurs. + */ + protected IPapyrusContentOutlinePage getContentOutline() throws BackboneException { + if (instance == null) { + instance = createContentOutlinePage(); + } + return instance; + } + + /** + * Create the class corresponding to the class attribute. + */ + private Class loadClass() throws BadClassNameException { + if (className == null || className.length() == 0) { + throw new BadClassNameException("Classname should be set.", "contentoutline", classAttributeName); //$NON-NLS-1$ //$NON-NLS-2$ + } + Class factoryClass; + try { + factoryClass = (Class) Class.forName(className); + } catch (ClassNotFoundException e) { + // try another way + try { + String declaringID = element.getContributor().getName(); + Bundle bundle = Platform.getBundle(declaringID); + factoryClass = (Class) bundle.loadClass(className); + } catch (ClassNotFoundException e1) { + throw new BadClassNameException("", "contentoutline", classAttributeName, e1); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + return factoryClass; + } + + /** + * create the outlinepage by calling constructor without parameter and + * then call init method + * + * @return the outline. + * @throws BackboneException + */ + protected IPapyrusContentOutlinePage createContentOutlinePage() throws BackboneException { + if (false) { + System.out.println("Not yet"); // FIXME : no syso + return null; + } + try { + IPapyrusContentOutlinePage outline = loadClass().newInstance(); + outline.init(multiEditor); + return outline; + + } catch (SecurityException e) { + // Lets propagate. This is an implementation problem that should + // be solved by programmer. + throw new RuntimeException(e); + } + + catch (InstantiationException e) { + // Lets propagate. This is an implementation problem that should + // be solved by programmer. + // throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // Lets propagate. This is an implementation problem that should + // be solved by programmer. + throw new RuntimeException(e); + } + return null; + } + + } // end class +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/IPapyrusContentOutlinePage.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/IPapyrusContentOutlinePage.java new file mode 100644 index 00000000000..15116aa267b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/IPapyrusContentOutlinePage.java @@ -0,0 +1,34 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.contentoutline; + +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; + +/** + * Extends the original interface to add the init method. + */ +public interface IPapyrusContentOutlinePage extends org.eclipse.ui.views.contentoutline.IContentOutlinePage { + + /** + * Init the content outline. + * + * @param multiEditor + * the multiEditor is used to access to the context + * @throws BackboneException + * during research of the associated context. + */ + void init(IMultiDiagramEditor multiEditor) throws BackboneException; + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePage.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePage.java new file mode 100644 index 00000000000..4cf52a66930 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePage.java @@ -0,0 +1,1098 @@ +/***************************************************************************** + * Copyright (c) 2013, 2014 CEA LIST and other. + * + * 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: + * Remi Schnekenburger (CEA LIST) - Initial API and implementation + * Christian W. Damus (CEA) - bug 437217 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.contentoutline; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.papyrus.infra.core.Activator; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageLifeCycleEventsListener; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; +import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener; +import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.SubActionBars; +import org.eclipse.ui.part.IPageBookViewPage; +import org.eclipse.ui.part.IPageSite; +import org.eclipse.ui.part.Page; +import org.eclipse.ui.part.PageBook; +import org.eclipse.ui.part.PageSite; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import com.google.common.collect.Lists; + +/** + * Page for Papyrus outline when active nested editor is a GMF editor + */ +public class NestedEditorDelegatedOutlinePage extends Page implements IPapyrusContentOutlinePage, IPageLifeCycleEventsListener, IEditorReloadListener { + + /** The editor for which I am a slave. */ + private IMultiDiagramEditor multiEditor; + + /** Sash window container to listen for page changes inside the same editor */ + private ISashWindowsContainer sashWindowsContainer; + + /** Page book in which all outline controls of nested editors will be stored and displayed one by one */ + private PageBook sashEditorPageBook; + + /** + * Map from papyrus pages (representing nested editors) to outline page records (key type: org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; + * value type: OutlinePageRec). + */ + private Map mapIPapyrusPageToOutlineRec = new HashMap(); + + /** + * The page rec which provided the current page or null + */ + private OutlinePageRec activeRec; + + /** + * Default page rec that displays a simple message + */ + private OutlinePageRec defaultPageRec; + + /** + * {@inheritDoc} + */ + @Override + public void init(IMultiDiagramEditor multiEditor) { + this.multiEditor = multiEditor; + + internalInit(multiEditor); + + IReloadableEditor.Adapter.getAdapter(multiEditor).addEditorReloadListener(this); + } + + private void internalInit(IMultiDiagramEditor multiEditor) { + sashWindowsContainer = (ISashWindowsContainer) multiEditor.getAdapter(ISashWindowsContainer.class); + sashWindowsContainer.addPageLifeCycleListener(this); + } + + /** + * {@inheritDoc} + */ + @Override + public void init(IPageSite pageSite) { + IViewSite viewSite = getViewSite(pageSite); + + DelegatedPageSite delegatedPageSite = new DelegatedPageSite(viewSite, this); + super.init(delegatedPageSite); + } + + /** + * /** + * The PageBookView implementation of this IWorkbenchPart method cleans up all the pages. Subclasses + * may extend. + */ + @Override + public void dispose() { + if (multiEditor != null) { + IReloadableEditor.Adapter.getAdapter(multiEditor).removeEditorReloadListener(this); + } + + internalDispose(); + + multiEditor = null; + + // Run super. + super.dispose(); + } + + private void internalDispose() { + // Deref all of the pages. + activeRec = null; + if (defaultPageRec != null) { + // check for null since the default page may not have + // been created (ex. perspective never visible) + defaultPageRec.contentOutlinePage.dispose(); + defaultPageRec.dispose(); + defaultPageRec = null; + } + + java.util.List records = new ArrayList(mapIPapyrusPageToOutlineRec.values()); + Iterator itr = records.iterator(); + while (itr.hasNext()) { + OutlinePageRec rec = itr.next(); + removePage(rec); + } + + // remove listener and all refs to editor + sashWindowsContainer.removePageLifeCycleListener(this); + } + + /** + * Refreshes the global actions for the active page. + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected void refreshGlobalActionHandlers() { + // Clear old actions. + IActionBars bars = getSite().getActionBars(); + bars.clearGlobalActionHandlers(); + + // Set new actions. + Map newActionHandlers = ((SubActionBars) activeRec.getPageSite().getActionBars()).getGlobalActionHandlers(); + if (newActionHandlers != null) { + Set keys = newActionHandlers.entrySet(); + Iterator iter = keys.iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + bars.setGlobalActionHandler(entry.getKey(), entry.getValue()); + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public ISelection getSelection() { + // nothing here + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public void setSelection(ISelection selection) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public void createControl(Composite parent) { + sashEditorPageBook = new PageBook(parent, SWT.BORDER); + + createContents(); + } + + protected void createContents() { + // Create the default page rec. + IContentOutlinePage defaultPage = createDefaultPage(sashEditorPageBook); + defaultPageRec = new OutlinePageRec(null, defaultPage); + preparePage(defaultPageRec); + + // Show the initial active page or the default page + IPage activePage = sashWindowsContainer.getActiveSashWindowsPage(); + if (activePage != null) { + OutlinePageRec rec = getOutlinePageRec(activePage); + if (rec == null) { + rec = createPage(activePage); + } + + // Show the page, if it was successfully created + if (rec != null) { + showOutlinePageRec(rec); + } else { + showOutlinePageRec(defaultPageRec); + } + } else { + showOutlinePageRec(defaultPageRec); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Control getControl() { + return sashEditorPageBook; + } + + /** + * {@inheritDoc} + */ + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public void pageChanged(IPage newPage) { + // throw new UnsupportedOperationException("pageChanged not implemented " + newPage); + } + + /** + * {@inheritDoc} + */ + @Override + public void pageOpened(IPage page) { + // Activator.log.debug("Opened"); + // create the new Outline + // Create a page for the part. + OutlinePageRec rec = getOutlinePageRec(page); + if (rec == null) { + rec = createPage(page); + } + + // Show the page, if it was successfully created + if (rec != null) { + showOutlinePageRec(rec); + } else { + showOutlinePageRec(defaultPageRec); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void pageClosed(IPage papyrusPage) { + // Activator.log.debug("Closed"); + // Update the active part. + if (activeRec != null && activeRec.papyrusPage == papyrusPage) { + showOutlinePageRec(defaultPageRec); + } + + // Find and remove the part page. + OutlinePageRec rec = getOutlinePageRec(papyrusPage); + if (rec != null) { + removePage(rec); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void pageActivated(IPage page) { + // Activator.log.debug("Activated"); + // Create a page for the partm, if necessary. + OutlinePageRec rec = getOutlinePageRec(page, true); + + // Show the page, if it was successfully created + if (rec != null) { + showOutlinePageRec(rec); + } else { + showOutlinePageRec(defaultPageRec); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void pageDeactivated(IPage page) { + // throw new UnsupportedOperationException("pageDeactivated not implemented " + page); + } + + /** + * {@inheritDoc} + */ + @Override + public void pageAboutToBeOpened(IPage page) { + // throw new UnsupportedOperationException("pageAboutToBeOpened not implemented "+page); + } + + /** + * {@inheritDoc} + */ + @Override + public void pageAboutToBeClosed(IPage page) { + // throw new UnsupportedOperationException("pageAboutToBeClosed not implemented " + page); + } + + @Override + public void editorAboutToReload(EditorReloadEvent event) { + event.putContext(new OutlineContext()); + + internalDispose(); + } + + @Override + public void editorReloaded(EditorReloadEvent event) { + internalInit(event.getEditor()); + createContents(); + + ((OutlineContext) event.getContext()).restore(); + } + + // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // MAINLY INSPIRED FROM PAGE BOOK VIEW + // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Creates and returns the default page for this view. + * + * @param book + * the pagebook control + * @return the default page + */ + protected IContentOutlinePage createDefaultPage(PageBook book) { + MessageOutlinePage page = new MessageOutlinePage(); + initPage(page); + page.createControl(book); + return page; + } + + /** + * Creates an outline record for a given papyrus Page. Adds it to the pagebook but does not show it. + * + * @param page + * The nested editor we are created an outline. + * @return the created outline page record + */ + protected OutlinePageRec createPage(IPage papyrusPage) { + OutlinePageRec rec = doCreatePage(papyrusPage); + if (rec != null) { + mapIPapyrusPageToOutlineRec.put(papyrusPage, rec); + preparePage(rec); + } + return rec; + } + + /** + * Prepares the page in the given page rec for use in this view. + * + * @param rec + */ + protected void preparePage(OutlinePageRec rec) { + IPageSite site = null; + + if (!doesPageExist(rec.contentOutlinePage)) { + if (rec.contentOutlinePage instanceof IPageBookViewPage) { + site = ((IPageBookViewPage) rec.contentOutlinePage).getSite(); + rec.setPageSite(site); + } + } + } + + /** + * Initializes the given page with a page site. + *

+ * Subclasses should call this method after the page is created but before creating its controls. + *

+ *

+ * Subclasses may override + *

+ * + * @param page + * The page to initialize + */ + protected void initPage(IPageBookViewPage page) { + try { + IPageSite site = super.getSite(); + // try to create a specific page site for this page + page.init(new PageSite(getViewSite(site))); + } catch (PartInitException e) { + Activator.log.error(e); + } + } + + /** + * @param site + * the page site from which parent view site is retrieved + * @return the retrieved page site + */ + protected static IViewSite getViewSite(IPageSite site) { + if (site instanceof IViewSite) { + return ((IViewSite) site); + } + // no way to get the IViewSite from the page site. + if (site instanceof PageSite) { + try { + Field parentSiteField = PageSite.class.getDeclaredField("parentSite"); + parentSiteField.setAccessible(true); + Object parentSite = parentSiteField.get(site); + if (parentSite instanceof IViewSite) { + return ((IViewSite) parentSite); + } + } catch (SecurityException e) { + Activator.log.error(e); + } catch (NoSuchFieldException e) { + Activator.log.error(e); + } catch (IllegalArgumentException e) { + Activator.log.error(e); + } catch (IllegalAccessException e) { + Activator.log.error(e); + } + } + return null; + } + + /* + * (non-Javadoc) + * Method declared on PageBookView. + */ + protected OutlinePageRec doCreatePage(IPage papyrusPage) { + // Try to get an outline page. + if (papyrusPage instanceof IEditorPage) { + IEditorPart part = ((IEditorPage) papyrusPage).getIEditorPart(); + Object obj = getAdapter(part, IContentOutlinePage.class, false); + if (obj instanceof IContentOutlinePage) { + IContentOutlinePage page = (IContentOutlinePage) obj; + if (page instanceof IPageBookViewPage) { + initPage((IPageBookViewPage) page); + } + page.createControl(getPageBook()); + return new OutlinePageRec(papyrusPage, page); + } + } + + // There is no content outline + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public DelegatedPageSite getSite() { + return (DelegatedPageSite) super.getSite(); + } + + /* + * (non-Javadoc) + * Method declared on PageBookView. + */ + protected void doDestroyPage(IPage papyrusPage, OutlinePageRec rec) { + IContentOutlinePage contentOutlinePage = rec.contentOutlinePage; + contentOutlinePage.dispose(); + rec.dispose(); + } + + protected Collection getAllPages() { + return mapIPapyrusPageToOutlineRec.values(); + } + + /** + * Returns true if the page has already been created. + * + * @param page + * the page to test + * @return true if this page has already been created. + */ + protected boolean doesPageExist(IContentOutlinePage page) { + return mapIPapyrusPageToOutlineRec.containsKey(page); + } + + /** + * Returns the papyrus page which contributed the current outline page to this view. + * + * @return the page which contributed the current outline page or null if no part contributed the current page + */ + protected IPage getCurrentContributingPage() { + if (activeRec == null) { + return null; + } + return activeRec.papyrusPage; + } + + /** + * Returns the currently visible outline page for this view or null if no page is currently visible. + * + * @return the currently visible page + */ + public IContentOutlinePage getCurrentOutlinePage() { + if (activeRec == null) { + return null; + } + return activeRec.contentOutlinePage; + } + + /** + * Returns the view site for the given page of this view. + * + * @param page + * the page + * @return the corresponding site, or null if not found + */ + protected IPageSite getPageSite(IPage page) { + OutlinePageRec rec = getOutlinePageRec(page); + if (rec != null) { + return rec.getPageSite(); + } + return null; + } + + /** + * Returns the default page for this view. + * + * @return the default page + */ + public IContentOutlinePage getDefaultOutlinePage() { + return defaultPageRec.contentOutlinePage; + } + + /** + * Returns the pagebook control for this view. + * + * @return the pagebook control, or null if not initialized + */ + protected PageBook getPageBook() { + return sashEditorPageBook; + } + + /** + * Returns the page record for the given part. + * + * @param part + * the part + * @return the corresponding page record, or null if not + * found + */ + protected OutlinePageRec getOutlinePageRec(IPage papyrusPage) { + return mapIPapyrusPageToOutlineRec.get(papyrusPage); + } + + OutlinePageRec getOutlinePageRec(IPage papyrusPage, boolean create) { + OutlinePageRec result = getOutlinePageRec(papyrusPage); + if (result == null) { + result = createPage(papyrusPage); + } + return result; + } + + /** + * Returns the page record for the given page of this view. + * + * @param page + * the page + * @return the corresponding page record, or null if not + * found + */ + protected OutlinePageRec getPageRec(IContentOutlinePage contentOutlinePage) { + Iterator itr = mapIPapyrusPageToOutlineRec.values().iterator(); + while (itr.hasNext()) { + OutlinePageRec rec = itr.next(); + if (rec.contentOutlinePage == contentOutlinePage) { + return rec; + } + } + return null; + } + + /** + * Removes a page record. + * + * @param rec + * the page record to remove + */ + protected void removePage(OutlinePageRec rec) { + mapIPapyrusPageToOutlineRec.remove(rec.papyrusPage); + + Control control = rec.contentOutlinePage.getControl(); + if (control != null && !control.isDisposed()) { + // Dispose the page's control so pages don't have to do this in their dispose method. + // The page's control is a child of this view's control so if this view is closed, the page's control will already be disposed. + control.dispose(); + } + + // Do this before destroying the page, otherwise we won't be able to retrieve the page site (it will be null) + IPageSite site = rec.getPageSite(); + if (site instanceof PageSite) { // test null pointer and PageSite + ((SubActionBars) ((PageSite) site).getActionBars()).deactivate(); + ((SubActionBars) ((PageSite) site).getActionBars()).dispose(); + } + + // Free the page + doDestroyPage(rec.papyrusPage, rec); + } + + /* + * (non-Javadoc) Method declared on IWorkbenchPart. + */ + @Override + public void setFocus() { + // first set focus on the page book, in case the page + // doesn't properly handle setFocus + if (sashEditorPageBook != null) { + sashEditorPageBook.setFocus(); + } + // then set focus on the page, if any + if (activeRec != null) { + activeRec.contentOutlinePage.setFocus(); + } + } + + /** + * Shows page contained in the given page record in this view. The page + * record must be one from this pagebook view. + *

+ * The PageBookView implementation of this method asks the pagebook control to show the given page's control, and records that the given page is now current. Subclasses may extend. + *

+ * + * @param pageRec + * the page record containing the page to show + */ + protected void showOutlinePageRec(OutlinePageRec pageRec) { + // If already showing do nothing + if (activeRec == pageRec) { + return; + } + // If the page is the same, just set activeRec to pageRec + if (activeRec != null && pageRec != null && activeRec.contentOutlinePage == pageRec.contentOutlinePage) { + activeRec = pageRec; + return; + } + + activeRec = pageRec; + Control pageControl = activeRec.contentOutlinePage.getControl(); + if (pageControl != null && !pageControl.isDisposed()) { + PageSite pageSite = (PageSite) activeRec.getPageSite(); + // Verify that the page control is not disposed + // If we are closing, it may have already been disposed + sashEditorPageBook.showPage(pageControl); + getSite().setActivePageSite(pageSite); + } + + } + + /** + * If it is possible to adapt the given object to the given type, this + * returns the adapter. Performs the following checks: + * + *
    + *
  1. Returns sourceObject if it is an instance of the adapter type.
  2. + *
  3. If sourceObject implements IAdaptable, it is queried for adapters.
  4. + *
  5. If sourceObject is not an instance of PlatformObject (which would have already done so), the adapter manager is queried for adapters
  6. + *
+ * + * Otherwise returns null. + * + * @param sourceObject + * object to adapt, or null + * @param adapter + * type to adapt to + * @param activatePlugins + * true if IAdapterManager.loadAdapter should be used (may trigger plugin activation) + * @return a representation of sourceObject that is assignable to the + * adapter type, or null if no such representation exists + */ + public static Object getAdapter(Object sourceObject, Class adapter, boolean activatePlugins) { + Assert.isNotNull(adapter); + if (sourceObject == null) { + return null; + } + if (adapter.isInstance(sourceObject)) { + return sourceObject; + } + + if (sourceObject instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) sourceObject; + + Object result = adaptable.getAdapter(adapter); + if (result != null) { + // Sanity-check + Assert.isTrue(adapter.isInstance(result)); + return result; + } + } + + if (!(sourceObject instanceof PlatformObject)) { + Object result; + if (activatePlugins) { + result = Platform.getAdapterManager().loadAdapter(sourceObject, adapter.getName()); + } else { + result = Platform.getAdapterManager().getAdapter(sourceObject, adapter); + } + if (result != null) { + return result; + } + } + + return null; + } + + /** + * A data structure used to store the information about the editor outline page within the papyrus outline page. + */ + protected static class OutlinePageRec { + + public Object subActionBars; + + /** papyrus page: current editor opened as nested editor */ + public IPage papyrusPage; + + /** outline page recorded for the given papyrus page */ + public IContentOutlinePage contentOutlinePage; + + /** page site for the recorded outline page */ + public IPageSite pageSite; + + /** + * Creates a new page record initialized to the given papyrus page and outline page. + * + * @param papyrusPage + * @param contentOutlinePage + */ + public OutlinePageRec(IPage papyrusPage, IContentOutlinePage contentOutlinePage) { + this.papyrusPage = papyrusPage; + this.contentOutlinePage = contentOutlinePage; + } + + /** + * Sets the page site + * + * @param pageSite + * the page site for the recorded content outline page + */ + public void setPageSite(IPageSite pageSite) { + this.pageSite = pageSite; + } + + /** + * Sets the page site + * + * @param pageSite + * the page site for the recorded content outline page + */ + public IPageSite getPageSite() { + return this.pageSite; + } + + /** + * Disposes of this page record by nulling its fields. + */ + public void dispose() { + papyrusPage = null; + contentOutlinePage = null; + pageSite = null; + } + } + + protected static class DelegatedPageSite extends PageSite { + + /** Page site of the active page in the book */ + protected PageSite activePageSite; + + private NestedEditorDelegatedOutlinePage nestedEditorDelegatedOutlinePage; + + /** + * Constructor. + * + * @param parentViewSite + * @param nestedEditorDelegatedOutlinePage + */ + public DelegatedPageSite(IViewSite parentViewSite, NestedEditorDelegatedOutlinePage nestedEditorDelegatedOutlinePage) { + super(parentViewSite); + this.nestedEditorDelegatedOutlinePage = nestedEditorDelegatedOutlinePage; + } + + /** + * Sets the active page site + * + * @param activePageSite + * the activePageSite to set + */ + public void setActivePageSite(PageSite activePageSite) { + // remove the contribution of the previous active page site + if (this.activePageSite != null) { + // update the action bars for the current page + getActionBars().deactivate(); + getActionBars().clearGlobalActionHandlers(); + getActionBars().updateActionBars(); + + activePageSite.deactivate(); + + } + this.activePageSite = activePageSite; + if (this.activePageSite != null) { + activePageSite.activate(); + // update the action bars for the current page + getActionBars().activate(); + getActionBars().updateActionBars(); + } + } + + /** + * Returns the active page site + * + * @return the active Page Site + */ + public PageSite getActivePageSite() { + return activePageSite; + } + + /** + * {@inheritDoc} + */ + @Override + public SubActionBars getActionBars() { + if (activePageSite != null) { + return (SubActionBars) activePageSite.getActionBars(); + } + return (SubActionBars) super.getActionBars(); + } + + /** + * {@inheritDoc} + */ + @Override + public void deactivate() { + // deactivate the action bars of the current active page + if (activePageSite != null) { + activePageSite.deactivate(); + } + + // deactivate all subcontributions + for (OutlinePageRec rec : nestedEditorDelegatedOutlinePage.getAllPages()) { + IPageSite site = rec.getPageSite(); + IActionBars bars = site.getActionBars(); + if (bars instanceof SubActionBars) { + SubActionBars subActionBars = (SubActionBars) bars; + subActionBars.deactivate(); + subActionBars.clearGlobalActionHandlers(); + subActionBars.updateActionBars(); + } + } + super.deactivate(); + } + + /** + * {@inheritDoc} + */ + @Override + public void activate() { + + // here, we have to desactivate all contributions of all pages of this delegating service. + // when the page site is activated, the pagebookview has already tried to update some action bars, even if it should not + // so we recompute all the active contributions items here, after desactivating all the contributions. + for (OutlinePageRec rec : nestedEditorDelegatedOutlinePage.getAllPages()) { + IPageSite site = rec.getPageSite(); + IActionBars bars = site.getActionBars(); + if (bars instanceof SubActionBars) { + SubActionBars subActionBars = (SubActionBars) bars; + subActionBars.deactivate(); + subActionBars.clearGlobalActionHandlers(); + subActionBars.updateActionBars(); + } + } + if (this.activePageSite != null) { + activePageSite.activate(); + // update the action bars for the current page + getActionBars().activate(); + getActionBars().updateActionBars(); + } + super.activate(); + } + } + + protected static class MessageOutlinePage implements IContentOutlinePage, IPageBookViewPage { + + private Text label; + + private IPageSite site; + + /** + * {@inheritDoc} + */ + @Override + public void createControl(Composite parent) { + label = new Text(parent, SWT.NONE); + label.setText("No outline for this editor"); + } + + /** + * {@inheritDoc} + */ + @Override + public void dispose() { + if (label != null && label.isDisposed()) { + label.dispose(); + label = null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public Control getControl() { + return label; + } + + /** + * {@inheritDoc} + */ + @Override + public void setActionBars(IActionBars actionBars) { + } + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + if (label != null && label.isDisposed()) { + label.setFocus(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public ISelection getSelection() { + // nothing here + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public void setSelection(ISelection selection) { + // nothing here + } + + /** + * {@inheritDoc} + */ + @Override + public IPageSite getSite() { + return site; + } + + /** + * {@inheritDoc} + */ + @Override + public void init(IPageSite site) throws PartInitException { + this.site = site; + } + + } + + private class OutlineContext { + + private List pages = Lists.newArrayListWithCapacity(mapIPapyrusPageToOutlineRec.size()); + + OutlineContext() { + for (OutlinePageRec next : mapIPapyrusPageToOutlineRec.values()) { + pages.add(new PageContext(next)); + } + } + + public void restore() { + for (PageContext next : pages) { + next.restore(); + } + } + + // + // Nested types + // + + private class PageContext { + + final URI diagramToken; + + final Object context; + + PageContext(OutlinePageRec outlinePage) { + Object diagram = outlinePage.papyrusPage.getRawModel(); + diagramToken = (diagram instanceof EObject) ? EcoreUtil.getURI((EObject) diagram) : null; + + // Can only sensibly manage restoring the state of the page if we can find it again + if (diagramToken == null) { + context = null; + } else { + IReloadContextProvider provider = AdapterUtils.adapt(outlinePage.contentOutlinePage, IReloadContextProvider.class, null); + context = (provider == null) ? null : provider.createReloadContext(); + } + } + + void restore() { + if (diagramToken != null) { + try { + ModelSet modelSet = multiEditor.getServicesRegistry().getService(ModelSet.class); + + Object diagram = modelSet.getEObject(diagramToken, true); + if (diagram != null) { + IPage page = sashWindowsContainer.lookupModelPage(diagram); + if (page != null) { + OutlinePageRec outlinePage = getOutlinePageRec(page, true); + if ((outlinePage != null) && (context != null)) { + // Restore it. We know it adapts if it provided the reload state in the first place + AdapterUtils.adapt(outlinePage.contentOutlinePage, IReloadContextProvider.class, null).restore(context); + } + } + } + } catch (ServiceException e) { + Activator.log.error(e); + } + } + } + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/AbstractStringValueConverter.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/AbstractStringValueConverter.java new file mode 100644 index 00000000000..813d5a71fbe --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/AbstractStringValueConverter.java @@ -0,0 +1,86 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.messages.Messages; + +/** + * Abstract class for String value Container + * + * @author VL222926 + * + */ +public abstract class AbstractStringValueConverter implements IStringValueConverter { + + protected static final String THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y = Messages.AbstractStringValueConverter_TheStringXIsNotValidToCreateY; + + protected static final String THE_FEATURE_X_CANT_BE_RESOLVED = Messages.AbstractStringValueConverter_TheFeatureXCantBeResolved; + + protected static final String THE_STRING_VALUE_X_CANT_BE_RESOLVED = Messages.AbstractStringValueConverter_TheStringValueXCantBeResolved; + + protected static final String SOME_STRING_ARE_NOT_VALID_TO_CREATE_X = Messages.AbstractStringValueConverter_SomeStringsAreNotValidToCreateY; + + protected static final String SOME_STRING_CANT_BE_RESOLVED_TO_FIND_X = Messages.AbstractStringValueConverter_SomeStringsCantBeResolvedToFindY; + + protected static final String NO_X_REPRESENTED_BY_Y_HAVE_BEEN_FOUND = Messages.AbstractStringValueConverter_NoXReprensentedByYHaveBeenFound; + + private ConvertedValueContainer result; + + /** + * + * @see org.eclipse.papyrus.infra.ui.converter.IStringValueConverter#deduceValueFromString(java.lang.Object, java.lang.String) + * + * @param type + * @param valueAsString + * @return + */ + @Override + public final ConvertedValueContainer deduceValueFromString(final Object type, final String valueAsString) { + result = doDeduceValueFromString(type, valueAsString); + if (result == null) { + final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_VALUE_X_CANT_BE_RESOLVED, valueAsString)); + result = new ConvertedValueContainer(null, status); + } + return result; + } + + /** + * + * @return + * the converted value, you should call deduceValueFromString before to call this method + */ + public final ConvertedValueContainer getConvertedValue() { + if (this.result == null) { + throw new IllegalStateException("You should call deduceValueFromString before to call this method"); //$NON-NLS-1$ + } + return this.result; + } + + /** + * + * @param type + * the type of the object + * @param valueAsString + * the string to resolve + * @return + * a {@link ConvertedValueContainer} with the resolved values and a status + */ + protected abstract ConvertedValueContainer doDeduceValueFromString(final Object type, final String valueAsString); + + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/ConvertedValueContainer.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/ConvertedValueContainer.java new file mode 100644 index 00000000000..e4466c9470d --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/ConvertedValueContainer.java @@ -0,0 +1,75 @@ +/***************************************************************************** + * 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; + + +/** + * + * This class allows to store the value created for a pasted String AND a result status associated to this pasted String + * + * @param + */ + +public class ConvertedValueContainer { + + /** + * this field is used when the pasted value is monovalued + */ + private final T value; + + /** + * the resulting status of the parsing + */ + private final IStatus status; + + /** + * + * Constructor. + * + * @param realValue + * a monovalued Value (can be null) + * @param realListValue + * a collection value (can be null) + * @param status + * a status (can be null) + */ + public ConvertedValueContainer(final T realValue, final IStatus status) { + this.value = realValue; + this.status = status; + Assert.isNotNull(status); + } + + + /** + * + * @return + * the status of the conversion + */ + public final IStatus getStatus() { + return this.status; + } + + /** + * + * @return + * the value + */ + public final T getConvertedValue() { + return this.value; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/EMFStringValueConverter.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/EMFStringValueConverter.java new file mode 100644 index 00000000000..cc42fe5acc9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/EMFStringValueConverter.java @@ -0,0 +1,373 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.emf.utils.EMFContants; +import org.eclipse.papyrus.infra.tools.util.BooleanHelper; +import org.eclipse.papyrus.infra.tools.util.TypesConstants; +import org.eclipse.papyrus.infra.ui.Activator; + +/** + * Value solver for EMF + * + * WARNING : incomplete implementations + * + * @author vl222926 + * + */ + +public class EMFStringValueConverter extends AbstractStringValueConverter { + + + + /** + * Context used for the resolution of the string + */ + private EObject resolutionContext; + + /** + * The separator used for multivalue + */ + protected final String multiValueSeparator; + + /** + * + * Constructor. + * + * @param resolutionContext + * the context used for the resolution of the string + */ + public EMFStringValueConverter(final EObject resolutionContext, final String multiValueSeparator) { + this.resolutionContext = resolutionContext; + this.multiValueSeparator = multiValueSeparator; + } + + + /** + * + * @return + * the context to use for the resolution + */ + public EObject getResolutionContext() { + return resolutionContext; + } + + /** + * + * @see org.eclipse.ui.services.IDisposable#dispose() + * + */ + @Override + public void dispose() { + this.resolutionContext = null; + } + + /** + * + * @param resolutionContext + * the table context + * @param feature + * the feature + * @param valueAsString + * the pasted string for this feature + * @return + * the value for the pasted string or null if not found + */ + @Override + protected ConvertedValueContainer doDeduceValueFromString(final Object feature, final String valueAsString) { + final EClassifier featureType = getFeatureType(feature); + if (feature instanceof EStructuralFeature) { + return deduceValueFromString(feature, featureType, valueAsString); + } + return null; + } + + /** + * + * @param feature + * @param featureType + * @param valueAsString + * @return + */ + protected ConvertedValueContainer deduceValueFromString(final Object feature, final EClassifier featureType, final String valueAsString) { + ConvertedValueContainer realValue = null; + // if(feature instanceof EStructuralFeature) { + final int upperbound = getFeatureUpperBound(feature); + boolean isMany = (upperbound > 1 || upperbound == -1); + if (featureType instanceof EDataType) { + if (featureType instanceof EEnum) { + realValue = deduceEEnumLiteralValue((EEnum) featureType, isMany, valueAsString); + } + final String typeName = featureType.getName(); + if (TypesConstants.STRING.equals(typeName) || EMFContants.ESTRING.equals(typeName)) { + realValue = deduceStringValue(isMany, valueAsString); + } else if (EMFContants.EBOOLEAN.equals(typeName) || TypesConstants.BOOLEAN.equals(typeName)) { + realValue = deduceBooleanValue(isMany, valueAsString); + } else if (EMFContants.EINT.equals(typeName) || TypesConstants.INTEGER.equals(typeName)) { + realValue = deduceIntValue(isMany, valueAsString); + } else if (EMFContants.EDOUBLE.equals(typeName)) { + realValue = deduceDoubleValue(isMany, valueAsString); + } + } else if (featureType instanceof EClass) { + realValue = deduceEObjectValue(getResolutionContext(), feature, (EClass) featureType, isMany, valueAsString); + } + return realValue; + } + + protected int getFeatureUpperBound(final Object feature) { + return ((EStructuralFeature) feature).getUpperBound(); + } + + + + /** + * + * @param resolutionContext + * the context used for the resolution + * @param feature + * the feature + * @param featureType + * the type of the feature + * @param isMany + * true if the feature isMany + * @param valueAsString + * the string value to resolve + * @return + * a value container referencing the eobject represented by the string + * @throws StringValueSolverException + */ + protected ConvertedValueContainer deduceEObjectValue(EObject resolutionContext, Object feature, EClass featureType, boolean isMany, String valueAsString) { + if (valueAsString == null || valueAsString.equals("")) { + return new ConvertedValueContainer(null, Status.OK_STATUS); + } + final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_VALUE_X_CANT_BE_RESOLVED, valueAsString)); + return new ConvertedValueContainer(null, status); + } + + /** + * + * @param feature + * an object representing a feature + * @return + * the type of the feature + */ + protected EClassifier getFeatureType(final Object feature) { + final EClassifier featureType; + if (feature instanceof EStructuralFeature) { + return ((EStructuralFeature) feature).getEType(); + } else { + featureType = null; + } + return featureType; + } + + /** + * + * @param eenum + * the enumeration + * @param isMany + * true if the feature is many + * @param valueAsString + * the value to convert + * @return + * the converted value + */ + protected ConvertedValueContainer deduceEEnumLiteralValue(final EEnum eenum, final boolean isMany, final String valueAsString) { + ConvertedValueContainer returnedValue = null; + IStatus iStatus = Status.OK_STATUS; + final Collection unresolvedValues = new ArrayList(); + if (isMany) { + final Collection values = new ArrayList(); + for (final String str : valueAsString.split(this.multiValueSeparator)) { + final EEnumLiteral literal = eenum.getEEnumLiteral(str); + if (literal != null) { + values.add(literal); + } else { + unresolvedValues.add(str); + } + } + if (!unresolvedValues.isEmpty()) { + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, EMFContants.EENUM_LITERAL), unresolvedValues); + } + returnedValue = new MultiConvertedValueContainer(values, iStatus); + } else { + final EEnumLiteral literal = eenum.getEEnumLiteral(valueAsString); + if (literal != null) { + // returnedValue = new ConvertedValueContainer(literal, iStatus); + // fix a bug on enumerator + returnedValue = new ConvertedValueContainer(literal.getInstance(), iStatus); + } else { + unresolvedValues.add(valueAsString); + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, EMFContants.EENUM_LITERAL), unresolvedValues); + returnedValue = new ConvertedValueContainer(null, iStatus); + } + } + return returnedValue; + } + + /** + * + * @param isMany + * true if the feature isMany + * @param valueAsString + * the value to parse + * @return + * the result of the parsing + */ + protected ConvertedValueContainer deduceBooleanValue(final boolean isMany, final String valueAsString) { + ConvertedValueContainer returnedValue = null; + IStatus iStatus = Status.OK_STATUS; + final Collection unresolvedValues = new ArrayList(); + if (isMany) { + final Collection values = new ArrayList(); + for (final String str : valueAsString.split(this.multiValueSeparator)) { + if (BooleanHelper.isBoolean(str)) { + values.add(Boolean.valueOf(valueAsString)); + } else { + unresolvedValues.add(str); + } + } + if (!unresolvedValues.isEmpty()) { + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.BOOLEAN), unresolvedValues); + } + returnedValue = new MultiConvertedValueContainer(values, iStatus); + } else { + if (BooleanHelper.isBoolean(valueAsString)) { + returnedValue = new ConvertedValueContainer(Boolean.valueOf(valueAsString), iStatus); + } else { + unresolvedValues.add(valueAsString); + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.BOOLEAN), unresolvedValues); + returnedValue = new ConvertedValueContainer(null, iStatus); + } + } + return returnedValue; + } + + /** + * + * @param isMany + * true if the feature isMany + * @param valueAsString + * the value to parse + * @return + * the result of the parsing + */ + protected ConvertedValueContainer deduceDoubleValue(final boolean isMany, final String valueAsString) { + ConvertedValueContainer returnedValue = null; + IStatus iStatus = Status.OK_STATUS; + final Collection unresolvedValues = new ArrayList(); + if (isMany) { + final Collection values = new ArrayList(); + for (final String str : valueAsString.split(this.multiValueSeparator)) { + final Double value = Double.valueOf(str); + if (value != null) { + values.add(value); + } else { + unresolvedValues.add(str); + } + } + if (!unresolvedValues.isEmpty()) { + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.DOUBLE), unresolvedValues); + } + returnedValue = new MultiConvertedValueContainer(values, iStatus); + } else { + try { + returnedValue = new ConvertedValueContainer(Double.valueOf(valueAsString), iStatus); + } catch (final NumberFormatException e) { + unresolvedValues.add(valueAsString); + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.DOUBLE), unresolvedValues); + returnedValue = new ConvertedValueContainer(null, iStatus); + } + } + return returnedValue; + } + + /** + * + * @param isMany + * true if the feature isMany + * @param valueAsString + * the value to parse + * @return + * the result of the parsing + */ + protected ConvertedValueContainer deduceIntValue(final boolean isMany, final String valueAsString) { + ConvertedValueContainer returnedValue = null; + IStatus iStatus = Status.OK_STATUS; + final Collection unresolvedValues = new ArrayList(); + if (isMany) { + final Collection values = new ArrayList(); + for (final String str : valueAsString.split(this.multiValueSeparator)) { + try { + values.add(Integer.valueOf(str)); + } catch (final NumberFormatException e) { + unresolvedValues.add(str); + } + } + if (!unresolvedValues.isEmpty()) { + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(SOME_STRING_ARE_NOT_VALID_TO_CREATE_X, TypesConstants.INTEGER), unresolvedValues); + } + returnedValue = new MultiConvertedValueContainer(values, iStatus); + } else { + try { + returnedValue = new ConvertedValueContainer(Integer.valueOf(valueAsString), iStatus); + } catch (final NumberFormatException e) { + unresolvedValues.add(valueAsString); + iStatus = new StringValueConverterStatus(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(THE_STRING_X_IS_NOT_VALID_TO_CREATE_Y, valueAsString, TypesConstants.INTEGER), unresolvedValues); + returnedValue = new ConvertedValueContainer(null, iStatus); + } + } + return returnedValue; + } + + + /** + * + * @param isMany + * true if the feature is many + * @param valueAsString + * the value as string + * @return + * the value container with the real value(s) + */ + protected ConvertedValueContainer deduceStringValue(final boolean isMany, final String valueAsString) { + ConvertedValueContainer returnedValue = null; + final IStatus iStatus = Status.OK_STATUS; + if (isMany) { + final Collection values = new ArrayList(); + for (final String str : valueAsString.split(this.multiValueSeparator)) { + values.add(str); + } + returnedValue = new MultiConvertedValueContainer(values, iStatus); + } else { + returnedValue = new ConvertedValueContainer(valueAsString, iStatus); + } + return returnedValue; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/IStringValueConverter.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/IStringValueConverter.java new file mode 100644 index 00000000000..242c4acc523 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/IStringValueConverter.java @@ -0,0 +1,36 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import org.eclipse.ui.services.IDisposable; + +/** + * Common interface for string converter + * + * @author VL222926 + * + */ +public interface IStringValueConverter extends IDisposable { + + /** + * + * @param type + * an object representing the type of the in which we want to convert the string + * @param valueAsString + * the value represented by a string + * @return + * a {@link ConvertedValueContainer} + */ + public ConvertedValueContainer deduceValueFromString(final Object type, final String valueAsString); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/MultiConvertedValueContainer.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/MultiConvertedValueContainer.java new file mode 100644 index 00000000000..13aacbf3396 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/MultiConvertedValueContainer.java @@ -0,0 +1,39 @@ +/***************************************************************************** + * 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import java.util.Collection; + +import org.eclipse.core.runtime.IStatus; + +/** + * + * This class allows to store the value created for a pasted String AND a result status associated to this pasted String + * + * @param + */ +public class MultiConvertedValueContainer extends ConvertedValueContainer> { + + + /** + * + * Constructor. + * + * @param realValue + * @param status + */ + public MultiConvertedValueContainer(final Collection realValue, final IStatus status) { + super(realValue, status); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/StringValueConverterStatus.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/StringValueConverterStatus.java new file mode 100644 index 00000000000..8a41a9edaa3 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/converter/StringValueConverterStatus.java @@ -0,0 +1,60 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.converter; + +import java.util.Collection; + +import org.eclipse.core.runtime.Status; + +/** + * This status is used y the String Value solvers + * + * @author vl222926 + * + */ +public class StringValueConverterStatus extends Status { + + /** + * the list of the uresolved strings + */ + private Collection unresolvedString; + + /** + * + * Constructor. + * + * @param severity + * the severity of the status + * @param pluginId + * the plugin id providing this status + * @param message + * the message for this status + * @param unresolvedString + * the list of the unresolved string + */ + public StringValueConverterStatus(int severity, String pluginId, String message, Collection unresolvedString) { + super(severity, pluginId, message); + this.unresolvedString = unresolvedString; + } + + + /** + * + * @return + * the list of the unresolved string + */ + public final Collection getUnresolvedString() { + return unresolvedString; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/dnd/PapyrusTransfer.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/dnd/PapyrusTransfer.java new file mode 100644 index 00000000000..a31e0562b90 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/dnd/PapyrusTransfer.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 IBM Corporation, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Christian W. Damus - adapted from GEF for bug 469188 + *******************************************************************************/ +package org.eclipse.papyrus.infra.ui.dnd; + +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; + +import org.eclipse.swt.dnd.ByteArrayTransfer; +import org.eclipse.swt.dnd.TransferData; + +/** + * A local transfer carrying a single object being dragged. Subclasses should maintain a + * single instance of their Transfer and provide a static method to obtain that + * instance. + */ +public abstract class PapyrusTransfer extends ByteArrayTransfer { + + private final Class objectType; + private final String typeName; + private final int typeID; + + private Reference object; + private long startTime; + + protected PapyrusTransfer(Class objectType) { + super(); + + this.objectType = objectType; + + typeName = String.format("%s:%x:%x", getClass().getSimpleName(), hashCode(), System.currentTimeMillis()); + typeID = registerType(typeName); + } + + @Override + public final int hashCode() { + return System.identityHashCode(this); + } + + /** + * The data object is not converted to bytes. It is held onto in a field. + * Instead, a checksum is written out to prevent unwanted drags across + * mulitple running copies of Eclipse. + * + * @see org.eclipse.swt.dnd.Transfer#javaToNative(Object, TransferData) + */ + @Override + public void javaToNative(Object object, TransferData transferData) { + setObject(objectType.cast(object)); + startTime = System.currentTimeMillis(); + if (transferData != null) + super.javaToNative(String.valueOf(startTime).getBytes(), + transferData); + } + + /** + * The data object is not converted to bytes. It is held onto in a field. + * Instead, a checksum is written out to prevent unwanted drags across + * mulitple running. copies of Eclipse. + * + * @see org.eclipse.swt.dnd.Transfer#nativeToJava(TransferData) + */ + @Override + public Object nativeToJava(TransferData transferData) { + byte bytes[] = (byte[]) super.nativeToJava(transferData); + if (bytes == null) { + return null; + } + long startTime = Long.parseLong(new String(bytes)); + return (this.startTime == startTime) ? getObject() : null; + } + + /** + * Obtains the object being dragged. + */ + public T getObject() { + return (object == null) ? null : objectType.cast(object.get()); + } + + /** + * Sets the object being dragged. + */ + public void setObject(T object) { + this.object = new WeakReference<>(object); + } + + @Override + protected int[] getTypeIds() { + return new int[] { typeID }; + } + + @Override + protected String[] getTypeNames() { + return new String[] { typeName }; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/ContentProviderServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/ContentProviderServiceFactory.java new file mode 100644 index 00000000000..e67c81034fb --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/ContentProviderServiceFactory.java @@ -0,0 +1,68 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; + +/** + * A service factory to create the {@link ISashWindowsContentProvider} service. + * This service depends on {@link DiSashModelMngrServiceFactory}. + * + * @author cedric dumoulin + * + */ +public class ContentProviderServiceFactory implements IServiceFactory { + + /** + * The sashModelMangr. + */ + private DiSashModelManager sashModelMngr; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + // Get required services + sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() + * + * @return + * @throws ServiceException + */ + @Override + public Object createServiceInstance() throws ServiceException { + return sashModelMngr.getISashWindowsContentProvider(); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/CoreMultiDiagramEditor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/CoreMultiDiagramEditor.java new file mode 100644 index 00000000000..983e28735ec --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/CoreMultiDiagramEditor.java @@ -0,0 +1,1244 @@ +/***************************************************************************** + * Copyright (c) 2008, 2016 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus (CEA) - manage models by URI, not IFile (CDO) + * Christian W. Damus (CEA) - bug 410346 + * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up) + * Christian W. Damus (CEA) - bug 437217 + * Christian W. Damus - bugs 469464, 469188, 485220 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.editor; + +import static org.eclipse.papyrus.infra.core.Activator.log; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.language.ILanguageChangeListener; +import org.eclipse.papyrus.infra.core.language.ILanguageService; +import org.eclipse.papyrus.infra.core.language.LanguageChangeEvent; +import org.eclipse.papyrus.infra.core.resource.ModelMultiException; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; +import org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; +import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServiceMultiException; +import org.eclipse.papyrus.infra.core.services.ServiceStartKind; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.contentoutline.ContentOutlineRegistry; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor.DirtyPolicy; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; +import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; +import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry; +import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.CoreComposedActionBarContributor; +import org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager; +import org.eclipse.papyrus.infra.ui.services.internal.EditorLifecycleManagerImpl; +import org.eclipse.papyrus.infra.ui.services.internal.InternalEditorLifecycleManager; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorActionBarContributor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IGotoMarker; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.progress.UIJob; +import org.eclipse.ui.statushandlers.StatusManager; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; + +/** + * Multi diagram editor allowing to plug various kind of editors. Editors are + * registered with the help of the Eclipse extension mechanism. This + * implementation allows to register editors and context separately. An editor + * should specify which context it need to run. This multi diagram editor allows + * to show editor side by side in one or more sash windows. + * + * The real implementation for the generic type T of SashMultiPageEditorPart is + * actually di2.Diagram + * + * @author cedric dumoulin + * @author Jerome Benois + * @author Thomas Szadel + * Refactoring. + * + * TODO : remove GMF dependency ! + */ +public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IGotoMarker, IEditingDomainProvider { + + /** ContentOutline registry */ + private ContentOutlineRegistry contentOutlineRegistry; + + /** Services registry. Used to get registered services */ + private ServicesRegistry servicesRegistry; + + /** + * ActionBarContributor Registry. Allows to get an ActionBar by its Id. The + * registry is initialized from the Eclipse extension mechanism. + */ + private ActionBarContributorRegistry actionBarContributorRegistry; + + /** SashModelMngr to add pages */ + protected DiSashModelManager sashModelMngr; + + /** + * Service used to maintain the dirty state and to perform save and saveAs. + */ + protected ISaveAndDirtyService saveAndDirtyService; + + private final List propertiesPages = new LinkedList(); + + private final List closeActions = new ArrayList<>(); + + /** + * Listener on {@link ISaveAndDirtyService#addInputChangedListener(IEditorInputChangedListener)} + */ + private static class EditorInputChangedListener implements IEditorInputChangedListener { + + private CoreMultiDiagramEditor editor; + + public EditorInputChangedListener(CoreMultiDiagramEditor editor) { + this.editor = editor; + } + + /** + * This method is called when the editor input is changed from the + * ISaveAndDirtyService. + * + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput) + * + * @param fileEditorInput + */ + @Override + public void editorInputChanged(FileEditorInput fileEditorInput) { + // Change the editor input. + editor.setInputWithNotify(fileEditorInput); + editor.setPartName(fileEditorInput.getName()); + } + + /** + * The isDirty flag has changed, reflect its new value + * + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener#isDirtyChanged() + * + */ + @Override + public void isDirtyChanged() { + + // Run it in async way. + editor.getSite().getShell().getDisplay().asyncExec(new Runnable() { + + @Override + public void run() { + // editor can be null if this object has been finalized, but + // still queued in the asyncExec queue. + // This can happen if the editor is disposed, but some run still in + // the exec queue. + // When the method is executed asynchronously, the object is already finalized, and so + // editor is null. + if (editor == null) { + return; + } + editor.firePropertyChange(IEditorPart.PROP_DIRTY); + } + }); + } + + public void dispose() { + this.editor = null; + } + } + + protected EditorInputChangedListener editorInputChangedListener; + + private TransactionalEditingDomain transactionalEditingDomain; + + /** + * Object managing models lifeCycle. + */ + protected ModelSet resourceSet; + + /** + * Cached event that can be reused. + */ + protected DoSaveEvent lifeCycleEvent; + + private class ContentChangedListener implements IContentChangedListener { + + /** + * Called when the content is changed. RefreshTabs. + */ + @Override + public void contentChanged(ContentEvent event) { + scheduleRefresh(); + } + } + + /** + * A listener on model change events. + */ + private ContentChangedListener contentChangedListener; + + /** + * Undo context used to have the same undo context in all Papyrus related + * views and editors. TODO : move away, use a version independent of GMF, + * add a listener that will add the context to all commands modifying + * attached Resources (==> linked to ModelSet ?) + */ + private IUndoContext undoContext; + + /** + * Editor reload listeners. + */ + private CopyOnWriteArrayList reloadListeners = new CopyOnWriteArrayList(); + + /** + * A pending reload operation (awaiting next activation of the editor). + */ + private final AtomicReference pendingReload = new AtomicReference(); + + public CoreMultiDiagramEditor() { + super(); + + addSelfReloadListener(); + } + + /** + * Get the contentOutlineRegistry. Create it if needed. + * + * @return the contentOutlineRegistry + */ + protected ContentOutlineRegistry getContentOutlineRegistry() { + if (contentOutlineRegistry == null) { + createContentOutlineRegistry(); + } + + return contentOutlineRegistry; + } + + /** + * Create the contentOutlineRegistry. + */ + private void createContentOutlineRegistry() { + contentOutlineRegistry = new ContentOutlineRegistry(this, Activator.PLUGIN_ID); + } + + /** + * Returns the service registry associated to the editor. + * + * @return the servicesRegistry The registry. + */ + @Override + public ServicesRegistry getServicesRegistry() { + if (servicesRegistry == null) { + servicesRegistry = createServicesRegistry(); + } + return servicesRegistry; + } + + /** + * Create the ServicesRegistry. + * + * @return + */ + private ServicesRegistry createServicesRegistry() { + // Create Services Registry + try { + ServicesRegistry servicesRegistry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); + // servicesRegistry.startRegistry(); + return servicesRegistry; + } catch (ServiceException e) { + // Show log and error + log.error(e.getMessage(), e); + } + return null; + } + + /** + * Do nothing as we create the provider before any calls to this method. + * Should not be called by subclasses. + * + * @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#createPageProvider() + */ + @Override + protected ISashWindowsContentProvider createPageProvider() { + throw new UnsupportedOperationException("Not implemented. Should not be called as the ContentProvider is already initialized."); + } + + /** + * Create the pageContentProvider. + * + * Removed since 0.10.0 + * + * @param pageFactory + * @param diResource + * Resource used to load/save the SashModel. + * + * + */ + // protected ISashWindowsContentProvider createPageProvider(IPageModelFactory pageFactory, Resource diResource, TransactionalEditingDomain editingDomain) { + // + // sashModelMngr = new TransactionalDiSashModelMngr(pageFactory, diResource, editingDomain); + // + // ISashWindowsContentProvider pageProvider = sashModelMngr.getISashWindowsContentProvider(); + // + // return pageProvider; + // } + + /** + * Get The {@link IPageMngr} used to add, open, remove or close a diagram in + * the SashWindow. This method is available as soon as the {@link CoreMultiDiagramEditor#init(IEditorSite, IEditorInput)} method is + * called. + * + * @return + */ + protected IPageManager getIPageManager() throws IllegalStateException { + try { + return sashModelMngr.getIPageManager(); + } catch (Exception e) { + throw new IllegalStateException("Method should be called after CoreMultiDiagramEditor#init(IEditorSite, IEditorInput) is called"); + } + } + + /** + * Get the ActionBarContributorRegistry. Creates it if necessary. + * + * @return + */ + protected ActionBarContributorRegistry getActionBarContributorRegistry() { + if (actionBarContributorRegistry != null) { + return actionBarContributorRegistry; + } + + // Try to got it from CoreComposedActionBarContributor + // Get it from the contributor. + IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor(); + if (contributor instanceof CoreComposedActionBarContributor) { + log.debug(getClass().getSimpleName() + " - ActionBarContributorRegistry loaded from CoreComposedActionBarContributor."); + return ((CoreComposedActionBarContributor) contributor).getActionBarContributorRegistry(); + } else { + // Create a registry. + log.debug(getClass().getSimpleName() + " - create an ActionBarContributorRegistry."); + return createActionBarContributorRegistry(); + } + + } + + /** + * Create the ActionBarContributorRegistry. + * + * @return + */ + private ActionBarContributorRegistry createActionBarContributorRegistry() { + return new ActionBarContributorRegistry(Activator.PLUGIN_ID); + } + + /** + * + * + * @param adapter + * + * @return + */ + @SuppressWarnings("rawtypes") + @Override + public Object getAdapter(Class adapter) { + + if (ServicesRegistry.class == adapter) { + return getServicesRegistry(); + } + + if (IPageManager.class == adapter) { + return getIPageManager(); + } + + if (IPropertySheetPage.class == adapter) { + // Do not test if tabbedPropertySheetPage is null before calling new + // this is managed by Eclipse which only call current method when + // necessary + return getPropertySheetPage(); + } + + // Add a viewer + if (IContentOutlinePage.class == adapter) { + try { + ContentOutlineRegistry outlineRegistry = getContentOutlineRegistry(); + if (outlineRegistry == null) { + return null; + } + IContentOutlinePage contentOutline = outlineRegistry.getContentOutline(); + if (contentOutline != null) { + return contentOutline; + } + } catch (BackboneException e) { + // Ignore: There is not registered outline. + } + } + + if (EditingDomain.class == adapter || TransactionalEditingDomain.class == adapter) { + return transactionalEditingDomain; + } + + /* + * Return context used for undo/redo. All papyrus views should use this + * context. The prefer way to get this is to use undoContext = + * servicesRegistry.getService(IUndoContext.class); + */ + if (IUndoContext.class == adapter) { + return undoContext; + } + + // EMF requirements + if (IEditingDomainProvider.class == adapter) { + return this; + } + + if (adapter == ISelection.class) { + return getSite().getSelectionProvider().getSelection(); + } + + if (adapter == IReloadableEditor.class) { + return createReloadAdapter(); + } + + return super.getAdapter(adapter); + } + + /** + * Init the editor. + */ + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + // Init super + super.init(site, input); + + // Set editor name + setPartName(input.getName()); + + initContents(); + } + + @Override + public void createPartControl(Composite parent) { + super.createPartControl(parent); + + // Fire the PreDisplay event synchronously, so that listeners can continue + // setting up the UI before the contents are actually rendered fully + getLifecycleManager().firePreDisplay(this); + + // Fire the PostDisplay event asynchronously, to leave time to the Eclipse + // framework to actually display the contents of the editor + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + // Because we are asynchronous, the editor may already have been disposed + // (Especially in the case of tests running in the UI Thread) + if (servicesRegistry == null) { + return; + } + getLifecycleManager().firePostDisplay(CoreMultiDiagramEditor.this); + } + }); + + } + + protected void loadModelAndServices() throws PartInitException { + // Create ServicesRegistry and register services + servicesRegistry = createServicesRegistry(); + + // Add itself as a service + servicesRegistry.add(IMultiDiagramEditor.class, 1, this); + + // Create lifeCycle event provider and the event that is used when the editor fire a save event. + // lifeCycleEventsProvider = new LifeCycleEventsProvider(); + // lifeCycleEvent = new DoSaveEvent(servicesRegistry, this); + // servicesRegistry.add(ILifeCycleEventsProvider.class, 1, lifeCycleEventsProvider); + + // register services + servicesRegistry.add(ActionBarContributorRegistry.class, 1, getActionBarContributorRegistry()); + // servicesRegistry.add(TransactionalEditingDomain.class, 1, transactionalEditingDomain); + // servicesRegistry.add(DiResourceSet.class, 1, resourceSet); + + // Create and initalize editor icons service + // PageIconsRegistry pageIconsRegistry = new PageIconsRegistry(); + // PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); + // editorReader.populate(pageIconsRegistry); + // servicesRegistry.add(IPageIconsRegistry.class, 1, pageIconsRegistry); + + + // Create PageModelRegistry requested by content provider. + // Also populate it from extensions. + // PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); + // editorReader.populate(pageModelRegistry, servicesRegistry); + + // TODO : create appropriate Resource for the contentProvider, and pass it here. + // This will allow to remove the old sash stuff. + // setContentProvider(createPageProvider(pageModelRegistry, resourceSet.getDiResource(), transactionalEditingDomain)); + // servicesRegistry.add(ISashWindowsContentProvider.class, 1, getContentProvider()); + // servicesRegistry.add(IPageMngr.class, 1, getIPageMngr()); + + // register a basic label provider + // adapter factory used by EMF objects + AdapterFactory factory = null; + try { + EditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(servicesRegistry); + if (domain instanceof AdapterFactoryEditingDomain) { + // Use the adapter factory already provided by this editing domain + factory = ((AdapterFactoryEditingDomain) domain).getAdapterFactory(); + } + } catch (ServiceException e) { + // OK, there's no editing domain. That's fine + } + + if (factory == null) { + // Must create a new adapter factory + factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + } + + /** label provider for EMF objects */ + ILabelProvider labelProvider = new AdapterFactoryLabelProvider(factory) { + + /** + * This implements {@link ILabelProvider}.getText by forwarding it + * to an object that implements {@link IItemLabelProvider#getText + * IItemLabelProvider.getText} + */ + @Override + public String getText(Object object) { + // Get the adapter from the factory. + // + IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); + if (object instanceof EObject) { + if (((EObject) object).eIsProxy()) { + return "Proxy - " + object; + } + } + return itemLabelProvider != null ? itemLabelProvider.getText(object) : object == null ? "" : object.toString(); + } + }; + servicesRegistry.add(ILabelProvider.class, 1, labelProvider); + + EditorLifecycleManager lifecycleManager = new EditorLifecycleManagerImpl(); + servicesRegistry.add(EditorLifecycleManager.class, 1, lifecycleManager, ServiceStartKind.LAZY); + + // Start servicesRegistry + URI uri; + IEditorInput input = getEditorInput(); + if (input instanceof IFileEditorInput) { + uri = URI.createPlatformResourceURI(((IFileEditorInput) input).getFile().getFullPath().toString(), true); + } else if (input instanceof URIEditorInput) { + uri = ((URIEditorInput) input).getURI(); + } else { + uri = URI.createURI(((IURIEditorInput) input).getURI().toString()); + } + + try { + // Start the ModelSet first, and load if from the specified File. + // Also start me so that I may be retrieved from the registry by other services + List> servicesToStart = new ArrayList>(1); + servicesToStart.add(ModelSet.class); + servicesToStart.add(IMultiDiagramEditor.class); + + servicesRegistry.startServicesByClassKeys(servicesToStart); + + resourceSet = servicesRegistry.getService(ModelSet.class); + resourceSet.loadModels(uri); + + // start remaining services + servicesRegistry.startRegistry(); + } catch (ModelMultiException e) { + try { + // with the ModelMultiException it is still possible to open the + // editors that's why the service registry is still started + servicesRegistry.startRegistry(); + warnUser(e); + } catch (ServiceException e1) { + log.error(e); + // throw new PartInitException("could not initialize services", e); //$NON-NLS-1$ + } + } catch (ServiceException e) { + log.error(e); + // throw new PartInitException("could not initialize services", e); + } + + + // Get required services + + try { + transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); + sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); + + saveAndDirtyService = servicesRegistry.getService(ISaveAndDirtyService.class); + undoContext = servicesRegistry.getService(IUndoContext.class); + + servicesRegistry.getService(ILanguageService.class).addLanguageChangeListener(createLanguageChangeListener()); + } catch (ServiceException e) { + log.error("A required service is missing.", e); + // if one of the services above fail to start, the editor can't run + // => stop + throw new PartInitException("could not initialize services", e); + } + + + // Listen on input changed from the ISaveAndDirtyService + editorInputChangedListener = new EditorInputChangedListener(this); + saveAndDirtyService.addInputChangedListener(editorInputChangedListener); + getLifecycleManager().firePostInit(this); + } + + private ILanguageChangeListener createLanguageChangeListener() { + return new ILanguageChangeListener() { + + @Override + public void languagesChanged(LanguageChangeEvent event) { + // Re-load the editor if languages changed, because new ModelSet configurations may be required + if (event.getType() == LanguageChangeEvent.ADDED) { + new UIJob(getSite().getShell().getDisplay(), NLS.bind("Reload editor {0}", getTitle())) { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + IStatus result = Status.OK_STATUS; + monitor = SubMonitor.convert(monitor, IProgressMonitor.UNKNOWN); + + try { + ISashWindowsContainer container = getISashWindowsContainer(); + if ((container != null) && !container.isDisposed()) { + IReloadableEditor.ReloadReason reason = IReloadableEditor.ReloadReason.RESOURCES_CHANGED; + + DirtyPolicy dirtyPolicy = DirtyPolicy.getDefault(); + try { + IReloadableEditor.Adapter.getAdapter(CoreMultiDiagramEditor.this).reloadEditor(resourceSet.getResources(), reason, dirtyPolicy); + } catch (CoreException e) { + result = e.getStatus(); + } + } + } finally { + monitor.done(); + } + + return result; + } + }.schedule(); + } + } + }; + } + + private InternalEditorLifecycleManager getLifecycleManager() { + // I've been disposed + if (servicesRegistry == null) { + return null; + } + try { + return (InternalEditorLifecycleManager) servicesRegistry.getService(EditorLifecycleManager.class); + } catch (ServiceException ex) { + Activator.log.error(ex); + } + return null; + } + + protected void loadNestedEditors() throws PartInitException { + ISashWindowsContentProvider contentProvider = null; + try { + contentProvider = servicesRegistry.getService(ISashWindowsContentProvider.class); + } catch (ServiceException ex) { + log.error("A required service is missing.", ex); + // if one of the services above fail to start, the editor can't run + // => stop + throw new PartInitException("could not initialize services", ex); + } + + // Set the content provider providing editors. + setContentProvider(contentProvider); + + // Listen on contentProvider changes + if (contentChangedListener == null) { + contentChangedListener = new ContentChangedListener(); + } + sashModelMngr.getSashModelContentChangedProvider().addListener(contentChangedListener); + + IEditorInput input = getEditorInput(); + + if (input instanceof IPapyrusPageInput) { + IPapyrusPageInput papyrusPageInput = (IPapyrusPageInput) input; + final IPageManager pageManager = getIPageManager(); + + if (papyrusPageInput.closeOtherPages()) { + pageManager.closeAllOpenedPages(); + } + + for (URI pageIdentifierURI : papyrusPageInput.getPages()) { + final EObject pageIdentifier = resourceSet.getEObject(pageIdentifierURI, true); + if (!pageManager.allPages().contains(pageIdentifier)) { + Activator.log.warn("The object " + pageIdentifier + " does not reference an existing page"); + continue; + } + + if (pageManager.isOpen(pageIdentifier)) { + pageManager.selectPage(pageIdentifier); + } else { + pageManager.openPage(pageIdentifier); + } + } + } + } + + protected void warnUser(ModelMultiException e) { + Activator.log.error(e); + MessageDialog.openError(getSite().getShell(), "Error", String.format("Your model is corrupted, invalid links have been found :\n" + "%s" + "It is recommended to fix it before editing it", e.getMessage())); + } + + /** + * Activate this editor. Called after the SWT.control is created. + */ + @Override + protected void activate() { + super.activate(); + + initFolderTabMenus(); + + try { + // Register ISashWindowsContainer as service + // Should be done only once the container is ready. + getServicesRegistry().add(ISashWindowsContainer.class, 1, getISashWindowsContainer()); + getServicesRegistry().startServicesByClassKeys(ISashWindowsContainer.class); + // Let the IPageMngr use the ISashWindowsContainer to discover current folder + // This should be done after SashWindowContainer initialization. + // DiSashModelManager sashModelManager = getServicesRegistry().getService(DiSashModelManager.class); + sashModelMngr.setCurrentFolderAndPageMngr(getISashWindowsContainer()); + + } catch (ServiceException e) { + log.error(e); + } + + } + + /** + * Init the contextual menu shown in the folder tabs. This popup menu is + * contributed by the help of Eclipse extensions, using the Commands + * framework. I.e, to add a menu item, create a menu, a command and an + * handler in the extension. + */ + protected void initFolderTabMenus() { + ISashWindowsContainer container = getISashWindowsContainer(); + + // TODO : use a constant + MenuManager menuManager = new MenuManager("tabmenu"); + menuManager.add(new Separator("tabcommands")); + menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + container.setFolderTabMenuManager(menuManager); + + // TODO : use a constant + getSite().registerContextMenu("org.eclipse.papyrus.infra.core.editor.ui.tabmenu", menuManager, getSite().getSelectionProvider()); + + } + + /** + * Overrides getPropertySheetPage. + * + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor#getPropertySheetPage() + */ + public IPropertySheetPage getPropertySheetPage() { + IPropertySheetPage propertiesPage = new MultiDiagramPropertySheetPage(this); + propertiesPages.add(propertiesPage); + return propertiesPage; + } + + @Override + public void dispose() { + for (IPropertySheetPage propertiesPage : this.propertiesPages) { + propertiesPage.dispose(); + } + propertiesPages.clear(); + + // Forget the outline page(s) + contentOutlineRegistry = null; + + super.dispose(); + } + + private IReloadableEditor createReloadAdapter() { + + return new IReloadableEditor() { + + @Override + public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { + // Attempt to re-load, later + pendingReload.set(new DeferredReload(triggeringResources, reason, dirtyPolicy)); + + // If I am already active, then do it now. Or, if we're not going to ask the user about it, also do it now + IWorkbenchPage page = getSite().getPage(); + if ((page.getActiveEditor() == CoreMultiDiagramEditor.this) || (dirtyPolicy != DirtyPolicy.PROMPT_TO_SAVE)) { + pendingReload.get().reload(); + } + } + + @Override + public void addEditorReloadListener(IEditorReloadListener listener) { + reloadListeners.addIfAbsent(listener); + } + + @Override + public void removeEditorReloadListener(IEditorReloadListener listener) { + reloadListeners.remove(listener); + } + }; + } + + private void addSelfReloadListener() { + createReloadAdapter().addEditorReloadListener(new IEditorReloadListener() { + + @Override + public void editorAboutToReload(EditorReloadEvent event) { + event.putContext(new MultiDiagramEditorSelectionContext(event.getEditor())); + } + + @Override + public void editorReloaded(EditorReloadEvent event) { + ((MultiDiagramEditorSelectionContext) event.getContext()).restore(event.getEditor()); + } + }); + } + + /** + * Register an action to be run when I am closed. Any number of such actions may + * be added. note that close actions also run on re-load, which behaves to all + * outward appearances like a close and re-open. + * + * @param closeAction + * an action to run when I am closed + */ + public void onClose(Runnable closeAction) { + closeActions.add(closeAction); + } + + @Override + protected void deactivate() { + getLifecycleManager().fireBeforeClose(this); + if (sashModelMngr != null) { + sashModelMngr.getSashModelContentChangedProvider().removeListener(contentChangedListener); + } + + super.deactivate(); + + // dispose available service + if (servicesRegistry != null) { + try { + servicesRegistry.disposeRegistry(); + servicesRegistry = null; + } catch (ServiceMultiException e) { + log.error(e); + } + } + + if (contentChangedListener != null) { + this.contentChangedListener = null; + } + + if (editorInputChangedListener != null) { + this.editorInputChangedListener.dispose(); + this.editorInputChangedListener = null; + } + + for (Runnable next : closeActions) { + try { + next.run(); + } catch (Exception e) { + Activator.log.error("Uncaught exception in close action", e); //$NON-NLS-1$ + } + } + closeActions.clear(); + + transactionalEditingDomain = null; + resourceSet = null; + undoContext = null; + saveAndDirtyService = null; + sashModelMngr = null; + } + + void initContents() throws PartInitException { + loadModelAndServices(); + loadNestedEditors(); + } + + @Override + public void setFocus() { + super.setFocus(); + + DeferredReload reload = pendingReload.get(); + if (reload != null) { + reload.reload(); + } + } + + private void doReload() throws CoreException { + final IWorkbenchPage page = getSite().getPage(); + final IWorkbenchPart activePart = page.getActivePart(); + final IEditorPart activeEditor = page.getActiveEditor(); + + final Iterable listeners = ImmutableList.copyOf(reloadListeners); + final EditorReloadEvent event = new EditorReloadEvent(CoreMultiDiagramEditor.this); + + try { + event.dispatchEditorAboutToReload(listeners); + + deactivate(); + + initContents(); + + activate(); + + // My self-listener will be first, to ensure that the pages are all restored before dependents run + event.dispatchEditorReloaded(listeners); + } finally { + event.dispose(); + + // Ensure that the editor previously active is active again (if it still exists) + if ((activeEditor != null) && page.isPartVisible(activeEditor)) { + page.activate(activeEditor); + } + + // Ensure that the part previously active is active again (if it still exists and is not the active editor) + if ((activePart != null) && (activePart != activeEditor) && page.isPartVisible(activePart)) { + page.activate(activePart); + } + } + + } + + /** + * Overrides doSave. + * + * {@inheritDoc} + * + * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public void doSave(IProgressMonitor monitor) { + + saveAndDirtyService.doSave(monitor); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isDirty() { + // May happen if the editor has not yet been initialized. In this case, the editor cannot be dirty, so we simply return false. + // Bug 410286: The isDirty() method can also be called /after/ the editor has been disposed. Most likely an Eclipse bug? + if (saveAndDirtyService == null) { + return false; + } + return saveAndDirtyService.isDirty(); + } + + /** + * Overrides doSaveAs. + * + * {@inheritDoc} + * + * @see org.eclipse.ui.part.EditorPart#doSaveAs() + */ + @Override + public void doSaveAs() { + + saveAndDirtyService.doSaveAs(); + } + + /** + * Overrides isSaveAsAllowed. + * + * {@inheritDoc} + * + * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * Overrides getContributorId. + * + * {@inheritDoc} + * + * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId() + */ + @Override + public String getContributorId() { + // return Activator.PLUGIN_ID; + return "TreeOutlinePage"; + + } + + // implements IDiagramWorkbenchPart to restore GMF standard behavior + // and delegate to the activeEditor + + /** + * Overrides getDiagram. + * + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagram() + */ + // public org.eclipse.gmf.runtime.notation.Diagram getDiagram() { + // IEditorPart activeEditor = getActiveEditor(); + // if(activeEditor instanceof DiagramEditor) { + // return ((DiagramEditor)activeEditor).getDiagram(); + // } else { + // return null; + // } + // } + + /** + * This method is called from a GMF diagram. It should only be called from GMF diagram code. Normally, the Diagram under the Mouse is a GMF + * Diagram. The active Diagram can be another Diagram, not + * under the mouse. This is a GMF issue. + */ + // public DiagramEditPart getDiagramEditPart() { + // + // // Get the editor under the mouse + // // IEditorPart activeEditor = rootContainer.getEditorUnderMouse(); + // IEditorPart activeEditor = getActiveEditor(); + // if(activeEditor == null) { + // return null; + // } + // // IEditorPart activeEditor = getActiveEditor(); + // if(activeEditor instanceof DiagramEditor) { + // return ((DiagramEditor)activeEditor).getDiagramEditPart(); + // } else { + // // This case should never happen. + // // Return null, as the GMF runtime now support it (since 093009) + // return null; + // } + // } + + /** + * Overrides getDiagramGraphicalViewer. + * + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagramGraphicalViewer() + */ + // public IDiagramGraphicalViewer getDiagramGraphicalViewer() { + // IEditorPart activeEditor = getActiveEditor(); + // if(activeEditor instanceof DiagramEditor) { + // return ((DiagramEditor)activeEditor).getDiagramGraphicalViewer(); + // } else { + // return null; + // } + // } + + /** + * Overrides getEditingDomain. + * + * {@inheritDoc} + * + * @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain() + */ + @Override + public EditingDomain getEditingDomain() { + return transactionalEditingDomain; + } + + /** + * Throws an UnsupportedOperationException. + * + * @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getDiagramEditDomain() + */ + // public DiagramEditDomain getDiagramEditDomain() { + // throw new UnsupportedOperationException("Not implemented. Should not be called."); + // } + + + /** + * Change the editor input.
+ * Note: that method should be called within the UI-Thread. + * + * @see org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor#setEditorInput(org.eclipse.ui.IEditorInput) + * + * @param newInput + * The new input + * @deprecated Not used anymore + */ + + @Override + @Deprecated + public void setEditorInput(IEditorInput newInput) { + setInputWithNotify(newInput); + setPartName(newInput.getName()); + } + + @Override + @Deprecated + public void gotoMarker(IMarker marker) { + IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage(); + boolean first = true; + for (IViewReference view : page.getViewReferences()) { + // no longer restrict to model explorer (see bug 387578) + IWorkbenchPart part = view.getPart(false); + if (part instanceof IGotoMarker) { + // activate first view implementing the IGotoMarker interface + if (first) { + page.activate(view.getPart(false)); + first = false; + } + ((IGotoMarker) part).gotoMarker(marker); + } + } + } + + private boolean needsRefresh; + + protected void scheduleRefresh() { + needsRefresh = true; + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + refreshTabs(); + } + }); + } + + @Override + protected void refreshTabs() { + if (!needsRefresh) { + return; + } + needsRefresh = false; + super.refreshTabs(); + } + + @Override + public synchronized IEditorPart getActiveEditor() { + refreshTabs(); + return super.getActiveEditor(); + } + + private final class DeferredReload extends IReloadableEditor.Adapter { + + private final Collection triggeringResources; + + private final ReloadReason reason; + + private final DirtyPolicy dirtyPolicy; + + DeferredReload(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) { + super(CoreMultiDiagramEditor.this); + + this.triggeringResources = ImmutableSet.copyOf(triggeringResources); + this.reason = reason; + this.dirtyPolicy = dirtyPolicy; + } + + void reload() { + try { + reloadEditor(triggeringResources, reason, dirtyPolicy); + } catch (CoreException e) { + // Failed to properly unload/load in place, so just close + getSite().getPage().closeEditor(CoreMultiDiagramEditor.this, false); + + StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG | StatusManager.SHOW); + } + } + + @Override + public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { + if (!pendingReload.compareAndSet(this, null)) { + return; + } + + final DirtyPolicy action = dirtyPolicy.resolve(CoreMultiDiagramEditor.this, triggeringResources, reason); + + if ((action == DirtyPolicy.SAVE) && isDirty()) { + doSave(new NullProgressMonitor()); + } + + switch (action) { + case SAVE: + case DO_NOT_SAVE: + if (reason.shouldReload(triggeringResources)) { + // Attempt to re-load + doReload(); + } else { + // Just close 'er down + getSite().getPage().closeEditor(CoreMultiDiagramEditor.this, false); + } + break; + case IGNORE: + // Pass + break; + default: + throw new IllegalArgumentException("Invalid resolution of editor re-load dirty policy: " + action); //$NON-NLS-1$ + } + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelManagerServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelManagerServiceFactory.java new file mode 100644 index 00000000000..1f13fedb84b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelManagerServiceFactory.java @@ -0,0 +1,114 @@ +/***************************************************************************** + * Copyright (c) 2013 Cedric Dumoulin. + * + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageModelFactoryRegistry; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.PluggableEditorFactoryReader; + +/** + * Service Factory to create the {@link DiSashModelManager} service. + * + * @author cedric dumoulin + * + */ +public class DiSashModelManagerServiceFactory implements IServiceFactory { + + private TransactionalEditingDomain transactionalEditingDomain; + + private SashModel sashModel; + + private DiSashModelManager sashModelMngr; + + private ServicesRegistry servicesRegistry; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + + this.servicesRegistry = servicesRegistry; + // Get required service + transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); + + // Get the model holding the contentProvider + sashModel = SashModelUtils.getSashModelChecked(servicesRegistry); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + + // Read declared editors + PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); + PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); + editorReader.populate(pageModelRegistry, servicesRegistry); + + if (sashModel.getResource() == null) { + throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service."); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // create the service + sashModelMngr = new DiSashModelManager(pageModelRegistry, sashModel.getResource(), transactionalEditingDomain); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() + * + * @return + * @throws ServiceException + */ + @Override + public Object createServiceInstance() throws ServiceException { + + // Start locally the service if needed. + // Question: Can createServiceInstance() method be called before + // startService() is called ? + if (sashModelMngr == null) { + startService(); + } + + return sashModelMngr; + } + + + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelMngrServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelMngrServiceFactory.java new file mode 100644 index 00000000000..ad0806cff77 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/DiSashModelMngrServiceFactory.java @@ -0,0 +1,101 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageModelFactoryRegistry; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.PluggableEditorFactoryReader; + +/** + * Service Factory to create the {@link DiSashModelMngr} service. + * + * @author cedric dumoulin + * + */ +public class DiSashModelMngrServiceFactory implements IServiceFactory { + + private TransactionalEditingDomain transactionalEditingDomain; + + private SashModel sashModel; + + private DiSashModelMngr sashModelMngr; + + private ServicesRegistry servicesRegistry; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + + this.servicesRegistry = servicesRegistry; + // Get required service + transactionalEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); + + // Get the model holding the contentProvider + sashModel = SashModelUtils.getSashModelChecked(servicesRegistry); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + + // Read declared editors + PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry(); + PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); + editorReader.populate(pageModelRegistry, servicesRegistry); + + if (sashModel.getResource() == null) { + throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service."); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // create the service + sashModelMngr = new DiSashModelMngr(pageModelRegistry, sashModel.getResource()); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() + * + * @return + * @throws ServiceException + */ + @Override + public Object createServiceInstance() throws ServiceException { + + // Start locally the service if needed. + // Question: Can createServiceInstance() method be called before + // startService() is called ? + if (sashModelMngr == null) { + startService(); + } + + return sashModelMngr; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IMultiDiagramEditor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IMultiDiagramEditor.java new file mode 100644 index 00000000000..7549517199e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IMultiDiagramEditor.java @@ -0,0 +1,93 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; + +/** + * Interface implemented by the main multipage editor. This interface list the + * methods available to diagram editors. Diagram editors can relies on this + * interface to retrieve services from the main multi diagram editor.
+ * This interface should stay minimalist, as the editor is not designed to + * handle the services itself. A service should be retrieved by using {@link #getServicesRegistry()}. + * + * + * @author cedric dumoulin + * + * TODO remove extends IEditingDomainProvider. This interface should be + * independant of any technology (EMF, GMF, ...). If the EditingDomain + * is required, it can be retrieved by the registry. + * + */ +public interface IMultiDiagramEditor extends IEditorPart { + + /** + * Returns the service registry associated to the editor. + * + * @return the servicesRegistry The registry. + */ + public ServicesRegistry getServicesRegistry(); + + /** + * Return the editor site. + * + * @return + */ + @Override + public IEditorSite getEditorSite(); + + /** + * Get the editor input. + * + * @return + */ + @Override + public IEditorInput getEditorInput(); + + /** + * Change the editor input. + * + * @param newInput + * The new input. + * @deprecated No replacement. Input can't be changed on multi editors. + */ + @Deprecated + public void setEditorInput(IEditorInput newInput); + + /** + * Returns the edit domain shared among editors + * + * @return the edit domain shared among editors + * @deprecated Use {@link #getServicesRegistry()} or {@link #getAdapter(Class)} + */ + // FIXME Remove it (GMF dependency) + // public DiagramEditDomain getDiagramEditDomain(); + + /** + * Get the currently active nested Editor. + */ + public IEditorPart getActiveEditor(); + + /** + * Get the property sheet page associated to the Editor. + * + * @return the property sheet page associated to the Editor. + * @deprecated Use {@link #getServicesRegistry()} or {@link #getAdapter(Class)} + */ + // @Deprecated + // public IPropertySheetPage getPropertySheetPage(); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IPapyrusPageInput.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IPapyrusPageInput.java new file mode 100644 index 00000000000..a56ab916ec6 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IPapyrusPageInput.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2013 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.ui.editor; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.ui.IEditorInput; + +/** + * An IEditorInput used to reference the page(s) to open + * + * @author Camille Letavernier + * + */ +public interface IPapyrusPageInput extends IEditorInput { + + /** + * @return the list of pages to open + */ + public URI[] getPages(); + + /** + * + * @return true if the editor should close all other pages + */ + public boolean closeOtherPages(); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IReloadableEditor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IReloadableEditor.java new file mode 100644 index 00000000000..92bff539cf7 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/IReloadableEditor.java @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2014, 2016 CEA, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * Christian W. Damus - bug 485220 + * + */ +package org.eclipse.papyrus.infra.ui.editor; + +import java.util.Collection; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.tools.util.CoreExecutors; +import org.eclipse.papyrus.infra.tools.util.PlatformHelper; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.ide.IDE; + + +/** + * An {@linkplain IAdaptable adapter protocol} for editors that know how to internally + * reload themselves without disturbing the workbench window's perspective layout. + */ +public interface IReloadableEditor { + + /** + * Reloads me in-place in the perspective layout. + * + * @param triggeringResources + * the resources that have changed in some way, triggering re-load + * @param reason + * the reason why the re-load is being requested + * @param dirtyPolicy + * how the client would like to handle the case of a dirty editor + * + * @throws CoreException + * on any failure to unload, reload, or whatever + */ + void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException; + + void addEditorReloadListener(IEditorReloadListener listener); + + void removeEditorReloadListener(IEditorReloadListener listener); + + /** + * An enumeration of the reason why some resources that an editor has loaded are triggering a re-load (or close). + */ + enum ReloadReason { + /** Resources have changed in persistent storage. */ + RESOURCES_CHANGED, + /** Resources have been deleted from persistent storage. */ + RESOURCES_DELETED; + + /** + * Queries whether, under ordinary circumstances, the editor should attempt to re-load to pick up changes in its dependent resources. + * + * @param triggeringResources + * the resources triggering re-load (or close) + * + * @return whether the editor should re-load + */ + public boolean shouldReload(Collection triggeringResources) { + return this != RESOURCES_DELETED; + } + } + + /** + * An enumeration of policies that clients may request to govern what to do with the editor before re-load (or close) if it should happen to be + * dirty. Note that editors are free to honour the requested policy or not, according to their needs. + */ + enum DirtyPolicy { + /** + * Save the editor without prompting. + */ + SAVE, + /** + * Do not save the editor; just discard pending changes and re-load (or close). + */ + DO_NOT_SAVE, + /** + * Do not re-load (or close) the editor; just keep pending changes and deal with conflicts later. + */ + IGNORE, + /** + * Prompt the user to inquire whether to save, discard pending changes, or not re-load (or close) at all. + * Note that the user prompt must always result in one of the other policies being actually applied. + */ + PROMPT_TO_SAVE { + + @Override + public DirtyPolicy resolve(IEditorPart editor, final Collection triggeringResources, final ReloadReason reason) throws CoreException { + final boolean dirty = editor.isDirty(); + + if (!dirty) { + if (reason.shouldReload(triggeringResources)) { + // Just re-load it. Simple + return DO_NOT_SAVE; + } else if (isPrincipalResourceAffected(editor, triggeringResources)) { + // Just close it. Also simple + return DO_NOT_SAVE; + } + } + + final String editorName = getEditorName(editor); + + final boolean allReadOnly = allReadOnly(triggeringResources); + final String promptTitle; + final String promptIntro; + final String saveOption; + final String dontSaveOption; + final String ignoreOption = "Ignore"; + + switch (reason) { + case RESOURCES_DELETED: + promptTitle = "Resources Deleted"; + promptIntro = NLS.bind("Some resources used by \"{0}\" have been deleted.", editorName); + saveOption = "Save and Close"; + dontSaveOption = "Close Editor"; + break; + default: + promptTitle = "Resources Changed"; + promptIntro = NLS.bind("Some resources used by \"{0}\" have changed.", editorName); + saveOption = "Save and Re-open"; + dontSaveOption = "Re-open Editor"; + break; + } + + Callable result; + + if (allReadOnly) { + // Only read-only models have changed. We (most likely) won't save them within this current editor. As they are already loaded, we can just continue. + result = new Callable() { + + @Override + public DirtyPolicy call() { + Shell parentShell = Display.getCurrent().getActiveShell(); + + final String message; + final String[] options; + if (dirty) { + message = promptIntro + " Note: all these resources are loaded in read-only mode and won't be overridden if you choose to save. Unsaved changes will be lost."; + options = new String[] { saveOption, dontSaveOption, ignoreOption }; + } else { + message = promptIntro; + options = new String[] { dontSaveOption, ignoreOption }; + } + + final MessageDialog dialog = new MessageDialog(parentShell, promptTitle, null, message, MessageDialog.WARNING, options, 0) { + + @Override + protected void setShellStyle(int newShellStyle) { + super.setShellStyle(newShellStyle | SWT.SHEET); + } + }; + final int answer = dialog.open(); + + DirtyPolicy result; + + if (answer == SWT.DEFAULT) { + // User hit Esc or dismissed the dialog with the window manager button. Ignore + result = IGNORE; + } else if (dirty) { + result = values()[answer]; + } else { + result = values()[answer + 1]; // Account for the missing "Save and Xxx" option + } + + return result; + } + }; + } else { + // At least one read-write resource has changed. Potential conflicts. + result = new Callable() { + + @Override + public DirtyPolicy call() { + DirtyPolicy result = IGNORE; + + final Shell parentShell = Display.getCurrent().getActiveShell(); + final String action = reason.shouldReload(triggeringResources) ? "re-open" : "close"; + final String message; + + if (dirty) { + message = promptIntro + NLS.bind(" Do you wish to {0} the current editor? Unsaved changes will be lost.", action); + } else { + message = promptIntro + NLS.bind(" Do you wish to {0} the current editor?", action); + } + + final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; + final MessageDialog dialog = new MessageDialog(parentShell, promptTitle, null, message, MessageDialog.WARNING, options, 0) { + + @Override + protected void setShellStyle(int newShellStyle) { + super.setShellStyle(newShellStyle | SWT.SHEET); + } + }; + if (dialog.open() == 0) { + result = DO_NOT_SAVE; + } + + return result; + } + }; + } + + try { + return CoreExecutors.getUIExecutorService().syncCall(result); + } catch (ExecutionException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to determine dirty policy for editor re-load.", e)); + } catch (InterruptedException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Interrupted in determining dirty policy for editor re-load.", e)); + } + } + }; + + /** + * Queries the default dirty policy currently in effect. The default-default is {@link #PROMPT_TO_SAVE}. + * + * @return the default policy + */ + public static DirtyPolicy getDefault() { + return PROMPT_TO_SAVE; + } + + /** + * Resolves me to a specific actionable policy, based on the resources that are triggering re-load (or close) and the reason. + * + * @param editor + * the editor to be re-loaded + * @param triggeringResources + * the resources (possibly an empty collection) that have changed + * @param reloadReason + * the reason why re-load (or close) is triggered + * + * @return the specific policy to implement in re-loading the editor + * + * @throws CoreException + * on failure to resolve the specific policy + */ + public DirtyPolicy resolve(IEditorPart editor, Collection triggeringResources, ReloadReason reason) throws CoreException { + return this; + } + + String getEditorName(IEditorPart editor) { + ModelSet modelSet = getModelSet(editor); + return (modelSet == null) ? editor.getTitle() : modelSet.getURIWithoutExtension().lastSegment(); + } + + private ModelSet getModelSet(IEditorPart editor) { + ModelSet result = null; + + if (editor instanceof IMultiDiagramEditor) { + try { + result = ((IMultiDiagramEditor) editor).getServicesRegistry().getService(ModelSet.class); + } catch (ServiceException e) { + // No problem. We have a fall-back + Activator.log.error(e); + } + } + + return result; + } + + boolean isPrincipalResourceAffected(IEditorPart editor, Collection triggeringResources) { + boolean result = false; + + ModelSet modelSet = getModelSet(editor); + if (modelSet != null) { + URI principalURI = modelSet.getURIWithoutExtension(); + for (Resource next : triggeringResources) { + if (next.getURI().trimFileExtension().equals(principalURI)) { + result = true; + break; + } + } + } else { + URI principalURI = getURI(editor.getEditorInput()); + if (principalURI != null) { + for (Resource next : triggeringResources) { + if (next.getURI().equals(principalURI)) { + result = true; + break; + } + } + } + } + + return result; + } + + private URI getURI(IEditorInput input) { + URI result = null; + + if (input instanceof URIEditorInput) { + result = ((URIEditorInput) input).getURI(); + } else if (input instanceof IURIEditorInput) { + result = URI.createURI(((IURIEditorInput) input).getURI().toString()); + } + + return result; + } + + protected boolean allReadOnly(Collection resources) { + for (Resource resource : resources) { + EditingDomain domain = TransactionUtil.getEditingDomain(resource); + if ((domain == null) || !domain.isReadOnly(resource)) { + return false; + } + } + + return true; + } + } + + /** + * A convenience adapter for editors that don't actually know how to reload themselves in place. + * It simply closes the editor and then opens it again on the original input. + */ + class Adapter implements IReloadableEditor { + + private final IEditorPart editor; + + public Adapter(IEditorPart editor) { + super(); + + this.editor = editor; + } + + public static IReloadableEditor getAdapter(IMultiDiagramEditor editor) { + return PlatformHelper.getAdapter(editor, IReloadableEditor.class, () -> new Adapter(editor)); + } + + @Override + public void reloadEditor(Collection triggeringResources, ReloadReason reason, DirtyPolicy dirtyPolicy) throws CoreException { + final IWorkbenchPage page = editor.getSite().getPage(); + final IEditorInput currentInput = editor.getEditorInput(); + + final Display display = editor.getSite().getShell().getDisplay(); + + final String editorId = editor.getSite().getId(); + + final DirtyPolicy action = dirtyPolicy.resolve(editor, triggeringResources, reason); + final boolean save = action == DirtyPolicy.SAVE; + + if (save && editor.isDirty()) { + editor.doSave(new NullProgressMonitor()); + } + + if (action != DirtyPolicy.IGNORE) { + page.closeEditor(editor, save); + + // If resources were deleted, we close and don't re-open + if (reason.shouldReload(triggeringResources)) { + display.asyncExec(new Runnable() { + + @Override + public void run() { + try { + IDE.openEditor(page, currentInput, editorId); + } catch (PartInitException ex) { + Activator.log.error(ex); + } + } + }); + } + } + } + + @Override + public void addEditorReloadListener(IEditorReloadListener listener) { + // Don't need to track these listeners because I never properly reload an editor + } + + @Override + public void removeEditorReloadListener(IEditorReloadListener listener) { + // Don't need to track these listeners because I never properly reload an editor + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramEditorSelectionContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramEditorSelectionContext.java new file mode 100644 index 00000000000..fc0302004dd --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramEditorSelectionContext.java @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor; + +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IComponentPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.reload.CompositeReloadContext; +import org.eclipse.papyrus.infra.ui.editor.reload.DelegatingReloadContext; +import org.eclipse.papyrus.infra.ui.editor.reload.EMFSelectionContext; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + + +/** + * A {@linkplain EditorReloadEvent reload event} context that restores the selection of which editor page + * is active in an {@link IMultiDiagramEditor} that is reloaded and delegates to its pages to capture + * re-load context for each to restore whatever they need to restore (internal selections etc.). + */ +class MultiDiagramEditorSelectionContext extends CompositeReloadContext { + + private ISashWindowsContainer sashContainer; + + private final List resourcesToLoad; + + MultiDiagramEditorSelectionContext(IMultiDiagramEditor editor) { + super(); + + init(editor); + + resourcesToLoad = computeResourcesToLoad(editor); + + IPage active = sashContainer.getActiveSashWindowsPage(); + DiagramPageContext activePage = null; + + Set visiblePages = Sets.newIdentityHashSet(); + visiblePages.addAll(sashContainer.getVisiblePages()); + + List allPages = getAllPages(sashContainer); + + for (IPage page : allPages) { + final DelegatingReloadContext delegator = (page instanceof IEditorPage) ? add(new DelegatingReloadContext(((IEditorPage) page).getIEditorPart())) : null; + DiagramPageContext context; + + if (page == active) { + // This one will have the selection of the active page + context = new DiagramPageContext(new VisiblePageSelectionProvider(page), page, delegator); + activePage = context; + } else { + if (visiblePages.contains(page)) { + // This one must be selected in its folder in order to make it visible again + context = new DiagramPageContext(new VisiblePageSelectionProvider(page), page, delegator); + } else { + context = new DiagramPageContext(EmptySelectionProvider.INSTANCE, page, delegator); + } + + // We make sure always to restore the active page last + // so that it will not only be visible but also the + // over-all active page + add(context); + } + } + + if (activePage != null) { + // Restore this one last + add(activePage); + } + } + + @Override + public void dispose() { + sashContainer = null; + super.dispose(); + } + + private List getAllPages(ISashWindowsContainer container) { + final List result = Lists.newArrayList(); + + container.visit(new IPageVisitor() { + + @Override + public void accept(IEditorPage page) { + result.add(page); + } + + @Override + public void accept(IComponentPage page) { + result.add(page); + } + }); + + return result; + } + + private void init(IMultiDiagramEditor editor) { + sashContainer = AdapterUtils.adapt(editor, ISashWindowsContainer.class, null); + } + + void restore(IMultiDiagramEditor editor) { + init(editor); + + // Forcibly re-load all previously loaded resources to that + // (a) we don't lose imports that weren't yet used, and + // (b) we can restore selections in resources that wouldn't be loaded until proxies resolve later + reloadResources(editor); + + ISelectionProvider selectionProvider = new VisiblePageSelectionProvider(); + for (DiagramPageContext next : getReloadContexts(DiagramPageContext.class)) { + next.restore(selectionProvider); + } + } + + protected List computeResourcesToLoad(IMultiDiagramEditor editor) { + List result = null; + + ResourceSet rset = getResourceSet(editor); + if (rset != null) { + result = Lists.newArrayListWithCapacity(rset.getResources().size()); + + for (Resource next : rset.getResources()) { + if (next.isLoaded()) { + result.add(next.getURI()); + } + } + } + + return result; + } + + protected void reloadResources(IMultiDiagramEditor editor) { + if (resourcesToLoad != null) { + ResourceSet rset = getResourceSet(editor); + if (rset != null) { + for (URI next : resourcesToLoad) { + try { + rset.getResource(next, true); + } catch (Exception e) { + Activator.log.error("Failed to restore loaded resource: " + next, e); //$NON-NLS-1$ + } + } + } + } + } + + protected final ResourceSet getResourceSet(IMultiDiagramEditor editor) { + ResourceSet result = null; + + EditingDomain editingDomain = editor.getAdapter(EditingDomain.class); + if (editingDomain != null) { + result = editingDomain.getResourceSet(); + } + + return result; + } + + // + // Nested types + // + + private class DiagramPageContext extends EMFSelectionContext { + + private URI pageRef; + + private DelegatingReloadContext pageContext; + + DiagramPageContext(ISelectionProvider structuredSelectionProvider, IPage page, DelegatingReloadContext pageContext) { + super(structuredSelectionProvider); + + this.pageContext = pageContext; + this.pageRef = getToken(page.getRawModel()); + } + + @Override + public void restore(ISelectionProvider structuredSelectionProvider) { + IPage page = sashContainer.lookupModelPage(resolveToken(pageRef)); + + if ((pageContext != null) && (page instanceof IEditorPage)) { + pageContext.restore(((IEditorPage) page).getIEditorPart()); + } + + super.restore(structuredSelectionProvider); + } + + @Override + protected Object deresolveSelectableElement(Object selectableElement) { + return (selectableElement instanceof IPage) ? ((IPage) selectableElement).getRawModel() : super.deresolveSelectableElement(selectableElement); + } + + @Override + protected Object resolveSelectableElement(Object deresolved) { + return sashContainer.lookupModelPage(deresolved); + } + } + + private static class EmptySelectionProvider implements ISelectionProvider { + + static final EmptySelectionProvider INSTANCE = new EmptySelectionProvider(); + + EmptySelectionProvider() { + super(); + } + + @Override + public ISelection getSelection() { + return StructuredSelection.EMPTY; + } + + @Override + public void setSelection(ISelection selection) { + // Pass + } + + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + // Not needed because the selection is always empty + } + + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + // Not needed because the selection is always empty + } + + } + + private class VisiblePageSelectionProvider implements ISelectionProvider { + + private final IStructuredSelection selection; + + VisiblePageSelectionProvider() { + this(null); + } + + VisiblePageSelectionProvider(IPage visible) { + super(); + + this.selection = (visible == null) ? StructuredSelection.EMPTY : new StructuredSelection(visible); + } + + @Override + public ISelection getSelection() { + return selection; + } + + @Override + public void setSelection(ISelection selection) { + if (!selection.isEmpty()) { + IPage page = (IPage) ((IStructuredSelection) selection).getFirstElement(); + sashContainer.selectPage(page); + } + } + + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + // Not needed + } + + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + // Not needed + } + + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java new file mode 100644 index 00000000000..9ef43cb4cd3 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java @@ -0,0 +1,178 @@ +/***************************************************************************** + * Copyright (c) 2014, 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 469188 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.papyrus.infra.core.operation.DelegatingUndoContext; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.tools.util.PlatformHelper; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; +import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IStorageEditorInput; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.operations.RedoActionHandler; +import org.eclipse.ui.operations.UndoActionHandler; +import org.eclipse.ui.part.IShowInSource; +import org.eclipse.ui.part.ShowInContext; +import org.eclipse.ui.views.properties.PropertyShowInContext; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; + + +/** + * A specialized property-sheet page that knows how to restore the Property Sheet view's input from the workbench part + * that most recently gave it its input, after a {@link CoreMultiDiagramEditor} has been re-loaded. + */ +class MultiDiagramPropertySheetPage extends TabbedPropertySheetPage implements IEditorReloadListener { + + private final CoreMultiDiagramEditor multiDiagramEditor; + + private UndoActionHandler undo; + private RedoActionHandler redo; + private DelegatingUndoContext undoContext; + + public MultiDiagramPropertySheetPage(CoreMultiDiagramEditor editor) { + super(editor); + + this.multiDiagramEditor = editor; + IReloadableEditor.Adapter.getAdapter(editor).addEditorReloadListener(this); + } + + @Override + public void dispose() { + IReloadableEditor.Adapter.getAdapter(multiDiagramEditor).removeEditorReloadListener(this); + + if (undo != null) { + undo.dispose(); + } + if (redo != null) { + redo.dispose(); + } + + super.dispose(); + } + + @Override + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if (selection.isEmpty() && (part instanceof IMultiDiagramEditor)) { + // Perhaps the user selected a page such as the Welcome Page that + // isn't an editor and so doesn't have a selection + IMultiDiagramEditor editor = (IMultiDiagramEditor) part; + ISashWindowsContainer sash = editor.getAdapter(ISashWindowsContainer.class); + if (sash != null) { + if ((sash.getActiveEditor() == null) && (sash.getActiveSashWindowsPage() != null)) { + // Yep, that's the case, here. So show the properties of the input + // resource (usually a DI file) + IEditorInput input = editor.getEditorInput(); + Object newSelection; + if (input instanceof IFileEditorInput) { + newSelection = ((IFileEditorInput) input).getFile(); + } else if (input instanceof IStorageEditorInput) { + IStorageEditorInput storageInput = (IStorageEditorInput) input; + try { + newSelection = storageInput.getStorage(); + } catch (CoreException e) { + newSelection = storageInput; + } + } else if (input instanceof IURIEditorInput) { + newSelection = ((IURIEditorInput) input).getURI(); + } else if (input instanceof URIEditorInput) { + newSelection = ((URIEditorInput) input).getURI(); + } else { + newSelection = null; + } + + if (newSelection != null) { + selection = new StructuredSelection(newSelection); + } + } + } + } + + super.selectionChanged(part, selection); + } + + @Override + public void editorAboutToReload(EditorReloadEvent event) { + Object propertySheet = getSite().getService(IViewPart.class); + if (propertySheet instanceof IShowInSource) { + ShowInContext context = ((IShowInSource) propertySheet).getShowInContext(); + + if (context instanceof PropertyShowInContext) { + IWorkbenchPart inputPart = ((PropertyShowInContext) context).getPart(); + if (inputPart != null) { + event.putContext(inputPart); + } + } + } + } + + @Override + public void editorReloaded(EditorReloadEvent event) { + final IWorkbenchPart inputPart = (IWorkbenchPart) event.getContext(); + if (inputPart != null) { + final Object propertySheet = getSite().getService(IViewPart.class); + if (propertySheet instanceof IPartListener) { + // Kick it with this part + ((IPartListener) propertySheet).partActivated(inputPart); + + // And again later to get its new selection (we don't know when its selection may be restored relative to us) + getSite().getShell().getDisplay().asyncExec(new Runnable() { + + @Override + public void run() { + ISelectionProvider selectionProvider = inputPart.getSite().getSelectionProvider(); + if (selectionProvider != null) { + ((ISelectionListener) propertySheet).selectionChanged(inputPart, selectionProvider.getSelection()); + } + } + }); + } + } + + // The editor will have a new undo context (because it will have a new editing domain) + if (undoContext != null) { + undoContext.setDelegate(PlatformHelper.getAdapter(multiDiagramEditor, IUndoContext.class)); + } + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + + undoContext = new DelegatingUndoContext(); + undoContext.setDelegate(PlatformHelper.getAdapter(multiDiagramEditor, IUndoContext.class)); + + undo = new UndoActionHandler(multiDiagramEditor.getSite(), undoContext); + redo = new RedoActionHandler(multiDiagramEditor.getSite(), undoContext); + + actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo); + actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo); + } + + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageIconRegistryServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageIconRegistryServiceFactory.java new file mode 100644 index 00000000000..21eb6a2cfdc --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageIconRegistryServiceFactory.java @@ -0,0 +1,71 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.PluggableEditorFactoryReader; + +/** + * Service Factory to register {@link IPageIconsRegistry}. + * + * @author cedric dumoulin + * + */ +public class PageIconRegistryServiceFactory implements IServiceFactory { + + private PageIconsRegistry pageIconsRegistry; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + if (pageIconsRegistry != null) { + pageIconsRegistry.dispose(); + } + } + + /** + * Create and populate a {@link PageIconsRegistry}. Return it as the service + * instance. + * + * @return + */ + @Override + public Object createServiceInstance() { + if (pageIconsRegistry == null) { + pageIconsRegistry = new PageIconsRegistry(); + PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID); + editorReader.populate(pageIconsRegistry); + } + return pageIconsRegistry; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageMngrServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageMngrServiceFactory.java new file mode 100644 index 00000000000..b7657e6ce1a --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PageMngrServiceFactory.java @@ -0,0 +1,83 @@ +/***************************************************************************** + * Copyright (c) 2011, 2016 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * LIFL - Initial API and implementation + * Christian W. Damus - bugs 415638, 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.editor; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; + +/** + * A service factory to create the {@link IPageMngr} service. This + * serviceFactory depends on {@link ISashWindowsContentProvider} service. + * + * @author cedric dumoulin + * + */ +public class PageMngrServiceFactory implements IServiceFactory { + + /** + * The sashModelMangr. + */ + private DiSashModelManager sashModelMngr; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + + // Get required services + sashModelMngr = servicesRegistry.getService(DiSashModelManager.class); + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() + * + * @return + * @throws ServiceException + * if the required sash model manager service is unavailable + */ + @Override + public Object createServiceInstance() throws ServiceException { + if (sashModelMngr == null) { + throw new ServiceNotFoundException(DiSashModelManager.class.getName()); + } + return sashModelMngr.getIPageManager(); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PapyrusPageInput.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PapyrusPageInput.java new file mode 100644 index 00000000000..7b69d7863d9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/PapyrusPageInput.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2013 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.ui.editor; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.util.URI; +import org.eclipse.ui.part.FileEditorInput; + +/** + * Basic implementation of {@link IPapyrusPageInput} + * + * @author Camille Letavernier + */ +public class PapyrusPageInput extends FileEditorInput implements IPapyrusPageInput { + + private final URI[] pages; + + private final boolean closeOtherPages; + + /** + * Creates a new PapyrusPageInput + * + * @param diFile + * The file resource + * @param pages + * The pageIdentifiers of the pages to open + * @param closeOtherPages + * True if only the selected pages should be opened. All other pages will be closed. + */ + public PapyrusPageInput(IFile diFile, URI[] pages, boolean closeOtherPages) { + super(diFile); + this.pages = pages; + this.closeOtherPages = closeOtherPages; + } + + /** + * {@inheritDoc} + */ + @Override + public URI[] getPages() { + return pages; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean closeOtherPages() { + return closeOtherPages; + } + + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/CompositeReloadContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/CompositeReloadContext.java new file mode 100644 index 00000000000..3eabad5cbf3 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/CompositeReloadContext.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import java.util.Collection; +import java.util.Collections; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + + +/** + * An {@linkplain EditorReloadEvent#putContext(Object) editor reload context} that composes other reload contexts. + * This should be used whenever a {@linkplain IReloadContextProvider reload context provider} supplies multiple + * reload contexts, to ensure that they are properly initialized by the reload system. + */ +public class CompositeReloadContext implements IDisposableReloadContext, IAdaptable { + + private final Collection reloadContexts; + + public CompositeReloadContext() { + this(Collections.EMPTY_LIST); + } + + public CompositeReloadContext(Iterable reloadContexts) { + super(); + + this.reloadContexts = Lists.newArrayList(reloadContexts); + } + + public T add(T reloadContext) { + reloadContexts.add(reloadContext); + return reloadContext; + } + + public Iterable getReloadContexts() { + return Collections.unmodifiableCollection(reloadContexts); + } + + public Iterable getReloadContexts(Class type) { + return Iterables.filter(getReloadContexts(), type); + } + + @Override + public void dispose() { + for (Object next : reloadContexts) { + if (next instanceof IDisposableReloadContext) { + ((IDisposableReloadContext) next).dispose(); + } + } + + reloadContexts.clear(); + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; + } + + private IInternalEMFSelectionContext getEMFContext() { + IInternalEMFSelectionContext result = null; + + for (Object next : reloadContexts) { + if (AdapterUtils.adapt(next, IInternalEMFSelectionContext.class, null) != null) { + // We need the adapter + result = new IInternalEMFSelectionContext.Composite(this); + break; + } + } + + return result; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/DelegatingReloadContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/DelegatingReloadContext.java new file mode 100644 index 00000000000..718b376c2ba --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/DelegatingReloadContext.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; + + +/** + * An {@linkplain EditorReloadEvent#putContext(Object) editor reload context} that delegates to another reload context. + * This should be used whenever a {@linkplain IReloadContextProvider reload context provider} is needed to get a reload + * context to delegate to. + */ +public class DelegatingReloadContext implements IDisposableReloadContext, IAdaptable { + + private Object delegate; + + public DelegatingReloadContext(Object reloadContextProvider) { + super(); + + IReloadContextProvider provider = AdapterUtils.adapt(reloadContextProvider, IReloadContextProvider.class, null); + if (provider != null) { + delegate = provider.createReloadContext(); + } + } + + @Override + public void dispose() { + if (delegate instanceof IDisposableReloadContext) { + ((IDisposableReloadContext) delegate).dispose(); + } + + delegate = null; + } + + public Object getDelegate() { + return delegate; + } + + public void restore(Object reloadContextProvider) { + if (delegate != null) { + IReloadContextProvider provider = AdapterUtils.adapt(reloadContextProvider, IReloadContextProvider.class, null); + if (provider != null) { + provider.restore(delegate); + } + } + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; + } + + private IInternalEMFSelectionContext getEMFContext() { + IInternalEMFSelectionContext result = null; + + if ((delegate != null) && (AdapterUtils.adapt(delegate, IInternalEMFSelectionContext.class, null) != null)) { + // We need the adapter + result = new IInternalEMFSelectionContext.Delegating(this); + } + + return result; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFSelectionContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFSelectionContext.java new file mode 100644 index 00000000000..e8eea1033cc --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFSelectionContext.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.viewers.ISelectionProvider; + + +/** + * A convenient selection re-load context for UIs that present EMF-based content. + */ +public class EMFSelectionContext extends SelectionContext implements IAdaptable { + + private IInternalEMFSelectionContext emfContext; + + public EMFSelectionContext(ISelectionProvider structuredSelectionProvider) { + super(structuredSelectionProvider); + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; + } + + final IInternalEMFSelectionContext getEMFContext() { + if (emfContext == null) { + emfContext = new IInternalEMFSelectionContext.Default(); + } + return emfContext; + } + + @Override + protected URI getToken(Object object) { + return getEMFContext().getToken(object); + } + + @Override + protected Object resolveToken(URI token) { + return getEMFContext().resolveToken(token); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFTreeViewerContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFTreeViewerContext.java new file mode 100644 index 00000000000..a6f99008f06 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EMFTreeViewerContext.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.viewers.AbstractTreeViewer; + +/** + * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore + * the expansion and selection state of nodes in an EMF-based tree viewer. + */ +public class EMFTreeViewerContext extends TreeViewerContext implements IAdaptable { + + private IInternalEMFSelectionContext emfContext; + + public EMFTreeViewerContext(AbstractTreeViewer viewer) { + super(viewer); + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + return (adapter == IInternalEMFSelectionContext.class) ? getEMFContext() : null; + } + + final IInternalEMFSelectionContext getEMFContext() { + if (emfContext == null) { + emfContext = new IInternalEMFSelectionContext.Default(); + } + return emfContext; + } + + @Override + protected URI getToken(Object object) { + return getEMFContext().getToken(object); + } + + @Override + protected Object resolveToken(URI token) { + return getEMFContext().resolveToken(token); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadAdapter.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadAdapter.java new file mode 100644 index 00000000000..5015f26011e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadAdapter.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + + + +/** + * Convenience superclass for selective implementation of editor reload call-backs. + */ +public class EditorReloadAdapter implements IEditorReloadListener { + + public EditorReloadAdapter() { + super(); + } + + @Override + public void editorAboutToReload(EditorReloadEvent event) { + // Pass + } + + @Override + public void editorReloaded(EditorReloadEvent event) { + // Pass + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadEvent.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadEvent.java new file mode 100644 index 00000000000..c4d13f721b4 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/EditorReloadEvent.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import java.util.EventObject; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; + +import com.google.common.base.Supplier; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; + + +/** + * The event object for notifications of each phase in the reloading of a {@linkplain IReloadableEditor reloadable editor}. + */ +public class EditorReloadEvent extends EventObject { + + private static final long serialVersionUID = 1L; + + public static final int ABOUT_TO_RELOAD = 1; + + public static final int RELOADED = 2; + + private int type; + + private transient Map context; + + private transient IEditorReloadListener currentListener; + + public EditorReloadEvent(IMultiDiagramEditor editor) { + super(editor); + } + + public final IMultiDiagramEditor getEditor() { + return (IMultiDiagramEditor) getSource(); + } + + public final int getEventType() { + return type; + } + + /** + * Puts some opaque representation of contextual state for the caller to retrieve later when an editor is {@linkplain IEditorReloadListener#editorReloaded(EditorReloadEvent) reloaded}. + * The canonical example of this usage is storing state such as selection, expanded tree nodes, etc. to restore after re-building a UI that + * depends on the reloaded editor. After the editor re-load completes and all listeners are notified of that, then all context objects are + * released. Any that implement the {@link IDisposableReloadContext} interface are disposed according to that protocol. This is done even if it + * happens that the editor re-load procedure cannot complete normally and the editor is forced to close without notifying the post-reload + * listeners. + * + * @param object + * some state to stash for later retrieval following the re-loading of the editor + * + * @return the previous context object, if any (there normally wouldn't be as each listener that is invoked has its own context storage + * + * @throws IllegalStateException + * on any attempt to invoke this method except during an {@link IEditorReloadListener#editorAboutToReload(EditorReloadEvent)} call-back + */ + public Object putContext(Object object) { + checkContext(ABOUT_TO_RELOAD); + + IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(object, IInternalEMFSelectionContext.class, null); + if (emfContext != null) { + initContext(emfContext); + } + + return context.put(currentListener, object); + } + + /** + * Retrieves an opaque representation of contextual state that was previously {@linkplain #putContext(Object) put} by the caller. + * + * @return the previously stashed object, or {@code null} if none + * + * @throws IllegalStateException + * on any attempt to invoke this method except during an {@link IEditorReloadListener#editorReloaded(EditorReloadEvent)} call-back + */ + public Object getContext() { + checkContext(RELOADED); + return context.get(currentListener); + } + + private void initContext(IInternalEMFSelectionContext context) { + Supplier resourceSetSupplier = new Supplier() { + + @Override + public ResourceSet get() { + try { + return getEditor().getServicesRegistry().getService(ModelSet.class); + } catch (ServiceException e) { + Activator.log.error(e); + throw new IllegalStateException("Invalid service registry in editor"); //$NON-NLS-1$ + } + } + }; + + context.setResourceSetSupplier(resourceSetSupplier); + } + + protected final void checkContext(int phase) { + if (currentListener == null) { + throw new IllegalStateException("Not in an IEditorReloadListener call-back"); //$NON-NLS-1$ + } + + if (phase != this.type) { + throw new IllegalStateException(String.format("Not in '%s' listener call-back", (phase == ABOUT_TO_RELOAD) ? "editorAboutToReload" : "editorReloaded")); + } + } + + public final void dispatchEditorAboutToReload(Iterable listeners) { + context = Maps.newHashMap(); + type = ABOUT_TO_RELOAD; + + for (Iterator iter = listeners.iterator(); iter.hasNext();) { + currentListener = iter.next(); + + try { + currentListener.editorAboutToReload(this); + } catch (Exception e) { + Activator.log.error("Uncaught exception in editor reload listener.", e); //$NON-NLS-1$ + } finally { + currentListener = null; + } + } + } + + public final void dispatchEditorReloaded(Iterable listeners) { + type = RELOADED; + + for (Iterator iter = listeners.iterator(); iter.hasNext();) { + currentListener = iter.next(); + + try { + currentListener.editorReloaded(this); + } catch (Exception e) { + Activator.log.error("Uncaught exception in editor reload listener.", e); //$NON-NLS-1$ + } finally { + currentListener = null; + } + } + } + + public void dispose() { + if (context != null) { + Error error = null; + + try { + for (IDisposableReloadContext next : Iterables.filter(context.values(), IDisposableReloadContext.class)) { + try { + next.dispose(); + } catch (Exception e) { + Activator.log.error("Uncaught exception in editor reload context disposal.", e); //$NON-NLS-1$ + } catch (Error e) { + if (error == null) { + error = e; + } + Activator.log.error("Uncaught exception in editor reload context disposal.", e); //$NON-NLS-1$ + } + } + } finally { + context = null; + } + + if (error != null) { + throw error; + } + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IDisposableReloadContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IDisposableReloadContext.java new file mode 100644 index 00000000000..8aff9ccf83b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IDisposableReloadContext.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +/** + * Protocol implemented by {@link EditorReloadEvent} context objects that must be disposed when they are no longer needed. + * + * @see EditorReloadEvent#dispose() + */ +public interface IDisposableReloadContext { + + void dispose(); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IEditorReloadListener.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IEditorReloadListener.java new file mode 100644 index 00000000000..2114d555152 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IEditorReloadListener.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import java.util.EventListener; + +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; + + +/** + * A protocol for notification of the phases of re-loading of an {@link IReloadableEditor}. + */ +public interface IEditorReloadListener extends EventListener { + + /** + * Notifies that an editor is about to reload. Implementors may put stuff into the {@code event}'s {@link EditorReloadEvent#putContext(Object) + * context} to retrieve in an eventual {@linkplain #editorReloaded(EditorReloadEvent) }re-load} notification. The canonical example of this + * usage is storing state such as selection, expanded tree nodes, etc. to restore after re-building a UI that depends on the reloaded + * editor. + * + * @param event + * notification that an editor is going to re-load itself + */ + void editorAboutToReload(EditorReloadEvent event); + + /** + * Notifies that an editor has reloaded. Implementors may retrieve from the {@code event} any {@link EditorReloadEvent#getContext() + * context} that they put in {@linkplain #editorAboutToReload(EditorReloadEvent) before} the re-load. + * + * @param event + * notification that an editor has reloaded + */ + void editorReloaded(EditorReloadEvent event); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IInternalEMFSelectionContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IInternalEMFSelectionContext.java new file mode 100644 index 00000000000..f8bda865a97 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IInternalEMFSelectionContext.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; + +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; + + +/** + * An internal interface provided (usually as an {@linkplain IAdaptable#getAdapter(Class) adapter}) by EMF-based {@linkplain SelectionContext + * selection contexts}. + */ +interface IInternalEMFSelectionContext { + + void setResourceSetSupplier(Supplier resourceSetSupplier); + + URI getToken(Object object); + + Object resolveToken(URI token); + + class Default implements IInternalEMFSelectionContext { + + Supplier resourceSetSupplier; + + Default() { + super(); + } + + @Override + public void setResourceSetSupplier(Supplier resourceSetSupplier) { + this.resourceSetSupplier = Suppliers.memoize(resourceSetSupplier); + } + + @Override + public URI getToken(Object object) { + return (object instanceof EObject) ? EcoreUtil.getURI((EObject) object) : null; + } + + @Override + public Object resolveToken(URI token) { + ResourceSet rset = (resourceSetSupplier == null) ? null : resourceSetSupplier.get(); + return (rset == null) ? null : rset.getEObject(token, true); + } + + } + + class Composite extends Default { + + private final CompositeReloadContext composite; + + Composite(CompositeReloadContext composite) { + super(); + + this.composite = composite; + } + + @Override + public void setResourceSetSupplier(Supplier resourceSetSupplier) { + super.setResourceSetSupplier(resourceSetSupplier); + + for (Object next : composite.getReloadContexts()) { + IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(next, IInternalEMFSelectionContext.class, null); + if (emfContext != null) { + // Pass along the memoizer so that we can all share it + emfContext.setResourceSetSupplier(this.resourceSetSupplier); + } + } + } + } + + class Delegating extends Default { + + private final DelegatingReloadContext delegating; + + Delegating(DelegatingReloadContext delegating) { + super(); + + this.delegating = delegating; + } + + @Override + public void setResourceSetSupplier(Supplier resourceSetSupplier) { + super.setResourceSetSupplier(resourceSetSupplier); + + IInternalEMFSelectionContext emfContext = AdapterUtils.adapt(delegating.getDelegate(), IInternalEMFSelectionContext.class, null); + if (emfContext != null) { + // Pass along the memoizer so that we can all share it + emfContext.setResourceSetSupplier(this.resourceSetSupplier); + } + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IReloadContextProvider.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IReloadContextProvider.java new file mode 100644 index 00000000000..f3449f59be9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/IReloadContextProvider.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + + +/** + * An adapter protocol for objects that can provide {@code context}s to be included in the + * re-load state of dependent parts in an {@link EditorReloadEvent}, for the purpose of + * restoring the state of those objects after re-load has completed. + */ +public interface IReloadContextProvider { + + /** + * Creates an opaque token from which the receiver can be {@linkplain #restore(Object) restored} after the editor has reloaded. + * + * @return an opaque editor re-load context, or {@code null} if none is needed on this occasion (for example because the receiver + * is in its default state) + */ + Object createReloadContext(); + + /** + * Reloads the receiver's state from a token previously {@linkplain #createReloadContext() provided}. + * + * @param reloadContext + * the opaque re-load context token + */ + void restore(Object reloadContext); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/SelectionContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/SelectionContext.java new file mode 100644 index 00000000000..15d58b5c4a1 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/SelectionContext.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import java.util.List; + +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import com.google.common.collect.Lists; + +/** + * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore + * the selection state a selection provider; + * + * @param + * the type of selection provider + * @param + * the type of token used to restore the selection state + */ +public abstract class SelectionContext { + + private List selection = Lists.newArrayList(); + + public SelectionContext(V structuredSelectionProvider) { + for (Object next : ((IStructuredSelection) structuredSelectionProvider.getSelection()).toList()) { + T token = token(next); + if (token != null) { + selection.add(token); + } + } + } + + public void restore(V structuredSelectionProvider) { + List select = Lists.newArrayListWithCapacity(selection.size()); + for (T next : selection) { + Object resolved = resolve(next); + if (resolved != null) { + select.add(resolved); + } + } + setSelection(structuredSelectionProvider, select); + } + + T token(Object selectableElement) { + Object deresolved = deresolveSelectableElement(selectableElement); + return (deresolved == null) ? null : getToken(deresolved); + } + + protected Object deresolveSelectableElement(Object selectableElement) { + return selectableElement; + } + + protected abstract T getToken(Object object); + + Object resolve(T token) { + Object deresolved = resolveToken(token); + return (deresolved == null) ? null : resolveSelectableElement(deresolved); + } + + protected Object resolveSelectableElement(Object deresolved) { + return deresolved; + } + + protected abstract Object resolveToken(T token); + + protected void setSelection(V structuredSelectionProvider, List selection) { + structuredSelectionProvider.setSelection(new StructuredSelection(selection)); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/TreeViewerContext.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/TreeViewerContext.java new file mode 100644 index 00000000000..6d70788326c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/reload/TreeViewerContext.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editor.reload; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.StructuredSelection; + +import com.google.common.collect.Lists; + +/** + * A convenient context object for {@link IEditorReloadListener}s to store in an {@link EditorReloadEvent} to capture and restore + * the expansion and selection state of nodes in a tree viewer. + */ +public abstract class TreeViewerContext extends SelectionContext { + + private List expandedNodes = Lists.newArrayList(); + + public TreeViewerContext(AbstractTreeViewer viewer) { + super(viewer); + + for (Object next : viewer.getExpandedElements()) { + T token = token(next); + if (token != null) { + expandedNodes.add(token); + } + } + } + + @Override + public void restore(AbstractTreeViewer viewer) { + List expand = Lists.newArrayListWithCapacity(expandedNodes.size()); + for (T next : expandedNodes) { + Object resolved = resolve(next); + if (resolved != null) { + expand.add(resolved); + } + } + setExpandedElements(viewer, expand); + + super.restore(viewer); + } + + @Override + protected void setSelection(AbstractTreeViewer viewer, List selection) { + viewer.setSelection(new StructuredSelection(selection), true); + } + + protected void setExpandedElements(AbstractTreeViewer viewer, Collection toExpand) { + viewer.setExpandedElements(toExpand.toArray()); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorFactory.java new file mode 100644 index 00000000000..182c962b822 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorFactory.java @@ -0,0 +1,57 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; + +/** + * Factory used to get the Icon associated to the editor used to render the + * specified pageIdentifier. + * + * + * @author cedric dumoulin + * + */ +public interface IEditorFactory { + + /** + * Create the {@link IPageModel} for the specified identifier. TODO throw an + * exception encapsulating problems encountered while creating the model. + * + * @param pageIdentifier + * Object identifying an Editor. + * @return PageModel allowing to create the editor. + */ + public IPageModel createIPageModel(Object pageIdentifier); + + /** + * Return true if the factory can create an IPageModel for the specified + * pageIdentifier. Return false otherwise TODO throw an exception + * encapsulating problems encountered while creating the model. + * + * @param pageIdentifier + * The object representing the page to test + * @return + */ + public boolean isPageModelFactoryFor(Object pageIdentifier); + + /** + * The ID of this factory + * + * @return + */ + default String getFactoryID() { + return getClass().getName(); + } + + /** + * The display label of this factory + * + * @return + */ + default String getLabel() { + return getClass().getSimpleName(); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactory.java new file mode 100644 index 00000000000..9ccf1af0cfe --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactory.java @@ -0,0 +1,64 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.swt.graphics.Image; + +/** + * Factory used to create an {@link IPageModel} used by the {@link ISashWindowsContainer} to create an instance of the editor represented + * by the provided Object. Such factory is required by the {@link DiSashModelMngr}. It is called whenever the ISashWindowsContainer need + * to create an editor from an EObject representing this editor in the Di + * implementation of the {@link ISashWindowsContentProvider} + * + * + * @author cedric dumoulin + * + */ +public interface IEditorIconFactory { + + /** + * Get the icon associated to the editor used to render the model. Model + * represent the top level object of a model editor. Can return a cached + * Image. + * + * @param pageIdentifier + * the pageIdentifier representing the Editor. This is usually + * the EObject used to reconstruct the editor. + * @return the icon representing the editor + */ + public Image getEditorIcon(Object pageIdentifier); + + /** + * Create the icon associated to the editor used to render the model. Model + * represent the top level object of a model editor. Always return a newly + * created Image. + * + * @param pageIdentifier + * the pageIdentifier representing the Editor. This is usually + * the EObject used to reconstruct the editor. + * @return the icon representing the editor + */ + public Image createEditorIcon(Object pageIdentifier); + + /** + * Return true if the factory can create an IPageModel for the specified + * pageIdentifier. Return false otherwise TODO throw an exception + * encapsulating problems encountered while creating the model. + * + * @param pageIdentifier + * The object representing the page to test + * @return + */ + public boolean isPageModelFactoryFor(Object pageIdentifier); + + /** + * Dispose this factory + */ + public void dispose(); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactoryExtended.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactoryExtended.java new file mode 100644 index 00000000000..06d9344e865 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IEditorIconFactoryExtended.java @@ -0,0 +1,30 @@ +/** + * 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: + * Atos - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +/** + * + * @author "Arthur Daussy arthur.daussy@atos.net" + * + */ +public interface IEditorIconFactoryExtended extends IEditorIconFactory { + + /** + * Return the icon URL associated to the editor used to render the model. Model represent the top level + * object of a model editor. + * + * @param pageIdentifier + * @return + */ + public String getURLMainIcon(Object pageIdentifier); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistry.java new file mode 100644 index 00000000000..6b117ecbeaa --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistry.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +import org.eclipse.swt.graphics.Image; + +/** + * Registry used to get Icons associated to an editor. + * + * @author cedric dumoulin + */ +public interface IPageIconsRegistry { + + /** + * Get the icon associated to the editor used to render the model. Model + * represent the top level object of a model editor. + * + * @param model + * the model representing the Editor. This is usually the EObject + * used to reconstruct the editor. + * @return the icon representing the editor + */ + public Image getEditorIcon(Object model); + + /** + * Dispose this registry + */ + public void dispose(); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistryExtended.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistryExtended.java new file mode 100644 index 00000000000..c8153b3bef4 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/IPageIconsRegistryExtended.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2011 Atos Origin. + * + * 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: + * Atos Origin - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +/** + * Extends IPageIconsRegistry in order to offer a second methods which will give back the URL of the requested Icon + * + * @author "Arthur Daussy arthur.daussy@atos.net" + * + */ +public interface IPageIconsRegistryExtended extends IPageIconsRegistry { + + /** + * Get the URL icon associated to the editor used to render the model. Model represent the top level + * object of a model editor. + * + * @param model + * @return {@link String} which represent the URL of the resource + */ + public String getEditorURLIcon(Object model); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageIconsRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageIconsRegistry.java new file mode 100644 index 00000000000..d60e8f71f96 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageIconsRegistry.java @@ -0,0 +1,118 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.graphics.Image; + +/** + * Concrete implementation of the {@link IPageIconsRegistry}. This + * implementation allows to add and remove {@link IPageIconsRegistry}. + * + * + * @author cedric dumoulin + */ +public class PageIconsRegistry implements IPageIconsRegistryExtended { + + /** list of registered icon factories */ + protected List pageIcons = new ArrayList(); + + /** + * Constructor. + * + * @param editorFactoryRegistry + * @param servicesRegistry + */ + public PageIconsRegistry() { + + } + + /** + * Walk each registered {@link IEditorFactory} to find the one handling the + * specified pageIdentifier. Call the corresponding method in the found + * pageIdentifier. + * + * TODO Throw an exception to report errors. + * + * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) + */ + @Override + public Image getEditorIcon(Object pageIdentifier) { + + for (IEditorIconFactory factory : getPageIcons()) { + if (factory.isPageModelFactoryFor(pageIdentifier)) { + { + // return factory.getEditorIcon(pageIdentifier); + return factory.getEditorIcon(pageIdentifier); + } + } + } + // no editor found ! + // TODO Throw an exception. + // throw new EditorNotFoundException("No editor registered for '" + + // pageIdentifier + "'."); + return null; + } + + /** + * @return the editorFactories + */ + protected List getPageIcons() { + return pageIcons; + } + + /** + * Add the specified {@link IEditorFactory} + * + * @param editorIconFactory + */ + public void add(IEditorIconFactory editorIconFactory) { + // This should never happen + if (editorIconFactory == null) { + throw new RuntimeException("Parameter should not be null."); //$NON-NLS-1$ + } + + pageIcons.add(editorIconFactory); + } + + /** + * Remove the specified {@link IEditorFactory} + * + * @param editorIconFactory + */ + public void remove(IEditorIconFactory editorIconFactory) { + pageIcons.remove(editorIconFactory); + } + + /** + * Return the path to the icon ressource. + * + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistryExtended#getEditorURLIcon(java.lang.Object) + * + * @param model + * @return + */ + @Override + public String getEditorURLIcon(Object model) { + for (IEditorIconFactory factory : getPageIcons()) { + if (factory.isPageModelFactoryFor(model)) { + { + if (factory instanceof IEditorIconFactoryExtended) { + return ((IEditorIconFactoryExtended) factory).getURLMainIcon(model); + } + } + } + } + return ""; + } + + @Override + public void dispose() { + for (IEditorIconFactory factory : pageIcons) { + factory.dispose(); + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageModelFactoryRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageModelFactoryRegistry.java new file mode 100644 index 00000000000..32774bb7a25 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/PageModelFactoryRegistry.java @@ -0,0 +1,165 @@ +/***************************************************************************** + * Copyright (c) 2009 - 2015 CEA LIST & LIFL + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Camille Letavernier (CEA LIST) - camille.letavernier@cea.fr - Bug 476625 + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.editorsfactory; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory; +import org.eclipse.papyrus.infra.ui.Activator; + +/** + * Concrete implementation of the {@link IPageModelFactory} required by the di + * implementation of {@link ISashWindowsContentProvider}. This implementation + * allows to add and remove {@link IEditorFactory}. + * + * + * @author cedric dumoulin + */ +public class PageModelFactoryRegistry implements IPageModelFactory { + + /** ordered list of editor factories */ + protected List editorFactories = new ArrayList(); + + /** + * Constructor. + * + * @param editorFactoryRegistry + * @param servicesRegistry + */ + public PageModelFactoryRegistry() { + + } + + /** + * Walk each registered {@link IEditorFactory} to find the one handling the + * specified pageIdentifier. Call the corresponding method in the found + * pageIdentifier. + * + * TODO Throw an exception to report errors. + * + * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) + */ + @Override + public IPageModel createIPageModel(Object pageIdentifier) { + return createIPageModel(pageIdentifier, null); + } + + /** + * Walk each registered {@link IEditorFactory} to find the one handling the + * specified pageIdentifier. Call the corresponding method in the found + * pageIdentifier. + * + * If several factories match the selected page, use the favorite editor. + * If the favorite editor is not available, use the priority mechanism + * + * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#createIPageModel(java.lang.Object) + */ + @Override + public IPageModel createIPageModel(Object pageIdentifier, String favoriteEditorID) { + + IEditorFactory factory = getFactoryFor(pageIdentifier, favoriteEditorID); + if (factory == null) { + return null; + } + return factory.createIPageModel(pageIdentifier); + } + + /** + * Returns the IEditorFactory for the given pageIdentifier. + * + * If several factories match the page identifier, use the favorite one + * + * @param pageIdentifier + * @return + */ + private IEditorFactory getFactoryFor(Object pageIdentifier, String favoriteEditorID) { + List matchingFactories = new LinkedList<>(); + + for (IEditorFactory factory : getEditorFactories()) { + if (factory.isPageModelFactoryFor(pageIdentifier)) { + matchingFactories.add(factory); + } + } + + if (matchingFactories.isEmpty()) { + return null; + } else if (matchingFactories.size() == 1) { + return matchingFactories.get(0); + } else if (favoriteEditorID != null) { + for (IEditorFactory matchingFactory : matchingFactories) { + if (favoriteEditorID.equals(matchingFactory.getFactoryID())) { + return matchingFactory; + } + } + } + + return matchingFactories.get(0); + } + + /** + * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory#getEditorIDsFor(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public Map getEditorIDsFor(Object pageIdentifier) { + return getEditorFactories().stream() + .filter(f -> f.isPageModelFactoryFor(pageIdentifier)) + .collect(Collectors + .toMap( + f -> f.getFactoryID(), f -> f.getLabel(), // key, value + (v1, v2) -> { // Conflict merger + Activator.log.warn(String.format("Several editors are declared with the same ID: '%s', '%s'", v1, v2)); + return v1; // Any value + } , + LinkedHashMap::new)); // HashMap Supplier + } + + /** + * @return the editorFactories + */ + protected List getEditorFactories() { + return editorFactories; + } + + /** + * Add the specified {@link IEditorFactory} + * + * @param editorFactory + */ + public void add(IEditorFactory editorFactory) { + // This should never happen + if (editorFactory == null) { + throw new IllegalArgumentException("Parameter should not be null."); //$NON-NLS-1$ + } + + editorFactories.add(editorFactory); + } + + /** + * Remove the specified {@link IEditorFactory} + * + * @param editorFactory + */ + public void remove(IEditorFactory editorFactory) { + editorFactories.remove(editorFactory); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/anytype/AnyTypeEditorFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/anytype/AnyTypeEditorFactory.java new file mode 100644 index 00000000000..cbb70c2e4e1 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editorsfactory/anytype/AnyTypeEditorFactory.java @@ -0,0 +1,135 @@ +/***************************************************************************** + * Copyright (c) 2013, 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.editorsfactory.anytype; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IComponentModel; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +/** + * An EditorFactory for "AnyType", i.e. EObject deserialized from unknown Packages + * + * Allows recovery and manipulation of models containing optional EMF components + * + * @author Camille Letavernier + */ +public class AnyTypeEditorFactory extends AbstractEditorFactory { + + public AnyTypeEditorFactory() { + super(null, "AnyTypeHandler"); + } + + @Override + public IPageModel createIPageModel(Object pageIdentifier) { + + final AnyType anyTypeModel = (AnyType) pageIdentifier; + + return new IComponentModel() { + + private AnyType anyType = anyTypeModel; + + @Override + public void dispose() { + // Pass. The tab icon is a workbench-shared image + } + + @Override + public String getTabTitle() { + EClass eClass = anyType.eClass(); + String label; + if (eClass == null) { + label = "component"; + } else { + label = eClass.getName(); + } + return "Missing " + label; + } + + private String getTypeLabel() { + EClass eClass = anyType.eClass(); + String className = eClass == null ? "None" : eClass.getName(); + return className; + } + + private String getNsURI() { + EClass eClass = anyType.eClass(); + EPackage ePackage = eClass == null ? null : eClass.getEPackage(); + String ePackageName = ePackage == null ? "None" : ePackage.getNsURI(); + + return ePackageName; + } + + public Image getComponentIcon() { + return Display.getDefault().getSystemImage(SWT.ICON_WARNING); + } + + @Override + public Image getTabIcon() { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); + } + + @Override + public Object getRawModel() { + return anyType; + } + + public String getErrorText() { + String typeLabel = getTypeLabel(); + String packageURI = getNsURI(); + String message = "A component is missing. The following Model cannot be loaded: " + typeLabel + " (from " + packageURI + ")\n"; + message += "Changes to the model won't be reflected in this editor. This editor will be saved in the current state, i.e. without any data loss. "; + message += "However, this may result in an inconsistent state of this editor when the missing component will be restored\n"; + return message; + } + + @Override + public Composite createPartControl(Composite parent) { + Composite tabComposite = new Composite(parent, SWT.NONE); + tabComposite.setLayout(new GridLayout(2, false)); + + Image componentIcon = getComponentIcon(); + if (componentIcon != null) { + Label errorImageLabel = new Label(tabComposite, SWT.NONE); + errorImageLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); + errorImageLabel.setImage(componentIcon); + } + + Label label = new Label(tabComposite, SWT.WRAP); + label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + label.setText(getErrorText()); + + return tabComposite; + } + }; + } + + @Override + public boolean isPageModelFactoryFor(Object pageIdentifier) { + return pageIdentifier instanceof AnyType; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/ICreationCondition.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/ICreationCondition.java new file mode 100644 index 00000000000..575b769e3ec --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/ICreationCondition.java @@ -0,0 +1,36 @@ +/***************************************************************************** + * Copyright (c) 2009 ATOS ORIGIN. + * + * + * 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 + * + * Tristan Faure (ATOS ORIGIN) tristan.faure@atosorigin.com - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.commands; + +import org.eclipse.emf.ecore.EObject; + +public interface ICreationCondition { + + /** + * This method returns true if the diagram creation is allowed + * + * @param selectedElement + * the element where the diagram is provided + * @return true if the diagram can be created + */ + boolean create(EObject selectedElement); + + /** + * set the command ID in order to take account the environment in order to + * create a diagram + * + * @param commandID + */ + public void setCommand(String commandID); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/IModelCreationCommand.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/IModelCreationCommand.java new file mode 100644 index 00000000000..beb200f6086 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/IModelCreationCommand.java @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.commands; + +import org.eclipse.papyrus.infra.core.resource.ModelSet; + +/** + * The Interface IModelCreationCommand. + */ +public interface IModelCreationCommand { + + /** + * Creates the model. + * + * @param modelSet + * the modelSet set + */ + void createModel(final ModelSet modelSet); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/PerspectiveContextDependence.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/PerspectiveContextDependence.java new file mode 100644 index 00000000000..7d6d993c982 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/commands/PerspectiveContextDependence.java @@ -0,0 +1,51 @@ +/***************************************************************************** + * Copyright (c) 2010 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.commands; + +import org.eclipse.emf.ecore.EObject; + +//FIXME Refactoring Juno : I don't know how to migrate this code +public class PerspectiveContextDependence implements ICreationCondition { + + protected String commandID = null; + + public PerspectiveContextDependence() { + // TODO Auto-generated constructor stub + } + + /** + * {@inheritDoc} + */ + @Override + public boolean create(EObject selectedElement) { + // FIXME Refactoring Juno : I don't know how to migrate this code + // // Get the perspective + // Perspective perspective = ((WorkbenchPage)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()).getActivePerspective(); + // // look for the perspective + // // verify if the command has to be displayed + // if(perspective.getHiddenMenuItems().contains(commandID) && perspective.getHiddenToolbarItems().contains(commandID)) { + // return false; + // } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public void setCommand(String commandID) { + this.commandID = commandID; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/AbstractEditorFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/AbstractEditorFactory.java new file mode 100644 index 00000000000..bde8a69767e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/AbstractEditorFactory.java @@ -0,0 +1,109 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory; + +/** + * Abstract base class for Factory of editors. See {@link IEditorFactory}. + * + * + * @author Remi Schnekenburger + * @author Patrick Tessier + * @author cedric dumoulin + */ +public abstract class AbstractEditorFactory implements IPluggableEditorFactory { + + /** + * Expected Class of the diagram to create. + */ + private Class diagramClass; + + /** Expected diagram type (@see {@link Diagram#getType()}) */ + private String expectedType; + + /** + * EditorDescriptor associated to the factory. TODO : Maybe use individual + * setters to set the requested data (ContributorId and Icon). + */ + protected EditorDescriptor editorDescriptor; + + /** + * ServiceRegistry that can be provided to created editors. + */ + private ServicesRegistry serviceRegistry; + + /** + * Creates a new AbstractEditorFactory. + * + * @param diagramClass + * expected Class of the diagram to create. + * @param expectedType + * expected diagram type (@see {@link Diagram#getType()}) + */ + public AbstractEditorFactory(Class diagramClass, String expectedType) { + assert (expectedType != null); + this.diagramClass = diagramClass; + this.expectedType = expectedType; + } + + /** + * Initialize the factory with useful Classes. + * + * @param serviceRegistry + * Service registry that will be provided to created editor. + * @param editorDescriptor + * Descriptor containing data from the Eclipse Extension. + */ + @Override + public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) { + this.editorDescriptor = editorDescriptor; + this.serviceRegistry = serviceRegistry; + + } + + /** + * @return the serviceRegistry + */ + public ServicesRegistry getServiceRegistry() { + return serviceRegistry; + } + + /** + * Returns the expected class for the diagram implementation + * + * @return the expected class for the diagram implementation + */ + public Class getDiagramClass() { + return diagramClass; + } + + /** + * Returns the expected type of the diagram + * + * @return the expected diagram type (@see {@link Diagram#getType()}) + */ + public String getExpectedType() { + return expectedType; + } + + /** + * @return the editorDescriptor + */ + public EditorDescriptor getEditorDescriptor() { + return editorDescriptor; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptor.java new file mode 100644 index 00000000000..502360c09d7 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptor.java @@ -0,0 +1,168 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * This descriptor describes a nested diagram. It is used by MultiDiagramEditor + * to know about the nested diagram. It is fill by an extension. + * + * @author Cedric Dumoulin + * + */ +public class EditorDescriptor { + + /** + * Editor factory implementation class. + */ + private Class editorFactoryClass; + + /** + * EditorActionBarContributor Id used to search the + * EditorActionBarContributor requested by the editor. + */ + private String actionBarContributorId; + + /** + * The icon representing the diagram + */ + private ImageDescriptor icon; + + /** + * Resource path to the icon + */ + private String iconPath; + + /** + * The order of this factory. Used when several factories match the same element (Diagram...) + * The lower the order, the higher the priority of this factory + */ + private int order; + + /** + * Constructor. + */ + public EditorDescriptor() { + + } + + /** + * + * @param attribute + */ + public void setActionBarContributorId(String actionBarContributorId) { + this.actionBarContributorId = actionBarContributorId; + + } + + /** + * @see org.eclipse.papyrus.infra.core.extension.diagrameditor.IEditorDescriptor#getActionBarContributorId() + * @return + * + */ + public String getActionBarContributorId() { + return actionBarContributorId; + } + + /** + * get the editor icon path + * + * @return the editor icon path + */ + public ImageDescriptor getIcon() { + return icon; + } + + /** + * set the editor icon + * + * @param icon + * the icon path + */ + public void setIcon(ImageDescriptor icon) { + this.icon = icon; + } + + /** + * get the class of the editor factory + * + * @return the class of the editor + */ + public Class getEditorFactoryClass() { + return editorFactoryClass; + } + + /** + * set the editor facoty to this descriptor + * + * @param editorFactoryClass + * the class that represents the editor factory + */ + public void setEditorFactoryClass(Class editorFactoryClass) { + this.editorFactoryClass = editorFactoryClass; + } + + /** + * + * {@inheritDoc} + */ + @Override + public String toString() { + if (editorFactoryClass == null || editorFactoryClass.getName() == null) { + return "[nestedEditor editorFactory:" + editorFactoryClass + "(null)]"; + } + return "[nestedEditor editorFactory:" + editorFactoryClass.getName() + "]"; + } + + public int getOrder() { + return order; + } + + public void setOrder(int order) { + this.order = order; + } + + /** + * Set the URL of the Icon + * + * @param iconPath + * path of the Icon + */ + public void setIconURL(String iconPath) { + this.iconPath = iconPath; + } + + /** + * Get the URL of the based images + * + * @return the path of the mai image. can return null if this property is not set + */ + public String getIconURL() { + return iconPath; + } + + /** + * set the Icon thanks to a {@link IConfigurationElement} and {@link String}which represent the path of the Icon + * + * @param element + * @param iconPath + */ + public void setIcon(IConfigurationElement element, String iconPath, String pluginID) { + setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconPath)); + setIconURL(element.getNamespaceIdentifier() + '/' + iconPath); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptorExtensionFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptorExtensionFactory.java new file mode 100644 index 00000000000..8d57b2fe3ab --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorDescriptorExtensionFactory.java @@ -0,0 +1,99 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import static org.eclipse.papyrus.infra.core.Activator.log; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.papyrus.infra.core.extension.BadNameExtensionException; +import org.eclipse.papyrus.infra.core.extension.ExtensionException; +import org.eclipse.papyrus.infra.core.extension.ExtensionUtils; +import org.eclipse.papyrus.infra.ui.Activator; + +/** + * A factory used to create editor descriptor object from Eclipse extensions points elements. + * + * @author Cedric Dumoulin + * @author Patrick Tessier + */ +public class EditorDescriptorExtensionFactory extends ExtensionUtils { + + /** singleton eINSTANCE of this class */ + public final static EditorDescriptorExtensionFactory eINSTANCE = new EditorDescriptorExtensionFactory(); + + /** constant for the editor diagram **/ + public final static String EDITOR_DIAGRAM_EXTENSIONPOINT = "editorDiagram"; + + /** constant for the attribute factoryClass **/ + public final static String FACTORYCLASS_ATTRIBUTE = "factoryClass"; + + /** constant for the attribute contextId **/ + public final static String ACTIONBARCONTRIBUTORID_ATTRIBUTE = "actionBarContributorId"; + + /** constant for the attribute icon **/ + public final static String ICON_ATTRIBUTE = "icon"; + + /** constant for the order attribute */ + public final static String ORDER_ATTRIBUTE = "order"; + + /** + * @return the eINSTANCE + */ + public static EditorDescriptorExtensionFactory getInstance() { + return eINSTANCE; + } + + /** + * Create a descriptor instance corresponding to the ConfigurationElement. + * + * @param element + * an {@link IConfigurationElement} see eclipse extension point + * @return a nestedEditorDescriptor structure that contains information to create diagrams + * @throws BadNameExtensionException + */ + @SuppressWarnings("unchecked") + public EditorDescriptor createNestedEditorDescriptor(IConfigurationElement element) throws ExtensionException { + EditorDescriptor res; + + checkTagName(element, EDITOR_DIAGRAM_EXTENSIONPOINT); + + res = new EditorDescriptor(); + res.setEditorFactoryClass((Class) parseClass(element, FACTORYCLASS_ATTRIBUTE, EDITOR_DIAGRAM_EXTENSIONPOINT)); + res.setActionBarContributorId(element.getAttribute(ACTIONBARCONTRIBUTORID_ATTRIBUTE)); + + int order = 0; // Default + try { + String orderAttribute = element.getAttribute(ORDER_ATTRIBUTE); + if (orderAttribute != null) { + order = Integer.parseInt(orderAttribute); + } + } catch (NumberFormatException ex) { + Activator.log.warn("Invalid order provided by " + element.getContributor() + ". Order should be an integer value"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + res.setOrder(order); + + String iconPath = element.getAttribute(ICON_ATTRIBUTE); + if (iconPath != null) { + /** Implementation which set the icon and register the complete URL of the icon : Bug eclipse 358732 */ + res.setIcon(element, iconPath, Activator.PLUGIN_ID); + + } + + if (log.isDebugEnabled()) { + log.debug("Read editor descriptor " + res); //$NON-NLS-1$ + } + return res; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorFactoryProxy.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorFactoryProxy.java new file mode 100644 index 00000000000..05fafa58c5d --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorFactoryProxy.java @@ -0,0 +1,137 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory; + +/** + * A proxy implementation of {@link IEditorFactory} used to do lazy + * instantiation of concrete {@link IPluggableEditorFactory}. This class is used + * by the {@link PluggableEditorFactoryReader} + * + * @author cedric dumoulin + * + */ +public class EditorFactoryProxy implements IEditorFactory { + + /** + * The concrete implementation. + */ + private IPluggableEditorFactory editorFactory; + + /** + * EditorDescriptor associated to the factory. + */ + protected EditorDescriptor editorDescriptor; + + /** + * ServiceRegistry that can be provided to created editors. + */ + private ServicesRegistry serviceRegistry; + + /** + * Constructor. + * + * @param serviceRegistry + * @param editorDescriptor + */ + public EditorFactoryProxy(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) { + this.serviceRegistry = serviceRegistry; + this.editorDescriptor = editorDescriptor; + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public IPageModel createIPageModel(Object pageIdentifier) { + try { + return getEditorFactory().createIPageModel(pageIdentifier); + } catch (Exception ex) { + // An error occurred in a contribution. Do not use this factory + return null; + } + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public boolean isPageModelFactoryFor(Object pageIdentifier) { + try { + return getEditorFactory().isPageModelFactoryFor(pageIdentifier); + } catch (Exception ex) { + // An error occurred in a contribution. Do not use this factory + return false; + } + } + + /** + * @return the editorFactory + */ + protected IPluggableEditorFactory getEditorFactory() { + + if (editorFactory == null) { + editorFactory = createEditorFactory(); + } + + return editorFactory; + + } + + /** + * Create an instance of IPluggableEditorFactory as described in the + * editorDescriptor. TODO let propagate the exceptions. + * + * @return + */ + private IPluggableEditorFactory createEditorFactory() { + // Create the requested class. + try { + editorFactory = editorDescriptor.getEditorFactoryClass().newInstance(); + // Set the descriptor. USed by the factory to get the ActionBarId + // and Icon + editorFactory.init(serviceRegistry, editorDescriptor); + return editorFactory; + } catch (InstantiationException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } + + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#getFactoryID() + * + * @return + */ + @Override + public String getFactoryID() { + return getEditorFactory().getFactoryID(); + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#getLabel() + * + * @return + */ + @Override + public String getLabel() { + return getEditorFactory().getLabel(); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorIconFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorIconFactory.java new file mode 100644 index 00000000000..6449012db9b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorIconFactory.java @@ -0,0 +1,152 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.ui.editorsfactory.IEditorIconFactoryExtended; +import org.eclipse.swt.graphics.Image; + +/** + * A factory used to create the Icon associated to an editor TODO Lets have a + * common ancestor for {@link EditorIconFactory} and {@link EditorFactoryProxy} + * + * @author cedric dumoulin + * + */ +public class EditorIconFactory implements IEditorIconFactoryExtended { + + /** + * The concrete implementation. + */ + private IPluggableEditorFactory editorFactory; + + /** + * EditorDescriptor associated to the factory. + */ + protected EditorDescriptor editorDescriptor; + + /** + * Cached image for reuse. + */ + protected Image cachedImage; + + /** + * Constructor. + * + * @param serviceRegistry + * @param editorDescriptor + */ + public EditorIconFactory(EditorDescriptor editorDescriptor) { + this.editorDescriptor = editorDescriptor; + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorIconFactory#getEditorIcon(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public Image getEditorIcon(Object pageIdentifier) { + + if (cachedImage == null) { + cachedImage = createEditorIcon(pageIdentifier); + } + + return cachedImage; + } + + /** + * Create an Image associated to the editor used to render the specified + * pageIdentifier + * + * @return + */ + @Override + public Image createEditorIcon(Object pageIdentifier) { + ImageDescriptor imageDescriptor = editorDescriptor.getIcon(); + if (imageDescriptor == null) { + return null; + } + Image image = imageDescriptor.createImage(); + return image; + } + + /** + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public boolean isPageModelFactoryFor(Object pageIdentifier) { + return getEditorFactory().isPageModelFactoryFor(pageIdentifier); + } + + /** + * @return the editorFactory + */ + protected IPluggableEditorFactory getEditorFactory() { + + if (editorFactory == null) { + editorFactory = createEditorFactory(); + } + + return editorFactory; + + } + + /** + * Create an instance of IPluggableEditorFactory as described in the + * editorDescriptor. TODO let propagate the exceptions. + * + * @return + */ + private IPluggableEditorFactory createEditorFactory() { + // Create the requested class. + try { + editorFactory = editorDescriptor.getEditorFactoryClass().newInstance(); + // Set the descriptor. USed by the factory to get the ActionBarId + // and Icon + // editorFactory.init(serviceRegistry, editorDescriptor); + return editorFactory; + } catch (InstantiationException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } + + } + + /** + * Return the URL of the main icon used to create this icon + * + * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorIconFactory#getURLMainIcon(java.lang.Object) + * + * @param pageIdentifier + * @return + */ + @Override + public String getURLMainIcon(Object pageIdentifier) { + return editorDescriptor.getIconURL(); + } + + /** + * {@inheritDoc} + * + * Dispose the cached image + */ + @Override + public void dispose() { + if (cachedImage != null) { + cachedImage.dispose(); + cachedImage = null; + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorNotFoundException.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorNotFoundException.java new file mode 100644 index 00000000000..6600a83af1b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/EditorNotFoundException.java @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +/** + * Editor was not found. + * + * @author dumoulin + * + */ +@SuppressWarnings("serial") +public class EditorNotFoundException extends MultiDiagramException { + + /** + * + */ + public EditorNotFoundException() { + } + + /** + * @param arg0 + */ + public EditorNotFoundException(String arg0) { + super(arg0); + } + + /** + * @param arg0 + */ + public EditorNotFoundException(Throwable arg0) { + super(arg0); + } + + /** + * @param arg0 + * @param arg1 + */ + public EditorNotFoundException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/IPluggableEditorFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/IPluggableEditorFactory.java new file mode 100644 index 00000000000..ee69f2442a5 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/IPluggableEditorFactory.java @@ -0,0 +1,39 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory; + +/** + * This interface should be implemented by Editor Factories that can be declared + * as Eclipse extension. It extends the {@link IEditorFactory} by adding methods + * to initialize the factory with multieditor ServiceRegistry and associated + * editor data. + * + * @author C�dric Dumoulin + * + */ +public interface IPluggableEditorFactory extends IEditorFactory { + + /** + * Initialize the factory with useful Classes. + * + * @param serviceRegistry + * Service registry that will be provided to created editor. + * @param editorDescriptor + * Descriptor containing data from the Eclipse Extension. + */ + public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/MultiDiagramException.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/MultiDiagramException.java new file mode 100644 index 00000000000..81f1f7ccac4 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/MultiDiagramException.java @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +/** + * Root Exception of MultiDiagram exception + * + * @author dumoulin + * + */ +@SuppressWarnings("serial") +public class MultiDiagramException extends Exception { + + /** + * + */ + public MultiDiagramException() { + } + + /** + * @param arg0 + */ + public MultiDiagramException(String arg0) { + super(arg0); + } + + /** + * @param arg0 + */ + public MultiDiagramException(Throwable arg0) { + super(arg0); + } + + /** + * @param arg0 + * @param arg1 + */ + public MultiDiagramException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/PluggableEditorFactoryReader.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/PluggableEditorFactoryReader.java new file mode 100644 index 00000000000..75dc1d7cc96 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/extension/diagrameditor/PluggableEditorFactoryReader.java @@ -0,0 +1,143 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.extension.diagrameditor; + +import static org.eclipse.papyrus.infra.core.Activator.log; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.papyrus.infra.core.extension.ExtensionException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageModelFactoryRegistry; + +/** + * This reader is used to read PluggableEditorFactory from the Eclipse extension + * declarations. It can be used to populate an {@link PageModelFactoryRegistry}. + */ +public class PluggableEditorFactoryReader { + + /** ordered list of editor descriptors */ + protected List editorDescriptors; + + /** ID of the editor extension (schema filename) */ + public static final String EDITOR_EXTENSION_ID = "papyrusDiagram"; + + /** Namespace where to look for the extension points. */ + protected String extensionPointNamespace; + + /** indicates if extension is loaded or not */ + private boolean isExtensionLoaded = false; + + /** + * Create a new Registry reading extension from the specified namespace. The + * namespace is usually the name of the plugin owning the registry. + * + * @param extensionPointNamespace + */ + public PluggableEditorFactoryReader(String extensionPointNamespace) { + super(); + this.extensionPointNamespace = extensionPointNamespace; + editorDescriptors = new ArrayList(); + } + + /** + * Populate the provided {@link PageModelFactoryRegistry} with {@link IPluggableEditorFactory} read from Eclipse extension declarations. + * For each declared editor, create a proxy encapsulating the real + * EditorFactory. Then the proxy is added to the PageModelFactoryRegistry. + * + * @param pageModelFactoryRegistry + * The object to populate + * @param serviceRegistry + * ServiceRegistry provided to newly instantiated {@link IPluggableEditorFactory}. + */ + public void populate(PageModelFactoryRegistry pageModelFactoryRegistry, ServicesRegistry serviceRegistry) { + + for (EditorDescriptor desc : getEditorDescriptors()) { + + // Create and add a proxy encapsulating the EditorFactory. + pageModelFactoryRegistry.add(new EditorFactoryProxy(serviceRegistry, desc)); + } + } + + /** + * Populate the provided {@link PageIconsRegistry} with icons read from + * Eclipse extension declarations. For each declared editor, create a {@link EditorIconFactory}. + * + * @param pageModelFactoryRegistry + * The object to populate + * @param serviceRegistry + * ServiceRegistry provided to newly instantiated {@link IPluggableEditorFactory}. + */ + public void populate(PageIconsRegistry registry) { + + for (EditorDescriptor desc : getEditorDescriptors()) { + + // Create and add a proxy encapsulating the EditorFactory. + registry.add(new EditorIconFactory(desc)); + } + } + + /** + * Get the list of editor descriptor. + * + * @return the list of editor descriptor. + */ + public List getEditorDescriptors() { + if (!isExtensionLoaded) { + isExtensionLoaded = true; + initializeEditorDescriptors(); + } + return editorDescriptors; + } + + /** + * Read editor descriptors from extension points. + */ + private void initializeEditorDescriptors() { + // Reading data from plugins + IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); + + for (IConfigurationElement ele : configElements) { + EditorDescriptor desc; + try { + if (EditorDescriptorExtensionFactory.EDITOR_DIAGRAM_EXTENSIONPOINT.equals(ele.getName())) { + desc = EditorDescriptorExtensionFactory.eINSTANCE.createNestedEditorDescriptor(ele); + editorDescriptors.add(desc); + } + } catch (ExtensionException e) { + log.error("Initialization editor problem ", e); //$NON-NLS-1$ + } + } + + Collections.sort(editorDescriptors, (ed1, ed2) -> Integer.compare(ed1.getOrder(), ed2.getOrder())); + + if (log.isDebugEnabled()) { + log.debug("Read " + editorDescriptors.size() + " editor descriptors from Eclipse extensions"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "EditorFactoryRegistry: " + editorDescriptors.toString(); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/PageLayoutStorageState.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/PageLayoutStorageState.java new file mode 100644 index 00000000000..6e604a90914 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/PageLayoutStorageState.java @@ -0,0 +1,164 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.commands; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.commands.ToggleState; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IPartService; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * The boolean toggle state of the private page layout storage menu item. + */ +public class PageLayoutStorageState extends ToggleState implements IPartListener, PropertyChangeListener { + + private IPartService partService = null; + + private Reference activeEditor; + + public PageLayoutStorageState() { + super(); + + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + + if (window != null) { + partService = window.getPartService(); + if (partService != null) { + partService.addPartListener(this); + update(partService.getActivePart()); + } + } + } + + @Override + public void dispose() { + if (partService != null) { + partService.removePartListener(this); + } + + super.dispose(); + } + + @Override + public void partDeactivated(IWorkbenchPart part) { + if ((activeEditor != null) && (activeEditor.get() == part)) { + update(null); + } + } + + @Override + public void partActivated(IWorkbenchPart part) { + update(part); + } + + private void update(IWorkbenchPart part) { + // Default state is private storage + boolean state = true; + + unhookSashModelListener(); + + activeEditor = null; + + if (part instanceof IMultiDiagramEditor) { + IMultiDiagramEditor editor = (IMultiDiagramEditor) part; + activeEditor = new WeakReference<>(editor); + state = isPrivateLayout(editor); + } + + hookSashModelListener(); + + // Fires notification if changed from previous state + setValue(state); + } + + // I am a computed value, actually + @Override + public Object getValue() { + IMultiDiagramEditor editor = (activeEditor == null) ? null : activeEditor.get(); + return (editor != null) ? isPrivateLayout(editor) : super.getValue(); + } + + boolean isPrivateLayout(IMultiDiagramEditor editor) { + ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); + SashModel sashModel = SashModelUtils.getSashModel(modelSet); + + // The default is private layout + return (sashModel == null) || !sashModel.isLegacyMode(); + } + + @Override + public void partBroughtToTop(IWorkbenchPart part) { + // Pass + } + + @Override + public void partClosed(IWorkbenchPart part) { + // Pass + } + + @Override + public void partOpened(IWorkbenchPart part) { + // Pass + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getSource() instanceof SashModel) { + switch (evt.getPropertyName()) { + case SashModel.PROPERTY_LEGACY_MODE: + setValue(!(Boolean) evt.getNewValue()); + break; + } + } + } + + private SashModel getSashModel() { + SashModel result = null; + + if (activeEditor != null) { + IMultiDiagramEditor editor = activeEditor.get(); + if (editor != null) { + result = SashModelUtils.getSashModel(editor.getServicesRegistry()); + } + } + + return result; + } + + private void unhookSashModelListener() { + SashModel sash = getSashModel(); + if (sash != null) { + sash.removePropertyChangeListener(SashModel.PROPERTY_LEGACY_MODE, this); + } + } + + private void hookSashModelListener() { + SashModel sash = getSashModel(); + if (sash != null) { + sash.addPropertyChangeListener(SashModel.PROPERTY_LEGACY_MODE, this); + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java new file mode 100644 index 00000000000..61c931b1ec4 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java @@ -0,0 +1,226 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.commands; + +import java.util.ArrayList; + +import org.eclipse.emf.common.command.AbstractCommand; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.UnexecutableCommand; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel; +import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; +import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder; +import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; + +/** + * A factory for commands that manipulate the configuration of the sash editor layout. + */ +public class SashLayoutCommandFactory { + private final IMultiDiagramEditor editor; + + public SashLayoutCommandFactory(IMultiDiagramEditor editor) { + super(); + + this.editor = editor; + } + + /** + * Creates a command that toggles whether the sash model is stored in the private + * workspace metadata area or in the shared {@code *.di} file. + * + * @return a toggle command for the private layout storage + */ + public Command createTogglePrivateLayoutCommand() { + Command result = UnexecutableCommand.INSTANCE; + + ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); + org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel sashModel = SashModelUtils.getSashModel(modelSet); + if (sashModel != null) { + result = new AbstractToggleCommand("Toggle Private Editor Layout") { + private Command toggleRestoreActivePage; + + { + // If we are toggling off private mode, make sure that we stop + // tracking the active page selection if we were tracking it. + // And remember that for undo + if (!sashModel.isLegacyMode()) { + SashWindowsMngr sash = DiUtils.lookupSashWindowsMngr(sashModel.getResource()); + if ((sash != null) && (sash.getSashModel() != null) && sash.getSashModel().isRestoreActivePage()) { + toggleRestoreActivePage = createToggleRestoreActivePageCommand(); + } + } + } + + @Override + public void execute() { + // First, if we need to toggle restoring the active page, do that + if ((toggleRestoreActivePage != null) && toggleRestoreActivePage.canExecute()) { + toggleRestoreActivePage.execute(); + } + + SashWindowsMngr toMove = DiUtils.lookupSashWindowsMngr(sashModel.getResource()); + + // We don't record changes in the sash model for undo/redo, + // so we cannot assume that any changes to the current page selections + // are undoable in the usual way + if (!sashModel.isLegacyMode()) { + Resource sashResource = toMove.eResource(); + URI sharedURI = sashModel.getSharedResourceURI(); + + // Move the contents into the DI model. If the DI resource isn't loaded, + // give up because something is seriously wrong in that case + Resource diResource = modelSet.getResource(sharedURI, false); + if ((diResource != null) && diResource.isLoaded()) { + moveContents(sashResource, diResource); + + if (sashResource.getContents().isEmpty()) { + // Schedule deletion on save + modelSet.getResourcesToDeleteOnSave().add(sashResource.getURI()); + } + } + } else { + Resource sashResource; + URI privateURI = sashModel.getPrivateResourceURI(); + + // Move the contents into the sash model. If the sash resource isn't loaded + // or doesn't exist, it will have to be handled + if (modelSet.getURIConverter().exists(privateURI, null)) { + sashResource = modelSet.getResource(privateURI, true); + } else { + sashResource = modelSet.createResource(privateURI); + } + + // In case we had marked it for deletion, earlier + modelSet.getResourcesToDeleteOnSave().remove(privateURI); + + Resource diResource = toMove.eResource(); + moveContents(diResource, sashResource); + } + + // Re-load from the new resource. Snippets might find this odd, but + // it would be even more odd for there to be any snippets on this model + sashModel.loadModel(modelSet.getURIWithoutExtension()); + } + }; + } + + return result; + } + + void moveContents(Resource fromResource, Resource toResource) { + // Safe copy to allow concurrent modifications + for (EObject root : new ArrayList<>(fromResource.getContents())) { + EObject toReplace = (EObject) EcoreUtil.getObjectByType(toResource.getContents(), root.eClass()); + if (toReplace != null) { + EcoreUtil.replace(toReplace, root); + } else { + if (root instanceof SashWindowsMngr) { + // This one is expected always to be first + toResource.getContents().add(0, root); + } else { + toResource.getContents().add(root); + } + } + } + + } + + /** + * Creates a command that toggles whether the sash model records the currently + * active page to restore it on next opening. + * + * @return a toggle command for the restore-active-page behaviour + */ + public Command createToggleRestoreActivePageCommand() { + Command result = UnexecutableCommand.INSTANCE; + + ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet(); + SashWindowsMngr sashWindows = SashModelUtils.getSashWindowsMngr(modelSet); + ISashWindowsContainer container = editor.getAdapter(ISashWindowsContainer.class); + + SashModel sashModel = sashWindows.getSashModel(); + if (sashModel != null) { + // We don't record the tracking of the active page for undo/redo, + // so we cannot assume that any changes to the current page selections + // are undoable in the usual way + result = new AbstractToggleCommand("Toggle Restore Active Page") { + + @Override + public void execute() { + boolean oldValue = sashModel.isRestoreActivePage(); + + if (oldValue) { + // Clear each tab folder's selection + container.getIFolderList().stream() + .map(f -> f.getRawModel()) + .filter(TabFolder.class::isInstance).map(TabFolder.class::cast) + .filter(f -> f.getCurrentSelection() != null) + .forEach(f -> f.setCurrentSelection(null)); + } else { + // Set each tab folder's selection. + // The 'visible pages' are the current selection in each folder + container.getVisiblePages().stream() + .map(p -> p.getRawModel()) + .filter(PageRef.class::isInstance).map(PageRef.class::cast) + .filter(p -> p.getParent().getCurrentSelection() != p) + .forEach(p -> p.getParent().setCurrentSelection(p)); + } + + // The basic toggle + sashModel.setRestoreActivePage(!oldValue); + } + }; + } + + return result; + } + + // + // Nested types + // + + private static abstract class AbstractToggleCommand extends AbstractCommand { + + AbstractToggleCommand(String label) { + super(label); + } + + @Override + protected boolean prepare() { + // Nothing to prepare + return true; + } + + @Override + public void undo() { + // It's a toggle, so yeah, just execute again + execute(); + } + + @Override + public void redo() { + execute(); + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/TogglePageLayoutStorageHandler.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/TogglePageLayoutStorageHandler.java new file mode 100644 index 00000000000..12fa47811e9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/TogglePageLayoutStorageHandler.java @@ -0,0 +1,78 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.commands; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.RollbackException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.utils.TransactionHelper; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.services.SaveLayoutBeforeClose; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * Command handler for the private page-layout storage toggle menu. + */ +public class TogglePageLayoutStorageHandler extends AbstractHandler { + + public TogglePageLayoutStorageHandler() { + super(); + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart active = HandlerUtil.getActiveEditor(event); + if (active instanceof IMultiDiagramEditor) { + IMultiDiagramEditor editor = (IMultiDiagramEditor) active; + + // Toggle the storage of the layout + togglePrivatePageLayout(editor); + + // And then save the layout immediately if the editor is not dirty + // (if it is dirty, then the layout will be saved when the editor + // is saved; saving it now would possibly result in inconsistencies) + try { + SaveLayoutBeforeClose save = editor.getServicesRegistry().getService(SaveLayoutBeforeClose.class); + save.saveBeforeClose(editor); + } catch (ServiceException e) { + // Doesn't matter; we'll just have to rely on the normal editor save + } + } + + return null; + } + + public void togglePrivatePageLayout(IMultiDiagramEditor editor) { + Command command = new SashLayoutCommandFactory(editor).createTogglePrivateLayoutCommand(); + EditingDomain domain = editor.getAdapter(EditingDomain.class); + + // Don't execute on the undo history because the changes in the sash model + // are never tracked for undo/redo + try { + TransactionHelper.run(domain, () -> command.execute()); + } catch (RollbackException e) { + StatusManager.getManager().handle(e.getStatus()); + } catch (InterruptedException e) { + Activator.log.error("Failed to execute page layout toggle command", e); //$NON-NLS-1$ + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferencePage.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferencePage.java new file mode 100644 index 00000000000..bff4950d394 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferencePage.java @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2015, 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.preferences; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * The preference page for Papyrus Editor general preferences. + */ +public class EditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + public EditorPreferencePage() { + super(Messages.EditorPreferencePage_0, SWT.FLAT); + + setDescription(Messages.EditorPreferencePage_5); + } + + @Override + public void init(IWorkbench workbench) { + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + } + + @Override + protected void createFieldEditors() { + addField(new RadioGroupFieldEditor(EditorPreferences.PREF_CONVERT_SHARED_LAYOUT, + Messages.EditorPreferencePage_1, + 1, + new String[][] { + { Messages.EditorPreferencePage_2, YesNo.PROMPT.name() }, + { Messages.EditorPreferencePage_3, YesNo.NO.name() }, + { Messages.EditorPreferencePage_4, YesNo.YES.name() }, + }, + getFieldEditorParent())); + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferences.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferences.java new file mode 100644 index 00000000000..0b8748f6032 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/EditorPreferences.java @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright (c) 2015, 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.ui.Activator; + +/** + * Accessor for the Papyrus Editor preferences. + */ +public class EditorPreferences { + public static final String PREF_CONVERT_SHARED_LAYOUT = "convertSharedLayout"; //$NON-NLS-1$ + + private static final EditorPreferences INSTANCE = new EditorPreferences(); + private final IPreferenceStore store; + + private EditorPreferences() { + super(); + + store = Activator.getDefault().getPreferenceStore(); + } + + public static EditorPreferences getInstance() { + return INSTANCE; + } + + /** + * Queries whether the user prefers to migrate shared editor layout to private storage + * always, never, or interactively pop up a dialog to ask (the default). + * + * @return the shared layout conversion on first open preference, which is never + * {@code null} and defaults to {@link YesNo#PROMPT} + */ + public YesNo getConvertSharedPageLayoutToPrivate() { + return YesNo.valueOf(store.getString(PREF_CONVERT_SHARED_LAYOUT)); + } + + /** + * Sets whether the editor will always, never, or ask the user to migrate shared + * (in the {@code *.di} resource) page layout into the private storage ({@code *.sash} resource} + * on the first opening of a Papyrus model in the workspace that uses the shared + * storage (usually from pre-1.0 release). + * + * @param convert + * the preference setting to assign, or {@code null} for the default, which + * is {@link YesNo#PROMPT} + */ + public void setConvertSharedPageLayoutToPrivate(YesNo convert) { + if (convert == null) { + convert = YesNo.PROMPT; + } + + store.setValue(PREF_CONVERT_SHARED_LAYOUT, convert.name()); + } + + // + // Nested types + // + + /** + * Initializer of defaults for the editor preferences. + */ + public static class Initializer extends AbstractPreferenceInitializer { + + public Initializer() { + super(); + } + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + + store.setDefault(PREF_CONVERT_SHARED_LAYOUT, YesNo.PROMPT.name()); + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/Messages.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/Messages.java new file mode 100644 index 00000000000..4fbebcf89bc --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/Messages.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.preferences; + +import org.eclipse.osgi.util.NLS; + +/** + * Translatable strings. + */ +class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.core.internal.preferences.messages"; //$NON-NLS-1$ + public static String EditorPreferencePage_0; + public static String EditorPreferencePage_1; + public static String EditorPreferencePage_2; + public static String EditorPreferencePage_3; + public static String EditorPreferencePage_4; + public static String EditorPreferencePage_5; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/YesNo.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/YesNo.java new file mode 100644 index 00000000000..a9ee87d9e4f --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/YesNo.java @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.internal.preferences; + +/** + * A tri-state boolean-ish preference data type with a "prompt the user" value. + */ +public enum YesNo { + PROMPT, NO, YES; +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/messages.properties b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/messages.properties new file mode 100644 index 00000000000..a34a57ddfbe --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/preferences/messages.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2015 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Christian W. Damus - Initial API and implementation +# + +EditorPreferencePage_0=General Editor Settings +EditorPreferencePage_1=Convert shared storage of editor layout to private: +EditorPreferencePage_2=Ask each time +EditorPreferencePage_3=Never +EditorPreferencePage_4=Always +EditorPreferencePage_5=General settings for the Papyrus multi-diagram editor. diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/DoSaveEvent.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/DoSaveEvent.java new file mode 100644 index 00000000000..d11eb1bc59c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/DoSaveEvent.java @@ -0,0 +1,66 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; + +/** + * Event sent whith a Save or SaveAs. + * + * @author cedric dumoulin + * + */ +public class DoSaveEvent { + + final protected ServicesRegistry serviceRegistry; + + final protected IMultiDiagramEditor multiDiagramEditor; + + final protected boolean isAutoSave; + + /** + * Create an Event that is sent with a Save or SaveAs. The same event can be + * reused. Constructor. + * + * @param serviceRegistry + * @param multiDiagramEditor + */ + public DoSaveEvent(ServicesRegistry serviceRegistry, IMultiDiagramEditor multiDiagramEditor) { + this(serviceRegistry, multiDiagramEditor, false); + } + + /** + * Create an Event that is sent with a Save or SaveAs. The same event can be + * reused. Constructor. + * + * @param serviceRegistry + * @param multiDiagramEditor + * @param isAutoSave + */ + public DoSaveEvent(ServicesRegistry serviceRegistry, IMultiDiagramEditor multiDiagramEditor, boolean isAutoSave) { + this.serviceRegistry = serviceRegistry; + this.multiDiagramEditor = multiDiagramEditor; + this.isAutoSave = isAutoSave; + } + + /** + * @return the serviceRegistry + */ + public ServicesRegistry getServiceRegistry() { + return serviceRegistry; + } + + /** + * @return the multiDiagramEditor + */ + public IMultiDiagramEditor getMultiDiagramEditor() { + return multiDiagramEditor; + } + + public boolean isAutoSave() { + return isAutoSave; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/IEditorInputChangedListener.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/IEditorInputChangedListener.java new file mode 100644 index 00000000000..575e2013934 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/IEditorInputChangedListener.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2010 LIFL & 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: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import org.eclipse.ui.part.FileEditorInput; + +/** + * Interface implemented by classes wishing to be notified of the inputChanged + * event after a call to {@link ISaveAndDirtyService#doSaveAs()}. + * + * @author cedric dumoulin + * + */ +public interface IEditorInputChangedListener { + + /** + * + * @param fileEditorInput + * The new value of EditorInput + */ + public void editorInputChanged(FileEditorInput fileEditorInput); + + /** + * Called when the value of the isDirty() flag has changed. + */ + public void isDirtyChanged(); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ILifeCycleEventsProvider.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ILifeCycleEventsProvider.java new file mode 100644 index 00000000000..cf0bbeee92e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ILifeCycleEventsProvider.java @@ -0,0 +1,57 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +/** + * Concrete implementation of this interface allows to listen on various + * lifecycle events. This interface is the "public" part of the {@link LifeCycleEventsProvider}. + * + * @author cedric dumoulin + * + */ +public interface ILifeCycleEventsProvider { + + /** + * Add specified listener. + * + * @param listener + */ + public void addDoSaveListener(ISaveEventListener listener); + + /** + * Remove specified listener. + * + * @param listener + */ + public void removeDoSaveListener(ISaveEventListener listener); + + /** + * Add specified listener. + * + * @param listener + */ + public void addAboutToDoSaveListener(ISaveEventListener listener); + + /** + * Remove specified listener. + * + * @param listener + */ + public void removeAboutToDoSaveListener(ISaveEventListener listener); + + /** + * Add specified listener. + * + * @param listener + */ + public void addPostDoSaveListener(ISaveEventListener listener); + + /** + * Remove specified listener. + * + * @param listener + */ + public void removePostDoSaveListener(ISaveEventListener listener); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveAndDirtyService.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveAndDirtyService.java new file mode 100644 index 00000000000..14f6f12d0d3 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveAndDirtyService.java @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright (c) 2010 LIFL & 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: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.ui.ISaveablePart; + +/** + * @author dumoulin + * + */ +public interface ISaveAndDirtyService extends ISaveablePart { + + /** + * Register a nested {@link ISaveablePart} as a listener that will be + * notified each time a {@link #doSave(IProgressMonitor)} or {@link #doSaveAs()} is performed. Also, it will be asked for the + * dirtyState. + * + * @param saveablePart + */ + public abstract void registerIsaveablePart(ISaveablePart saveablePart); + + /** + * Remove the specified {@link ISaveablePart} from the list of listeners. + * + * @param saveablePart + */ + public abstract void removeIsaveablePart(ISaveablePart saveablePart); + + /** + * Add a listeners on input changed event. + * + * @param inputChangedListener + */ + public void addInputChangedListener(IEditorInputChangedListener inputChangedListener); + + /** + * Remove a listeners on input changed event. + * + * @param inputChangedListener + */ + public void removeInputChangedListener(IEditorInputChangedListener inputChangedListener); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveEventListener.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveEventListener.java new file mode 100644 index 00000000000..d936304bcb5 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/ISaveEventListener.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +/** + * Interface used to listen on open, save and saveAs events. + * + * @author cedric dumoulin + * + * @param + * Type of event passed to methods. + */ +public interface ISaveEventListener { + + /** + * + * @param editor + */ + public void doSave(DoSaveEvent event); + + /** + * + * @param editor + */ + public void doSaveAs(DoSaveEvent event); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProvider.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProvider.java new file mode 100644 index 00000000000..7dd9dda4c92 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProvider.java @@ -0,0 +1,291 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class provides events about the life cycle of a MultiEditor. Not all + * life cycle events are available. Available events: + *
    + *
  • aboutToDoSave, aboutToDoSaveAs - SaveEventListener
  • + *
  • doSave, doSaveAs - SaveEventListener
  • + *
  • afterDoSave, afterDoSaveAs - SaveEventListener
  • + *
  • + *
  • + *
+ * + * + * @author cedric dumoulin + * + */ +public class LifeCycleEventsProvider implements ILifeCycleEventsProvider { + + /** + * + */ + protected SaveEventListenerLazyList preSaveListeners = new SaveEventListenerLazyList(); + + /** + * + */ + protected SaveEventListenerLazyList saveListeners = new SaveEventListenerLazyList(); + + /** + * + */ + protected SaveEventListenerLazyList postSaveListeners = new SaveEventListenerLazyList(); + + /** + * Add specified listener. + * + * @param listener + */ + @Override + public void addDoSaveListener(ISaveEventListener listener) { + + saveListeners.addListener(listener); + } + + /** + * Remove specified listener. + * + * @param listener + */ + @Override + public void removeDoSaveListener(ISaveEventListener listener) { + saveListeners.removeListener(listener); + } + + /** + * Add specified listener. + * + * @param listener + */ + @Override + public void addAboutToDoSaveListener(ISaveEventListener listener) { + + preSaveListeners.addListener(listener); + } + + /** + * Remove specified listener. + * + * @param listener + */ + @Override + public void removeAboutToDoSaveListener(ISaveEventListener listener) { + preSaveListeners.removeListener(listener); + } + + /** + * Add specified listener. + * + * @param listener + */ + @Override + public void addPostDoSaveListener(ISaveEventListener listener) { + + postSaveListeners.addListener(listener); + } + + /** + * Remove specified listener. + * + * @param listener + */ + @Override + public void removePostDoSaveListener(ISaveEventListener listener) { + postSaveListeners.removeListener(listener); + } + + // ****************************************************** // + // Fire events methods // + // ****************************************************** // + + /** + * Fire AboutToSaveEvent to registered Listeners. + * + * @param editorPart + */ + public void fireAboutToDoSaveEvent(DoSaveEvent event) { + preSaveListeners.fireSaveEvent(event); + } + + /** + * Fire AboutToSaveAs to registered Listeners. + * + * @param editorPart + */ + public void fireAboutToDoSaveAsEvent(DoSaveEvent event) { + preSaveListeners.fireSaveAsEvent(event); + } + + /** + * Fire AboutToSaveEvent to registered Listeners. + * + * @param editorPart + */ + public void fireDoSaveEvent(DoSaveEvent event) { + saveListeners.fireSaveEvent(event); + } + + /** + * Fire AboutToSaveAs to registered Listeners. + * + * @param editorPart + */ + public void fireDoSaveAsEvent(DoSaveEvent event) { + saveListeners.fireSaveAsEvent(event); + } + + /** + * Fire AboutToSaveEvent to registered Listeners. + * + * @param editorPart + */ + public void firePostDoSaveEvent(DoSaveEvent event) { + postSaveListeners.fireSaveEvent(event); + } + + /** + * Fire AboutToSaveAs to registered Listeners. + * + * @param editorPart + */ + public void firePostDoSaveAsEvent(DoSaveEvent event) { + postSaveListeners.fireSaveAsEvent(event); + } + + /** + * Fire all Save events (about, events, post) to registered Listeners. + * Exceptions from listeners are propagated and stop the event chain. + * + * @param editorPart + */ + public void fireAllDoSaveEvent(DoSaveEvent event) { + fireAboutToDoSaveEvent(event); + fireDoSaveEvent(event); + firePostDoSaveEvent(event); + } + + /** + * Fire all SaveAs events (about, events, post) to registered Listeners. If + * one of the saveAs event fail, post events are not sent. + * + * @param editorPart + */ + public void fireAllDoSaveAsEvent(DoSaveEvent event) { + fireAboutToDoSaveAsEvent(event); + fireDoSaveAsEvent(event); + firePostDoSaveAsEvent(event); + } + + /** + * Base class encapsulating a lazy creation list. + * + * @author cedric dumoulin + * + * @param + */ + abstract protected class AbstractEventListenersLazyList { + + List listeners; + + /** + * Add specified listener. + * + * @param listener + */ + public void addListener(T listener) { + // Lazy creation + if (listeners == null) { + listeners = new ArrayList(); + } + + // do not add if already present. + if (listeners.contains(listener)) { + return; + } + + listeners.add(listener); + } + + /** + * Remove specified listener. + * + * @param listener + */ + public void removeListener(T listener) { + // Lazy creation + if (listeners == null) { + return; + } + + listeners.remove(listener); + } + + /** + * @return the listeners + */ + protected List getListeners() { + return listeners; + } + + /** + * Remove all listeners. + */ + protected void clear() { + if (listeners != null) { + listeners.clear(); + } + } + } + + /** + * List of {@link ISaveEventListener}. + * + * @author cedric dumoulin + * + */ + protected class SaveEventListenerLazyList extends AbstractEventListenersLazyList { + + /** + * Fire OpenEvent to registered Listeners. If a listener throw an + * exception, remaining listeners are called, and then the exception is + * resent. + * + * @param editorPart + */ + public void fireSaveEvent(DoSaveEvent event) { + // Lazy creation + if (listeners == null) { + return; + } + + for (ISaveEventListener listener : listeners) { + listener.doSave(event); + } + } + + /** + * Fire OpenEvent to registered Listeners. + * + * @param editorPart + */ + public void fireSaveAsEvent(DoSaveEvent event) { + // Lazy creation + if (listeners == null) { + return; + } + + for (ISaveEventListener listener : listeners) { + listener.doSaveAs(event); + } + + } + + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderServiceFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderServiceFactory.java new file mode 100644 index 00000000000..8bdfb550d1c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderServiceFactory.java @@ -0,0 +1,79 @@ +/***************************************************************************** + * Copyright (c) 2010 LIFL & 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: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import org.eclipse.papyrus.infra.core.services.IServiceFactory; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; + +/** + * A service factory to create the {@link ILifeCycleEventsProvider} service. + * This provide a nickname for {@link SaveAndDirtyService} service. This + * serviceFactory depends on {@link SaveAndDirtyService} service. + * + * @author cedric dumoulin + * + */ +public class LifeCycleEventsProviderServiceFactory implements IServiceFactory { + + /** + * The sashModelMangr. + */ + private SaveAndDirtyService saveAndDirtyService; + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + // Get required services + // This rely on the real implementation. + saveAndDirtyService = (SaveAndDirtyService) servicesRegistry.getService(ISaveAndDirtyService.class); + + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IServiceFactory#createServiceInstance() + * + * @return + * @throws ServiceException + */ + @Override + public Object createServiceInstance() throws ServiceException { + return saveAndDirtyService; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyService.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyService.java new file mode 100644 index 00000000000..7e858153695 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyService.java @@ -0,0 +1,550 @@ +/***************************************************************************** + * Copyright (c) 2010, 2013 LIFL & 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: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus (CEA) - Don't make editor dirty on empty ResourceSetChangeEvent + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import static org.eclipse.papyrus.infra.core.Activator.log; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.EventObject; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.transaction.NotificationFilter; +import org.eclipse.emf.transaction.ResourceSetChangeEvent; +import org.eclipse.emf.transaction.ResourceSetListener; +import org.eclipse.emf.transaction.RollbackException; +import org.eclipse.emf.transaction.Transaction; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.IService; +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.ui.editor.IMultiDiagramEditor; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.ISaveablePart; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.SaveAsDialog; +import org.eclipse.ui.part.FileEditorInput; + +/** + * A Papyrus Service allowing to perform save and saveAs on Papyrus Models. The + * service also allows to listen on the dirty state of the Models.
+ * The service implements the {@link ISaveablePart} interface, and can be used + * directly in part requiring such interface of adapter. + * + *
+ * This class allows nested editors to register themselves as nested {@link ISaveablePart}. In this case, the registered part will be notified + * each time a save or saveAs is performed. Also, the nested part will be asked + * for its dirtyState. + * + * TODO : Improve the implementation by registering the isDirty flag value, and + * firing events only if the value really change. Actually, the event is fired + * every time the model is modified, even if the virtual value of the flag + * hasn't changed. + * + * @author cedric dumoulin + * + */ +public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISaveablePart, IService, ISaveAndDirtyService { + + /** + * Class used to propagate life cycle events. This class can be retrieved as + * a service using {@link ILifeCycleEventsProvider}.class. This class + * extends LifeCycleEventsProvider, so the local variable is set with + * ourself (historical reasons). TODO : remove this local variable. + */ + protected LifeCycleEventsProvider lifeCycleEventsProvider = this; + + /** + * Cached event that can be reused. + */ + protected DoSaveEvent lifeCycleEvent; + + /** + * Model set managing models. + */ + private ModelSet resourceSet; + + /** + * + */ + private TransactionalEditingDomain transactionalEditingDomain; + + /** + * The serviceRegistry. + */ + // private ServicesRegistry servicesRegistry; + + /** + * Associated editor. Needed by saveAs to synchronize editor input. + */ + private IMultiDiagramEditor multiDiagramEditor; + + /** + * List of registered {@link ISaveablePart}. This are usually nested + * editors. + */ + private ISaveablePartList registeredIsaveablePart; + + /** + * List of listeners on input changed event after a call to saveAs. + */ + private List inputChangedListeners; + + /** + * Listener on commandStack changes. + */ + private final CommandStackListener commandStackListener = new CommandStackListener() { + + @Override + public void commandStackChanged(EventObject event) { + + fireIsDirtyChanged(); + }; + }; + + /* + * Listener on ResourceSet + */ + private final ResourceSetListener resourceSetListener = new ResourceSetListener() { + + @Override + public NotificationFilter getFilter() { + return null; + } + + @Override + public boolean isAggregatePrecommitListener() { + return false; + } + + @Override + public boolean isPostcommitOnly() { + return true; + } + + @Override + public boolean isPrecommitOnly() { + return false; + } + + @Override + public void resourceSetChanged(ResourceSetChangeEvent event) { + if (event.getTransaction() != null && event.getTransaction().getStatus().isOK() && madePersistableChanges(event)) { + fireIsDirtyChanged(); + } + } + + private boolean madePersistableChanges(ResourceSetChangeEvent event) { + return !event.getNotifications().isEmpty() && !isUnprotected(event.getTransaction()); + } + + private boolean isUnprotected(Transaction transaction) { + return !Boolean.TRUE.equals(transaction.getOptions().get(Transaction.OPTION_UNPROTECTED)); + } + + @Override + public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { + return null; + } + + }; + + /** + * Constructor. + * + */ + public SaveAndDirtyService() { + registeredIsaveablePart = new ISaveablePartList(); + inputChangedListeners = new ArrayList(); + } + + /** + * Initialize the service. Retrieve other required services (ModelSet, + * CoreEditor). + * + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + * @throws ServiceException + */ + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + + // this.servicesRegistry = servicesRegistry; + + // Retrieve required services. + resourceSet = servicesRegistry.getService(ModelSet.class); + multiDiagramEditor = servicesRegistry.getService(IMultiDiagramEditor.class); + transactionalEditingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(servicesRegistry); + + // Initialize and register the ILifeCycleEventsProvider service (which + // is ourself). + // This mean that the ILifeCycleEventsProvider is not available until we + // are started. + lifeCycleEvent = new DoSaveEvent(servicesRegistry, multiDiagramEditor); + // servicesRegistry.add(ILifeCycleEventsProvider.class, 1, + // lifeCycleEventsProvider); + + } + + /** + * Do nothing. + * + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + * + * @throws ServiceException + */ + @Override + public void startService() throws ServiceException { + + // Listen to the modifications of the EMF model + transactionalEditingDomain.getCommandStack().addCommandStackListener(commandStackListener); + + // Let's listen to the resource set change + transactionalEditingDomain.addResourceSetListener(resourceSetListener); + } + + /** + * @see org.eclipse.papyrus.infra.core.services.IService#disposeService() + * + * @throws ServiceException + */ + @Override + public void disposeService() throws ServiceException { + if (transactionalEditingDomain != null) { + // Check if commandStack is null (meaning that transactionalEditingDomain + // is disposed + CommandStack commandStack = transactionalEditingDomain.getCommandStack(); + if (commandStack != null) { + transactionalEditingDomain.getCommandStack().removeCommandStackListener(commandStackListener); + } + transactionalEditingDomain.removeResourceSetListener(resourceSetListener); + // resourceSetListener = null; + } + + // clean properties in order to help GC + inputChangedListeners.clear(); + inputChangedListeners = null; + multiDiagramEditor = null; + // servicesRegistry = null; + transactionalEditingDomain = null; + resourceSet = null; + lifeCycleEvent = null; + + postSaveListeners.clear(); + saveListeners.clear(); + preSaveListeners.clear(); + + + } + + /** + * Save the Models + * + * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) + * + * @param monitor + */ + @Override + public void doSave(IProgressMonitor monitor) { + // Sent pre doSave event + lifeCycleEventsProvider.fireAboutToDoSaveEvent(lifeCycleEvent); + + // sent doSaveEvent + lifeCycleEventsProvider.fireDoSaveEvent(lifeCycleEvent); + // Perform local doSave + // TODO : put it in a listener ? + try { + // Save each associated resource + resourceSet.save(monitor); + // notify registered IsaveablePart + registeredIsaveablePart.doSave(monitor); + markSaveLocation(); + } catch (IOException e) { + log.error("Error during save", e); //$NON-NLS-1$ + } + + // Sent post Events + lifeCycleEventsProvider.firePostDoSaveEvent(lifeCycleEvent); + + } + + /** + * @see org.eclipse.ui.ISaveablePart#doSaveAs() + * + */ + @Override + public void doSaveAs() { + // Sent pre doSave event + lifeCycleEventsProvider.fireAboutToDoSaveAsEvent(lifeCycleEvent); + + // sent doSaveEvent + lifeCycleEventsProvider.fireDoSaveAsEvent(lifeCycleEvent); + // Perform local doSaveAs + + // Show a SaveAs dialog + Shell shell = multiDiagramEditor.getEditorSite().getWorkbenchWindow().getShell(); + SaveAsDialog dialog = new SaveAsDialog(shell); + dialog.setOriginalFile(((IFileEditorInput) multiDiagramEditor.getEditorInput()).getFile()); + dialog.open(); + final IPath path = dialog.getResult(); + if (path != null) { + // try to save the editor's contents under a different file name + final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + try { + new ProgressMonitorDialog(shell).run(false, // don't fork + false, // can't cancel + new WorkspaceModifyOperation() { // run this operation + + @Override + public void execute(final IProgressMonitor monitor) { + try { + // to event bad redirection after the saveAs + // see bug 319023 + EcoreUtil.resolveAll(resourceSet); + resourceSet.saveAs(path); + // notify registered IsaveablePart + registeredIsaveablePart.doSave(monitor); + } catch (IOException e) { + log.error("Unable to saveAs the resource set", e); //$NON-NLS-1$ + } + } + }); + // set input to the new file + fireEditorInputChanged(new FileEditorInput(file)); + markSaveLocation(); + } catch (InterruptedException e) { + // should not happen, since the monitor dialog is not cancelable + log.error(e); + } catch (InvocationTargetException e) { + log.error(e); + } + } + + // sent doSaveEvent + lifeCycleEventsProvider.firePostDoSaveAsEvent(lifeCycleEvent); + } + + /** + * Change the input of the underlying editor. + * + * @param fileEditorInput + */ + private void fireEditorInputChanged(FileEditorInput fileEditorInput) { + + for (IEditorInputChangedListener listener : inputChangedListeners) { + try { + listener.editorInputChanged(fileEditorInput); + } catch (Exception e) { + log.error("Can't set input for '" + listener + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + } + + /** + * Fire a PropertyChanged event to registered {@link IEditorInputChangedListener}. + * + * @param propertyId + */ + private void fireIsDirtyChanged() { + + for (IEditorInputChangedListener listener : inputChangedListeners) { + try { + listener.isDirtyChanged(); + } catch (Exception e) { + log.error("Can't call listener '" + listener + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + } + + /** + * Return true if the multiEditor is dirty, false otherwise. The dirty state + * is compute as follow: + *
    + *
  • The {@link TransactionalEditingDomain} commandStack is checked
  • + *
  • and each registered nested Isaveable.isDirty() state is checked
  • + *
  • + *
  • + *
  • + *
  • + *
+ * If one of these states is false, the returned value is false.
+ * If all of these states are true, the returned value is true. + * + * @see org.eclipse.ui.ISaveablePart#isDirty() + * + * @return + */ + @Override + public boolean isDirty() { + // First, look if the model part (EMF) is dirty, else look at the + // Graphical part (GEF/GMF) + if (transactionalEditingDomain == null) { + return false; + } + return ((BasicCommandStack) transactionalEditingDomain.getCommandStack()).isSaveNeeded() || registeredIsaveablePart.isDirty(); + } + + /** + * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed() + * + * @return + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded() + * + * @return + */ + @Override + public boolean isSaveOnCloseNeeded() { + return isDirty(); + } + + /** + * Mark the command stack of all sub-editors. Default implementation do + * nothing. + */ + protected void markSaveLocation() { + ((BasicCommandStack) transactionalEditingDomain.getCommandStack()).saveIsDone(); + fireIsDirtyChanged(); + } + + /** + * Register a nested {@link ISaveablePart} as a listener that will be + * notified each time a {@link #doSave(IProgressMonitor)} or {@link #doSaveAs()} is performed. Also, it will be asked for the + * dirtyState. + * + * @param saveablePart + */ + @Override + public void registerIsaveablePart(ISaveablePart saveablePart) { + registeredIsaveablePart.add(saveablePart); + } + + /** + * Remove the specified {@link ISaveablePart} from the list of listeners. + * + * @param saveablePart + */ + @Override + public void removeIsaveablePart(ISaveablePart saveablePart) { + registeredIsaveablePart.remove(saveablePart); + } + + /** + * Add a listeners on input changed event. + * + * @param inputChangedListener + */ + @Override + public void addInputChangedListener(IEditorInputChangedListener inputChangedListener) { + inputChangedListeners.add(inputChangedListener); + } + + /** + * Remove a listeners on input changed event. + * + * @param inputChangedListener + */ + @Override + public void removeInputChangedListener(IEditorInputChangedListener inputChangedListener) { + inputChangedListeners.remove(inputChangedListener); + } + + /** + * A list of {@link ISaveablePart}. + * + * @author dumoulin + * + */ + public class ISaveablePartList extends ArrayList { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Return true if one of the part is dirty, false if all part are not + * dirty. + * + * @return + */ + public boolean isDirty() { + for (ISaveablePart part : this) { + if (part.isDirty()) { + return true; + } + } + + return false; + } + + /** + * Call doSave on each registered {@link ISaveablePart}. + * + * @param monitor + */ + public void doSave(IProgressMonitor monitor) { + for (ISaveablePart part : this) { + + try { + part.doSave(monitor); + } catch (Exception e) { + log.error("Can't save ISaveablePart '" + part + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + } + + /** + * Call doSaveAs on each registered {@link ISaveablePart}. + * + * @param monitor + */ + public void doSaveAs() { + for (ISaveablePart part : this) { + try { + part.doSaveAs(); + } catch (Exception e) { + log.error("Can't save ISaveablePart '" + part + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/menu/AbstractParametricOnSelectedElementsAction.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/menu/AbstractParametricOnSelectedElementsAction.java index ef2255fc632..72f3fbe87b6 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/menu/AbstractParametricOnSelectedElementsAction.java +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/menu/AbstractParametricOnSelectedElementsAction.java @@ -19,8 +19,8 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; public abstract class AbstractParametricOnSelectedElementsAction { diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java new file mode 100644 index 00000000000..4ece10f8d24 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.messages; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.tools.messages.messages"; //$NON-NLS-1$ + + public static String AbstractPreferenceKeyDialog_Level; + + public static String AbstractPreferenceKeyDialog_Localization; + + public static String AbstractPreferenceKeyDialog_Pref_Kind; + + public static String AbstractPreferenceKeyDialog_WouldYouLikeOverloadPreferences; + + public static String AbstractStringValueConverter_NoXReprensentedByYHaveBeenFound; + + public static String AbstractStringValueConverter_SomeStringsAreNotValidToCreateY; + + public static String AbstractStringValueConverter_SomeStringsCantBeResolvedToFindY; + + public static String AbstractStringValueConverter_TheFeatureXCantBeResolved; + + public static String AbstractStringValueConverter_TheStringValueXCantBeResolved; + + public static String AbstractStringValueConverter_TheStringXIsNotValidToCreateY; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties new file mode 100644 index 00000000000..845a45e10ab --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties @@ -0,0 +1,10 @@ +AbstractPreferenceKeyDialog_Level=Level +AbstractPreferenceKeyDialog_Localization=Localization +AbstractPreferenceKeyDialog_Pref_Kind=Pref. kind +AbstractPreferenceKeyDialog_WouldYouLikeOverloadPreferences=Would you like to overload those preferences? +AbstractStringValueConverter_NoXReprensentedByYHaveBeenFound=No {0} represented by {1} have been found +AbstractStringValueConverter_SomeStringsAreNotValidToCreateY=Some Strings are not valid to create {0} +AbstractStringValueConverter_SomeStringsCantBeResolvedToFindY=Some Strings can't be resolved to find {0} +AbstractStringValueConverter_TheFeatureXCantBeResolved=The feature {0} can't be resolved +AbstractStringValueConverter_TheStringValueXCantBeResolved=The string value {0} can't be resolved +AbstractStringValueConverter_TheStringXIsNotValidToCreateY=The String {0} is not valid to create {1} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java new file mode 100644 index 00000000000..731fffe79dc --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorDescriptor.java @@ -0,0 +1,72 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor; + +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * Descriptor of an ActionBarContributor. This descriptor is usually loaded from + * the Eclipse extension mechanism. + * + * @author Cedric Dumoulin + * @author Patrick Tessier + * + */ +public class ActionBarContributorDescriptor { + + protected Class contextClass; + + protected String contextId; + + /** + * Instance is created when requested. + */ + protected EditorActionBarContributor instance = null; + + /** + * constructor. + * + * @return the context descriptor + * @throws BackboneException + */ + protected EditorActionBarContributor getActionBarContributor() throws BackboneException { + if (instance == null) { + instance = createActionBarContributor(); + } + + return instance; + } + + private EditorActionBarContributor createActionBarContributor() throws BackboneException { + try { + EditorActionBarContributor context = contextClass.newInstance(); + return context; + + } catch (SecurityException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } catch (InstantiationException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // Lets propagate. This is an implementation problem that should be + // solved by programmer. + throw new RuntimeException(e); + } + } + +} // end class diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java new file mode 100644 index 00000000000..fbcda9b915c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorExtensionFactory.java @@ -0,0 +1,72 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.papyrus.infra.core.extension.BadNameExtensionException; +import org.eclipse.papyrus.infra.core.extension.ExtensionException; +import org.eclipse.papyrus.infra.core.extension.ExtensionUtils; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * A factory used to create ActionBarContributor object from Eclipse extensions + * points elements. + * + * @author Cedric Dumoulin + * @auhtor Patrick Tessier + */ +public class ActionBarContributorExtensionFactory extends ExtensionUtils { + + /** singleton eINSTANCE of this class */ + public final static ActionBarContributorExtensionFactory eINSTANCE = new ActionBarContributorExtensionFactory(); + + /** constant for the editor diagram **/ + public final static String EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT = "" + "actionBarContributor"; + + /** constant for the attribute factoryClass **/ + public final static String CONTEXTCLASS_ATTRIBUTE = "implementingClass"; + + /** constant for the attribute contextId **/ + public final static String ID_ATTRIBUTE = "id"; + + /** + * @return the eINSTANCE + */ + public static ActionBarContributorExtensionFactory getInstance() { + return eINSTANCE; + } + + /** + * Create a ContextDescriptor instance corresponding to the + * ConfigurationElement. + * + * @param element + * an {@link IConfigurationElement} see eclipse extension point + * @return a ContextDescriptor structure that contains information to the + * diagram context + * @throws BadNameExtensionException + **/ + public ActionBarContributorDescriptor createActionBarContributorDescriptor(IConfigurationElement element) throws ExtensionException { + ActionBarContributorDescriptor res; + + checkTagName(element, EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT); + + res = new ActionBarContributorDescriptor(); + res.contextClass = (Class) parseClass(element, CONTEXTCLASS_ATTRIBUTE, EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT); + res.contextId = element.getAttribute(ID_ATTRIBUTE); + + return res; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java new file mode 100644 index 00000000000..5c28baf01e9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/ActionBarContributorRegistry.java @@ -0,0 +1,176 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor; + +import static org.eclipse.papyrus.infra.core.Activator.log; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.extension.ExtensionException; +import org.eclipse.papyrus.infra.core.extension.NotFoundException; +import org.eclipse.papyrus.infra.core.services.IService; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * A factory managing ActionBarContributor creation. The factory is loaded from + * ActionBarContributor declared in Eclipse extension mechanism. + * + * @author dumoulin + * + */ +public class ActionBarContributorRegistry implements IActionBarContributorFactory, IService { + + /** ID of the editor extension (schema filename) */ + public static final String EDITOR_EXTENSION_ID = "papyrusDiagram"; + + /** Namespace where to look for the extension points. */ + protected String extensionPointNamespace; + + /** + * Registered context descriptors. + */ + private Map editorContextDescriptors; + + /** + * Constructor. defaultContext, input and site are explicitly required in + * order be sure that they are initialized. The multiEditor should be + * initialized. In particular, getEditorSite(), getEditorInput() and + * getDefaultContext() should return initialized values. + * + * @param multiEditor + * the multieditor + * @param extensionPointNamespace + */ + public ActionBarContributorRegistry(String extensionPointNamespace) { + + this.extensionPointNamespace = extensionPointNamespace; + initializeEditorContextDescriptors(); + } + + /** + * + * {@inheritDoc} + */ + @Override + public EditorActionBarContributor getActionBarContributor(Object key) throws BackboneException { + try { + ActionBarContributorDescriptor desc = editorContextDescriptors.get(key); + return desc.getActionBarContributor(); + } catch (NullPointerException e) { + // no context found. + throw new NotFoundException("No ActionBarContributor registered under id '" + key + "'."); + } + } + + /** + * Get the list of descriptors. + * + * @return + * @throws BackboneException + * If a contributor fail to be loaded. + */ + public List getActionBarContributors() throws BackboneException { + List res = new ArrayList(); + for (ActionBarContributorDescriptor desc : editorContextDescriptors.values()) { + res.add(desc.getActionBarContributor()); + } + return res; + } + + /** + * + * {@inheritDoc} + */ + public void registerActionBarContributor(String contextKey, EditorActionBarContributor contributor) { + ActionBarContributorDescriptor desc = new ActionBarContributorDescriptor(); + desc.contextId = contextKey; + desc.instance = contributor; + desc.contextClass = contributor.getClass(); + + editorContextDescriptors.put(contextKey, desc); + } + + /** + * Read context descriptors from extension points. + */ + private void initializeEditorContextDescriptors() { + + editorContextDescriptors = new HashMap(); + // Reading data from plugins + IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID); + + ActionBarContributorExtensionFactory extensionReader = new ActionBarContributorExtensionFactory(); + + for (IConfigurationElement ele : configElements) { + ActionBarContributorDescriptor desc; + try { + if (ActionBarContributorExtensionFactory.EDITOR_ACTIONBARCONTRIBUTOR_EXTENSIONPOINT.equals(ele.getName())) { + desc = extensionReader.createActionBarContributorDescriptor(ele); + // Check double + if (editorContextDescriptors.get(desc.contextId) != null) { + // Already exists. Check if it is the same + ActionBarContributorDescriptor existingDesc = editorContextDescriptors.get(desc.contextId); + if (desc.equals(existingDesc)) { + log.warn("More than one ActionBarContributor is registered under the name '" + desc.contextId + "', with different parameters. Extra declaration are discarded."); + } + } else { + editorContextDescriptors.put(desc.contextId, desc); + } + } + } catch (ExtensionException e) { + log.error(e.getMessage(), e); + } + } + + if (log.isDebugEnabled()) { + log.debug(this.getClass().getSimpleName() + " : contributors desc loaded [" + editorContextDescriptors.size() + "]"); + } + } + + /** + * Initialize the service. Do nothing here. + * + * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry) + * + * @param servicesRegistry + */ + @Override + public void init(ServicesRegistry servicesRegistry) { + + } + + /** + * Do nothing in this implementation. {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.core.services.IService#startService() + */ + @Override + public void startService() { + } + + /** + * Do nothing in this implementation. + */ + @Override + public void disposeService() { + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java new file mode 100644 index 00000000000..0bf82998e36 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java @@ -0,0 +1,122 @@ +/***************************************************************************** + * Copyright (c) 2008 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor; + +import java.util.List; + +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor.ComposedActionBarContributor; +import org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor.IMultiPageEditorActionBarContributor; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * + * An ActionBarContributor composed of ActionBarContributor from multi editor. + * This ActionBarContributor switch to the contributor dedicated to the active + * editor in a MultiPageEditor environement. + * + * @author dumoulin + * + */ +public class CoreComposedActionBarContributor extends ComposedActionBarContributor implements IMultiPageEditorActionBarContributor { + + /** + * The registry. Used to initialize the registered actionBars. + */ + protected ActionBarContributorRegistry actionBarContributorRegistry; + + protected List contributors; + + /** + * Constructor. + * + * @throws BackboneException + */ + public CoreComposedActionBarContributor() throws BackboneException { + // Init the contributors + loadContributors(); + } + + /** + * + * @throws BackboneException + */ + private void loadContributors() throws BackboneException { + actionBarContributorRegistry = new ActionBarContributorRegistry(Activator.PLUGIN_ID); + + contributors = actionBarContributorRegistry.getActionBarContributors(); + } + + /** + * @return the actionBarContributorRegistry + */ + public ActionBarContributorRegistry getActionBarContributorRegistry() { + return actionBarContributorRegistry; + } + + /** + * Dispose all nested ActionBarContributors. + */ + @Override + public void dispose() { + // Dispose nested contributors. + for (EditorActionBarContributor contributor : contributors) { + contributor.dispose(); + } + super.dispose(); + } + + /** + * Call the same method on each registered nested ActionBarContributors. + */ + @Override + public void init(IActionBars bars, IWorkbenchPage page) { + super.init(bars, page); + buildActions(); + + // init nested contributors. + for (EditorActionBarContributor contributor : contributors) { + contributor.init(bars, page); + // remove GMF GlobalSaveAction from bar, fix bug 407854 - [Editor] The save action is disabled in Papyrus + bars.setGlobalActionHandler("save", null); // GMF is not using IWorkbenchCommandConstants.FILE_SAVE as ID //$NON-NLS-1$ + } + + } + + /** + * Load default actions (undo/redo/delete) + * + * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions() + */ + protected void buildActions() { + // getActionBars().getToolBarManager().add(new UndoRetargetAction()); + // getActionBars().getToolBarManager().add(new RedoRetargetAction()); + } + + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + for (EditorActionBarContributor contributor : contributors) { + if (part != null) { + contributor.setActiveEditor(part); + } + } + + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/IActionBarContributorFactory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/IActionBarContributorFactory.java new file mode 100644 index 00000000000..d5aa13ef15a --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/multidiagram/actionbarcontributor/IActionBarContributorFactory.java @@ -0,0 +1,25 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor; + +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * Interface used to get an ActionBarContributor from its ID. + * + * @author dumoulin + * + */ +public interface IActionBarContributorFactory { + + /** + * Get an ActionBarContributor by its key. If an ActionBarContributor + * already exists for this key, return it. + * + * @param key + * @return + */ + public EditorActionBarContributor getActionBarContributor(Object key) throws BackboneException; +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/AbstractPapyrusPreferenceStore.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/AbstractPapyrusPreferenceStore.java new file mode 100644 index 00000000000..3b529b2e091 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/AbstractPapyrusPreferenceStore.java @@ -0,0 +1,300 @@ +/***************************************************************************** + * Copyright (c) 2014 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: + * + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog; + +public abstract class AbstractPapyrusPreferenceStore extends PapyrusScopedPreferenceStore { + + /** + * key for element level + */ + private final String elementLevelPrefix; + + /** + * key for editor level + */ + private final String instanceEditorLevelPrefix; + + /** + * key for all editor of the same kind + */ + private final String editorLevelPrefix; + + /** + * constructor + * + * @param context + * the scope to store to + * @param qualifier + * the qualifier used to look up the preference node + * @param key + * for all editor of the same kind (all diagrams, all tables, ...) + * @param key + * for an instance of this editor + * @param key + * for an element + */ + public AbstractPapyrusPreferenceStore(IScopeContext context, String qualifier, String editorLevelPrefix, String instanceEditorLevelPrefix, String elementLevelPrefix) { + super(context, qualifier); + this.editorLevelPrefix = editorLevelPrefix; + this.instanceEditorLevelPrefix = instanceEditorLevelPrefix; + this.elementLevelPrefix = elementLevelPrefix; + } + + /** + * constructor + * + * @param context + * the scope to store to + * @param qualifier + * the qualifier used to look up the preference node + * @param defaultQualifierPath + * the qualifier used when looking up the defaults + * @param key + * for all editor of the same kind (all diagrams, all tables, ...) + * @param key + * for an instance of this editor + * @param key + * for an element + */ + public AbstractPapyrusPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath, String editorLevelPrefix, String instanceEditorLevelPrefix, String elementLevelPrefix) { + super(context, qualifier, defaultQualifierPath); + this.editorLevelPrefix = editorLevelPrefix; + this.instanceEditorLevelPrefix = instanceEditorLevelPrefix; + this.elementLevelPrefix = elementLevelPrefix; + } + + + + + /** + * this method is used to overload all value under a level of preferences. + * In order to overload a pop-up is opened, and the user can choose value to overload + * + * @param level + * of preference: Editor or diagram + */ + + public void deleteAllSubPreference(String level) { + // remove all sub value diagram+ element + + // key to collect + List elementKey = new ArrayList(); + try { + for (int i = 0; i < getStorePreferences().keys().length; i++) { + // level diagram collect only element + if (level.startsWith(instanceEditorLevelPrefix)) { + if (getStorePreferences().keys()[i].startsWith(elementLevelPrefix)) { + elementKey.add(getStorePreferences().keys()[i]); + } + } + // editor level, collect all element+diagram + else if (level.startsWith(editorLevelPrefix)) { + if ((getStorePreferences().keys()[i].startsWith(elementLevelPrefix)) || (getStorePreferences().keys()[i].startsWith(instanceEditorLevelPrefix))) { + elementKey.add(getStorePreferences().keys()[i]); + } + } + + } + + } catch (Exception e) { + Activator.log.error(e); + } + if (elementKey.size() > 0) { + List keytoRemove = new ArrayList(); + String[] keyRoconsult = new String[elementKey.size()]; + AbstractApplyValueOnPreferenceKeyDialog dialog = createPreferenceKeyDialog(elementKey.toArray(keyRoconsult)); + dialog.open(); + keytoRemove = dialog.getKeyToRemove(); + + // remove key + Iterator iterator = keytoRemove.iterator(); + while (iterator.hasNext()) { + String key = iterator.next(); + getStorePreferences().remove(key); + } + } + } + + /** + * + * @param keys + * @return + * the dialog to apply values + */ + protected abstract AbstractApplyValueOnPreferenceKeyDialog createPreferenceKeyDialog(String[] keys); + + + + // each get value will be overloaded + // if not value is found for an element, a value is look for in DIAGRAM + // if a the value is not find for Diagram a value is find for Papyrus editor + + + /** + * this method is used to find a key that a got a value: + * if the key is an element. The method look for if this key exist. If no value exists, it look for the key for diagram + * if the key for diagram do not exist it look for key for papyrus Editor + * the structure of Key is: + * element : ELEMENT_DiagramKind_ElementKind.preferenceKind + * Diagram : DIAGRAM_DiagramKind.preferenceKind + * Editor: PAPYRUS_EDITOR.preferenceKind + * + */ + protected String findKeyWithAValue(String initialKey) { + String foundedKey = null; + // first look for in value stack + foundedKey = findKeyAStoreValue(initialKey); + // then look for in default stack + if (foundedKey == null) { + foundedKey = findKeyWithADefaultValue(initialKey); + } + if (foundedKey == null) { + foundedKey = initialKey; + } + return foundedKey; + + } + + /** + * look for a key with a value in the store stack + * + * @param initialKey + * element : ELEMENT_DiagramKind_ElementKind.preferenceKind + * Diagram : DIAGRAM_DiagramKind.preferenceKind + * Editor: PAPYRUS_EDITOR.preferenceKind + * @return the key that returns a value or null if there is no value + */ + protected String findKeyAStoreValue(String initialKey) { + String foundedKey = null; + if (getStorePreferences().get(initialKey, null) != null) { + foundedKey = initialKey; + } + + if (foundedKey == null && hasPrefix(initialKey)) { + foundedKey = findKeyAStoreValue(getUpperKey(initialKey)); + } + return foundedKey; + } + + /** + * this method is used to find a key that a got a value: + * if the key is an element. The method look for if this key exist. If no value exists, it look for the key for diagram + * if the key for diagram do not exist it look for key for papyrus Editor + * the structure of Key is: + * element : ELEMENT_DiagramKind_ElementKind.preferenceKind + * Diagram : DIAGRAM_DiagramKind.preferenceKind + * Editor: PAPYRUS_EDITOR.preferenceKind + * + */ + protected String findKeyWithADefaultValue(String initialKey) { + String foundedKey = null; + + if (getDefaultPreferences().get(initialKey, null) != null) { + foundedKey = initialKey; + } + + if (foundedKey == null && hasPrefix(initialKey)) { + return findKeyWithADefaultValue(getUpperKey(initialKey)); + } else { + foundedKey = initialKey; + } + return foundedKey; + + } + + /** + * get the upper Key from the initial Key + * * the structure of Key is: + * element : ELEMENT_DiagramKind_ElementKind.preferenceKind + * Diagram : DIAGRAM_DiagramKind.preferenceKind + * Editor: PAPYRUS_EDITOR.preferenceKind + * + * @param initialKey + * @return the upperKey + * + */ + protected String getUpperKey(String initialKey) { + + String out = initialKey.toString(); + if (initialKey.startsWith(elementLevelPrefix)) { + out = initialKey.toString().replaceAll(elementLevelPrefix, instanceEditorLevelPrefix); + out = out.substring(0, out.lastIndexOf("_")) + out.substring(out.indexOf("."), out.length()); + } + if (initialKey.startsWith(instanceEditorLevelPrefix)) { + // out=initialKey.toString().replaceAll(instanceEditorLevelPrefix, editorLevelPrefix); + out = editorLevelPrefix + out.substring(out.indexOf("."), out.length()); + } + return out; + } + + protected boolean hasPrefix(String key) { + if (key.startsWith(elementLevelPrefix) || key.startsWith(instanceEditorLevelPrefix)) { + return true; + } + return false; + } + + /** + * get the value from a key + * + * @param key + * @return the value + */ + @Override + protected String internalGet(String key) { + String newKey = findKeyWithAValue(key); + // System.err.println("-->Initial Key "+key+"--> "+ newKey); + return Platform.getPreferencesService().get(newKey, null, getPreferenceNodes(true)); + } + + @Override + public boolean getDefaultBoolean(String name) { + + return super.getDefaultBoolean(findKeyWithADefaultValue(name)); + } + + @Override + public double getDefaultDouble(String name) { + return super.getDefaultDouble(findKeyWithADefaultValue(name)); + } + + @Override + public float getDefaultFloat(String name) { + return super.getDefaultFloat(findKeyWithADefaultValue(name)); + }; + + @Override + public int getDefaultInt(String name) { + return super.getDefaultInt(findKeyWithADefaultValue(name)); + } + + @Override + public long getDefaultLong(String name) { + return super.getDefaultLong(findKeyWithADefaultValue(name)); + } + + @Override + public String getDefaultString(String name) { + return super.getDefaultString(findKeyWithADefaultValue(name)); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/PapyrusScopedPreferenceStore.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/PapyrusScopedPreferenceStore.java new file mode 100644 index 00000000000..f3ec34c88c1 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/PapyrusScopedPreferenceStore.java @@ -0,0 +1,858 @@ +/***************************************************************************** + * Copyright (c) 2010 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences; + +/*************************************************************************** + Copyright (c) 2010 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: + * the code is copy from ScopedPreferenceStore but I have open some methods in order to be + * available for the overload + * + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + * + *******************************************************************************/ + +import java.io.IOException; + +import org.eclipse.core.commands.common.EventManager; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.jface.preference.IPersistentPreferenceStore; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.ui.internal.WorkbenchMessages; +import org.osgi.service.prefs.BackingStoreException; + +/** + * The ScopedPreferenceStore is an IPreferenceStore that uses the scopes + * provided in org.eclipse.core.runtime.preferences. + *

+ * A ScopedPreferenceStore does the lookup of a preference based on it's search scopes and sets the value of the preference based on its store scope. + *

+ *

+ * The default scope is always included in the search scopes when searching for preference values. + *

+ * + * @see org.eclipse.core.runtime.preferences + * @since 3.1 + */ +public class PapyrusScopedPreferenceStore extends EventManager implements IPreferenceStore, IPersistentPreferenceStore { + + /** + * The storeContext is the context where values will stored with the + * setValue methods. If there are no searchContexts this will be the search + * context. (along with the "default" context) + */ + protected IScopeContext storeContext; + + /** + * The searchContext is the array of contexts that will be used by the get + * methods for searching for values. + */ + protected IScopeContext[] searchContexts; + + /** + * A boolean to indicate the property changes should not be propagated. + */ + protected boolean silentRunning = false; + + /** + * The listener on the IEclipsePreferences. This is used to forward updates + * to the property change listeners on the preference store. + */ + protected IEclipsePreferences.IPreferenceChangeListener preferencesListener; + + /** + * The default context is the context where getDefault and setDefault + * methods will search. This context is also used in the search. + */ + protected IScopeContext defaultContext = DefaultScope.INSTANCE; + + /** + * The nodeQualifer is the string used to look up the node in the contexts. + */ + protected String nodeQualifier; + + /** + * The defaultQualifier is the string used to look up the default node. + */ + protected String defaultQualifier; + + /** + * Boolean value indicating whether or not this store has changes to be + * saved. + */ + private boolean dirty; + + /** + * Create a new instance of the receiver. Store the values in context in the + * node looked up by qualifier. NOTE: Any instance of + * ScopedPreferenceStore should call + * + * @param context + * the scope to store to + * @param qualifier + * the qualifier used to look up the preference node + * @param defaultQualifierPath + * the qualifier used when looking up the defaults + */ + public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) { + this(context, qualifier); + this.defaultQualifier = defaultQualifierPath; + } + + /** + * Create a new instance of the receiver. Store the values in context in the + * node looked up by qualifier. + * + * @param context + * the scope to store to + * @param qualifier + * the qualifer used to look up the preference node + */ + public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier) { + storeContext = context; + this.nodeQualifier = qualifier; + this.defaultQualifier = qualifier; + + ((IEclipsePreferences) getStorePreferences().parent()).addNodeChangeListener(getNodeChangeListener()); + } + + /** + * Return a node change listener that adds a removes the receiver when nodes + * change. + * + * @return INodeChangeListener + */ + private INodeChangeListener getNodeChangeListener() { + return new IEclipsePreferences.INodeChangeListener() { + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences + * .NodeChangeEvent) + */ + public void added(NodeChangeEvent event) { + if (nodeQualifier.equals(event.getChild().name()) && isListenerAttached()) { + getStorePreferences().addPreferenceChangeListener(preferencesListener); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences. + * IEclipsePreferences.NodeChangeEvent) + */ + public void removed(NodeChangeEvent event) { + // Do nothing as there are no events from removed node + } + }; + } + + /** + * Initialize the preferences listener. + */ + private void initializePreferencesListener() { + if (preferencesListener == null) { + preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime. + * preferences.IEclipsePreferences.PreferenceChangeEvent) + */ + public void preferenceChange(PreferenceChangeEvent event) { + + if (silentRunning) { + return; + } + + Object oldValue = event.getOldValue(); + Object newValue = event.getNewValue(); + String key = event.getKey(); + if (newValue == null) { + newValue = getDefault(key, oldValue); + } else if (oldValue == null) { + oldValue = getDefault(key, newValue); + } + firePropertyChangeEvent(event.getKey(), oldValue, newValue); + } + }; + getStorePreferences().addPreferenceChangeListener(preferencesListener); + } + + } + + /** + * Does its best at determining the default value for the given key. Checks + * the given object's type and then looks in the list of defaults to see if + * a value exists. If not or if there is a problem converting the value, the + * default default value for that type is returned. + * + * @param key + * the key to search + * @param obj + * the object who default we are looking for + * @return Object or null + */ + protected Object getDefault(String key, Object obj) { + IEclipsePreferences defaults = getDefaultPreferences(); + if (obj instanceof String) { + return defaults.get(key, STRING_DEFAULT_DEFAULT); + } else if (obj instanceof Integer) { + return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); + } else if (obj instanceof Double) { + return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); + } else if (obj instanceof Float) { + return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); + } else if (obj instanceof Long) { + return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); + } else if (obj instanceof Boolean) { + return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; + } else { + return null; + } + } + + /** + * Return the IEclipsePreferences node associated with this store. + * + * @return the preference node for this store + */ + protected IEclipsePreferences getStorePreferences() { + return storeContext.getNode(nodeQualifier); + } + + /** + * Return the default IEclipsePreferences for this store. + * + * @return this store's default preference node + */ + protected IEclipsePreferences getDefaultPreferences() { + return defaultContext.getNode(defaultQualifier); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) + */ + public void addPropertyChangeListener(IPropertyChangeListener listener) { + initializePreferencesListener();// Create the preferences listener if it + // does not exist + addListenerObject(listener); + } + + /** + * Return the preference path to search preferences on. This is the list of + * preference nodes based on the scope contexts for this store. If there are + * no search contexts set, then return this store's context. + *

+ * Whether or not the default context should be included in the resulting list is specified by the includeDefault parameter. + *

+ * + * @param includeDefault + * true if the default context should be included + * and false otherwise + * @return IEclipsePreferences[] + * @since 3.4 public, was added in 3.1 as private method + */ + public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) { + // if the user didn't specify a search order, then return the scope that + // this store was created on. (and optionally the default) + if (searchContexts == null) { + if (includeDefault) { + return new IEclipsePreferences[] { getStorePreferences(), getDefaultPreferences() }; + } + return new IEclipsePreferences[] { getStorePreferences() }; + } + // otherwise the user specified a search order so return the appropriate + // nodes based on it + int length = searchContexts.length; + if (includeDefault) { + length++; + } + IEclipsePreferences[] preferences = new IEclipsePreferences[length]; + for (int i = 0; i < searchContexts.length; i++) { + preferences[i] = searchContexts[i].getNode(nodeQualifier); + } + if (includeDefault) { + preferences[length - 1] = getDefaultPreferences(); + } + return preferences; + } + + /** + * Set the search contexts to scopes. When searching for a value the seach + * will be done in the order of scope contexts and will not search the + * storeContext unless it is in this list. + *

+ * If the given list is null, then clear this store's search contexts. This means that only this store's scope context and default scope will be used during preference value searching. + *

+ *

+ * The defaultContext will be added to the end of this list automatically and MUST NOT be included by the user. + *

+ * + * @param scopes + * a list of scope contexts to use when searching, or null + */ + public void setSearchContexts(IScopeContext[] scopes) { + this.searchContexts = scopes; + if (scopes == null) { + return; + } + + // Assert that the default was not included (we automatically add it to + // the end) + for (int i = 0; i < scopes.length; i++) { + if (scopes[i].equals(defaultContext)) { + Assert.isTrue(false, WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError); + } + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String) + */ + public boolean contains(String name) { + if (name == null) { + return false; + } + return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(true))) != null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, + * java.lang.Object, java.lang.Object) + */ + public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { + // important: create intermediate array to protect against listeners + // being added/removed during the notification + final Object[] list = getListeners(); + if (list.length == 0) { + return; + } + final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); + for (int i = 0; i < list.length; i++) { + final IPropertyChangeListener listener = (IPropertyChangeListener) list[i]; + SafeRunner.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$ + + public void run() { + listener.propertyChange(event); + } + }); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String) + */ + public boolean getBoolean(String name) { + String value = internalGet(name); + return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value).booleanValue(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String) + */ + public boolean getDefaultBoolean(String name) { + return getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String) + */ + public double getDefaultDouble(String name) { + return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String) + */ + public float getDefaultFloat(String name) { + return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String) + */ + public int getDefaultInt(String name) { + return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String) + */ + public long getDefaultLong(String name) { + return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String) + */ + public String getDefaultString(String name) { + return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String) + */ + public double getDouble(String name) { + String value = internalGet(name); + if (value == null) { + return DOUBLE_DEFAULT_DEFAULT; + } + try { + return Double.parseDouble(value); + } catch (NumberFormatException e) { + return DOUBLE_DEFAULT_DEFAULT; + } + } + + /** + * Return the string value for the specified key. Look in the nodes which + * are specified by this object's list of search scopes. If the value does + * not exist then return null. + * + * @param key + * the key to search with + * @return String or null if the value does not exist. + */ + protected String internalGet(String key) { + return Platform.getPreferencesService().get(key, null, getPreferenceNodes(true)); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String) + */ + public float getFloat(String name) { + String value = internalGet(name); + if (value == null) { + return FLOAT_DEFAULT_DEFAULT; + } + try { + return Float.parseFloat(value); + } catch (NumberFormatException e) { + return FLOAT_DEFAULT_DEFAULT; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String) + */ + public int getInt(String name) { + String value = internalGet(name); + if (value == null) { + return INT_DEFAULT_DEFAULT; + } + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + return INT_DEFAULT_DEFAULT; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String) + */ + public long getLong(String name) { + String value = internalGet(name); + if (value == null) { + return LONG_DEFAULT_DEFAULT; + } + try { + return Long.parseLong(value); + } catch (NumberFormatException e) { + return LONG_DEFAULT_DEFAULT; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String) + */ + public String getString(String name) { + String value = internalGet(name); + return value == null ? STRING_DEFAULT_DEFAULT : value; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String) + */ + public boolean isDefault(String name) { + if (name == null) { + return false; + } + return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(false))) == null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving() + */ + public boolean needsSaving() { + return dirty; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, + * java.lang.String) + */ + public void putValue(String name, String value) { + try { + // Do not notify listeners + silentRunning = true; + getStorePreferences().put(name, value); + } finally { + // Be sure that an exception does not stop property updates + silentRunning = false; + dirty = true; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) + */ + public void removePropertyChangeListener(IPropertyChangeListener listener) { + removeListenerObject(listener); + if (!isListenerAttached()) { + disposePreferenceStoreListener(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * double) + */ + public void setDefault(String name, double value) { + getDefaultPreferences().putDouble(name, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * float) + */ + public void setDefault(String name, float value) { + getDefaultPreferences().putFloat(name, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * int) + */ + public void setDefault(String name, int value) { + getDefaultPreferences().putInt(name, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * long) + */ + public void setDefault(String name, long value) { + getDefaultPreferences().putLong(name, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * java.lang.String) + */ + public void setDefault(String name, String defaultObject) { + getDefaultPreferences().put(name, defaultObject); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, + * boolean) + */ + public void setDefault(String name, boolean value) { + getDefaultPreferences().putBoolean(name, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String) + */ + public void setToDefault(String name) { + + String oldValue = getString(name); + String defaultValue = getDefaultString(name); + try { + silentRunning = true;// Turn off updates from the store + // removing a non-existing preference is a no-op so call the Core + // API directly + getStorePreferences().remove(name); + if (!oldValue.equals(defaultValue)) { + dirty = true; + firePropertyChangeEvent(name, oldValue, defaultValue); + } + + } finally { + silentRunning = false;// Restart listening to preferences + } + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * double) + */ + public void setValue(String name, double value) { + double oldValue = getDouble(name); + if (oldValue == value) { + return; + } + try { + silentRunning = true;// Turn off updates from the store + if (getDefaultDouble(name) == value) { + getStorePreferences().remove(name); + } else { + getStorePreferences().putDouble(name, value); + } + dirty = true; + firePropertyChangeEvent(name, new Double(oldValue), new Double(value)); + } finally { + silentRunning = false;// Restart listening to preferences + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * float) + */ + public void setValue(String name, float value) { + float oldValue = getFloat(name); + if (oldValue == value) { + return; + } + try { + silentRunning = true;// Turn off updates from the store + if (getDefaultFloat(name) == value) { + getStorePreferences().remove(name); + } else { + getStorePreferences().putFloat(name, value); + } + dirty = true; + firePropertyChangeEvent(name, new Float(oldValue), new Float(value)); + } finally { + silentRunning = false;// Restart listening to preferences + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * int) + */ + public void setValue(String name, int value) { + int oldValue = getInt(name); + if (oldValue == value) { + return; + } + try { + silentRunning = true;// Turn off updates from the store + if (getDefaultInt(name) == value) { + getStorePreferences().remove(name); + } else { + getStorePreferences().putInt(name, value); + } + dirty = true; + firePropertyChangeEvent(name, Integer.valueOf(oldValue), Integer.valueOf(value)); + } finally { + silentRunning = false;// Restart listening to preferences + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * long) + */ + public void setValue(String name, long value) { + long oldValue = getLong(name); + if (oldValue == value) { + return; + } + try { + silentRunning = true;// Turn off updates from the store + if (getDefaultLong(name) == value) { + getStorePreferences().remove(name); + } else { + getStorePreferences().putLong(name, value); + } + dirty = true; + firePropertyChangeEvent(name, Long.valueOf(oldValue), Long.valueOf(value)); + } finally { + silentRunning = false;// Restart listening to preferences + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * java.lang.String) + */ + public void setValue(String name, String value) { + // Do not turn on silent running here as Strings are propagated + if (getDefaultString(name).equals(value)) { + getStorePreferences().remove(name); + } else { + getStorePreferences().put(name, value); + } + dirty = true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, + * boolean) + */ + public void setValue(String name, boolean value) { + boolean oldValue = getBoolean(name); + if (oldValue == value) { + return; + } + try { + silentRunning = true;// Turn off updates from the store + if (getDefaultBoolean(name) == value) { + getStorePreferences().remove(name); + } else { + getStorePreferences().putBoolean(name, value); + } + dirty = true; + firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE); + } finally { + silentRunning = false;// Restart listening to preferences + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.preference.IPersistentPreferenceStore#save() + */ + public void save() throws IOException { + try { + getStorePreferences().flush(); + dirty = false; + } catch (BackingStoreException e) { + throw new IOException(e.getMessage()); + } + + } + + /** + * Dispose the receiver. + */ + private void disposePreferenceStoreListener() { + + IEclipsePreferences root = (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE); + try { + if (!(root.nodeExists(nodeQualifier))) { + return; + } + } catch (BackingStoreException e) { + return;// No need to report here as the node won't have the + // listener + } + + IEclipsePreferences preferences = getStorePreferences(); + if (preferences == null) { + return; + } + if (preferencesListener != null) { + preferences.removePreferenceChangeListener(preferencesListener); + preferencesListener = null; + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractApplyValueOnPreferenceKeyDialog.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractApplyValueOnPreferenceKeyDialog.java new file mode 100644 index 00000000000..f21f02085d6 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractApplyValueOnPreferenceKeyDialog.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2010 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences.dialog; + +import java.util.ArrayList; + +/** + * The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys + */ +public abstract class AbstractApplyValueOnPreferenceKeyDialog extends AbstractPreferenceKeyDialog { + + /** The checked key. */ + protected ArrayList checkedKey; + + /** + * Instantiates a new apply value on preference key dialog. + * + * @param keys + * the keys + */ + public AbstractApplyValueOnPreferenceKeyDialog(String[] keys) { + super(keys); + checkedKey = new ArrayList(); + } + + /** + * Gets the key to remove. + * + * @return the key to remove + */ + public ArrayList getKeyToRemove() { + return checkedKey; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + for (int i = 0; i < keyTable.getItems().length; i++) { + if (keyTable.getItems()[i].getChecked()) { + checkedKey.add((String) keyTable.getItems()[i].getData()); + } + } + super.okPressed(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#cancelPressed() + */ + @Override + protected void cancelPressed() { + super.cancelPressed(); + checkedKey = new ArrayList(); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractPreferenceKeyDialog.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractPreferenceKeyDialog.java new file mode 100644 index 00000000000..9265a692051 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/dialog/AbstractPreferenceKeyDialog.java @@ -0,0 +1,105 @@ +/***************************************************************************** + * Copyright (c) 2010 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences.dialog; + +import java.util.Arrays; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.messages.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** + * The Class AbstractPreferenceKeyDialog display all preference key that are given in parameters + */ +public abstract class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.StatusDialog { + + /** The key table. */ + protected Table keyTable; + + /** The table viewer. */ + protected TableViewer tableViewer; + + /** The keys. */ + protected String[] keys; + + /** + * Instantiates a new abstract preference key dialog. + * + * @param keys + * the array of preference jy to display + */ + public AbstractPreferenceKeyDialog(String[] keys) { + super(new Shell()); + this.keys = Arrays.copyOf(keys, keys.length); + setStatusLineAboveButtons(true); + updateStatus(new Status(IStatus.INFO, Activator.PLUGIN_ID, Messages.AbstractPreferenceKeyDialog_WouldYouLikeOverloadPreferences)); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + keyTable = new Table(composite, SWT.CHECK | SWT.BORDER); + tableViewer = new TableViewer(keyTable); + tableViewer.setLabelProvider(createLabelProvider()); + tableViewer.setContentProvider(createContentProvider()); + + TableColumn column = new TableColumn(keyTable, SWT.NONE); + column.setWidth(150); + column.setText(Messages.AbstractPreferenceKeyDialog_Pref_Kind); + + column = new TableColumn(keyTable, SWT.NONE); + column.setWidth(90); + column.setText(Messages.AbstractPreferenceKeyDialog_Level); + + column = new TableColumn(keyTable, SWT.NONE); + column.setWidth(200); + column.setText(Messages.AbstractPreferenceKeyDialog_Localization); + tableViewer.setInput(keys); + keyTable.setHeaderVisible(true); + + + return composite; + + } + + /** + * + * @return + * the label provider for the table viewer + */ + protected abstract IBaseLabelProvider createLabelProvider(); + + /** + * + * @return + * the content provider for the table viewer + */ + protected abstract IContentProvider createContentProvider(); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleEventListener.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleEventListener.java new file mode 100644 index 00000000000..7264ae39750 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleEventListener.java @@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright (c) 2013, 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 469188 + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.services; + +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; + +/** + * Listens to the Lifecycle of an {@link IMultiDiagramEditor} + * + * @author Camille Letavernier + * + */ +public interface EditorLifecycleEventListener { + + /** + * The ServicesRegistry is successfully started + * + * @param editor + */ + public void postInit(IMultiDiagramEditor editor); + + /** + * All the editors are constructed, but not yet displayed + * + * @param editor + */ + public default void preDisplay(IMultiDiagramEditor editor) { + // Pass + } + + /** + * All the editors are displayed + * + * @param editor + */ + public void postDisplay(IMultiDiagramEditor editor); + + /** + * The editor is about to be closed + * + * @param editor + */ + public void beforeClose(IMultiDiagramEditor editor); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleManager.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleManager.java new file mode 100644 index 00000000000..2866903aa39 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/EditorLifecycleManager.java @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2013 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.ui.services; + +import org.eclipse.papyrus.infra.core.services.IService; + +/** + * The LifecycleManager for IMultiDiagramEditor + * + * It notifies its listeners when the state of the editor changes + * + * @author Camille Letavernier + * + */ +public interface EditorLifecycleManager extends IService { + + public void addEditorLifecycleEventsListener(EditorLifecycleEventListener listener); + + public void removeEditorLifecycleEventsListener(EditorLifecycleEventListener listener); + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/Messages.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/Messages.java new file mode 100644 index 00000000000..58482ab0e2c --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/Messages.java @@ -0,0 +1,34 @@ +/***************************************************************************** + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.services; + +import org.eclipse.osgi.util.NLS; + +/** + * Translatable strings. + */ +class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.core.services.messages"; //$NON-NLS-1$ + public static String SaveLayoutBeforeClose_0; + public static String SaveLayoutBeforeClose_1; + public static String SaveLayoutBeforeClose_2; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/ResourceUpdateService.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/ResourceUpdateService.java new file mode 100644 index 00000000000..423727e534f --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/ResourceUpdateService.java @@ -0,0 +1,292 @@ +/***************************************************************************** + * Copyright (c) 2013, 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation + * Christian W. Damus (CEA) - bug 437217 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.services; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.ConcurrentMap; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.IService; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor.DirtyPolicy; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.progress.IWorkbenchSiteProgressService; +import org.eclipse.ui.progress.UIJob; + +import com.google.common.collect.Maps; + +/** + * A Service to check workspace modifications on current resources + * + * @author Camille Letavernier + * + */ +public class ResourceUpdateService implements IService, IPartListener { + + protected ServicesRegistry registry; + + protected ModelSet modelSet; + + static int[] handledTypes = new int[] { IResourceChangeEvent.POST_CHANGE, IResourceChangeEvent.PRE_DELETE, IResourceChangeEvent.PRE_CLOSE }; + + protected boolean isSaving; + + protected ConcurrentMap pendingEditorCloseJobs = Maps.newConcurrentMap(); + + private final ISaveEventListener preSaveListener = new ISaveEventListener() { + + @Override + public void doSaveAs(DoSaveEvent event) { + isSaving = true; + } + + @Override + public void doSave(DoSaveEvent event) { + isSaving = true; + } + }; + + private final ISaveEventListener postSaveListener = new ISaveEventListener() { + + @Override + public void doSaveAs(DoSaveEvent event) { + isSaving = false; + } + + @Override + public void doSave(DoSaveEvent event) { + isSaving = false; + } + }; + + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + this.registry = servicesRegistry; + } + + @Override + public void startService() throws ServiceException { + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); + modelSet = registry.getService(ModelSet.class); + registry.getService(ILifeCycleEventsProvider.class).addAboutToDoSaveListener(preSaveListener); + registry.getService(ILifeCycleEventsProvider.class).addPostDoSaveListener(postSaveListener); + } + + @Override + public void disposeService() throws ServiceException { + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + modelSet = null; + } + + protected void closeEditor() { + closeEditor(Collections. emptyList(), false); + } + + protected void closeEditor(final Collection triggeringResources, final boolean reopen) { + try { + if (!reopen) { + registry.remove(SaveLayoutBeforeClose.class.getName()); + } + + final IMultiDiagramEditor editor = registry.getService(IMultiDiagramEditor.class); + if (editor != null) { + final IWorkbenchPartSite site = editor.getSite(); + UIJob closeEditorJob = new UIJob(site.getShell().getDisplay(), NLS.bind("Reload editor {0}", editor.getTitle())) { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + // Remove the pending job + pendingEditorCloseJobs.remove(editor); + + IStatus result = Status.OK_STATUS; + monitor = SubMonitor.convert(monitor, IProgressMonitor.UNKNOWN); + + try { + IReloadableEditor.ReloadReason reason = reopen ? IReloadableEditor.ReloadReason.RESOURCES_CHANGED : IReloadableEditor.ReloadReason.RESOURCES_DELETED; + + DirtyPolicy dirtyPolicy = DirtyPolicy.getDefault(); + if (!reopen && !editor.isDirty()) { + // Check whether we're deleting one of our own resources. If so, just close + URI principalURI = modelSet.getURIWithoutExtension(); + for (Resource next : triggeringResources) { + if (next.getURI().trimFileExtension().equals(principalURI)) { + dirtyPolicy = DirtyPolicy.DO_NOT_SAVE; + break; + } + } + } + + try { + IReloadableEditor.Adapter.getAdapter(editor).reloadEditor(triggeringResources, reason, dirtyPolicy); + } catch (CoreException e) { + result = e.getStatus(); + } + } finally { + monitor.done(); + } + + return result; + } + }; + + // We are notified usually of at least three resources (*.di, *.notation, *.uml) that are unloaded, but + // there's no need to close and re-open the same editor three times + if (pendingEditorCloseJobs.putIfAbsent(editor, closeEditorJob) == null) { + // Async execution to avoid lock conflicts on the Workspace (Probably owned by this thread, and not the UI thread) + IWorkbenchSiteProgressService progressService = site.getService(IWorkbenchSiteProgressService.class); + progressService.schedule(closeEditorJob); + } + } + } catch (ServiceException ex) { + // Nothing + } + } + + protected void handleResourcesRemoved(Collection emfResources) { + closeEditor(emfResources, false); + } + + protected void handleResourceChanged(Collection emfResources) { + closeEditor(emfResources, true); + } + + // Copied from org.eclipse.emf.ecore.presentation.EcoreEditor + protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { + + @Override + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + + protected Collection changedResources = new ArrayList(); + + protected Collection removedResources = new ArrayList(); + + @Override + public boolean visit(final IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED) { + URI resourceURI = URI.createPlatformResourceURI(delta.getFullPath().toString(), true); + Resource resource = modelSet.getResource(resourceURI, false); + if (resource == null) { + // try again, with a pluginURI, see bug 418428 + URI pluginURI = URI.createPlatformPluginURI(delta.getFullPath().toString(), true); + resource = modelSet.getResource(pluginURI, false); + } + if (resource != null) { + + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } else { + if ((delta.getFlags() & IResourceDelta.MARKERS) != 0) { + // Skip markers + // DiagnosticDecorator.DiagnosticAdapter.update(resource, markerHelper.getMarkerDiagnostics(resource, (IFile)delta.getResource())); + } + if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { + // if(!savedResources.remove(resource)) { + // changedResources.add(resource); + // } + if (!isSaving) { + changedResources.add(resource); + } + } + } + } + } + return false; + } + + return true; + } + + public Collection getChangedResources() { + return changedResources; + } + + public Collection getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + handleResourcesRemoved(visitor.getRemovedResources()); + } + + if (!visitor.getChangedResources().isEmpty()) { + handleResourceChanged(visitor.getChangedResources()); + } + } catch (CoreException exception) { + Activator.log.error(exception); + } + } + }; + + @Override + public void partActivated(IWorkbenchPart part) { + // Nothing + } + + @Override + public void partBroughtToTop(IWorkbenchPart part) { + // Nothing + } + + @Override + public void partClosed(IWorkbenchPart part) { + // Nothing + } + + @Override + public void partDeactivated(IWorkbenchPart part) { + // Nothing + } + + @Override + public void partOpened(IWorkbenchPart part) { + // Nothing + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/SaveLayoutBeforeClose.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/SaveLayoutBeforeClose.java new file mode 100644 index 00000000000..0243ca859b1 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/SaveLayoutBeforeClose.java @@ -0,0 +1,218 @@ +/***************************************************************************** + * Copyright (c) 2014, 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 434983 + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.services; + +import java.io.IOException; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialogWithToggle; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; +import org.eclipse.papyrus.infra.core.services.IService; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.internal.commands.TogglePageLayoutStorageHandler; +import org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences; +import org.eclipse.papyrus.infra.ui.internal.preferences.YesNo; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider; + +/** + * This service automatically saves the current SashModel before closing the Papyrus editor + * + * This is useful, as modifications to the SashModel do not dirty the editor + * + * The save action is not executed if the editor is dirty when it is closed (To ensure model consistency) + * + * Bug 430976: [SashEditor] Editor layout is not exactly the same when reopening the model + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430976 + * + * @author Camille Letavernier + */ +public class SaveLayoutBeforeClose implements IService { + + private ServicesRegistry registry; + + private EditorLifecycleManager lifecycleManager; + + private EditorLifecycleEventListener lifecycleListener; + + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + this.registry = servicesRegistry; + } + + @Override + public void startService() throws ServiceException { + installSaveOnClose(); + } + + protected void installSaveOnClose() { + try { + lifecycleManager = registry.getService(EditorLifecycleManager.class); + if (lifecycleManager == null) { + return; + } + } catch (ServiceException ex) { + return; + } + + lifecycleListener = new EditorLifecycleEventListener() { + + @Override + public void postInit(IMultiDiagramEditor editor) { + // Nothing + } + + @Override + public void postDisplay(IMultiDiagramEditor editor) { + checkSharedLayout(editor); + } + + @Override + public void beforeClose(IMultiDiagramEditor editor) { + saveBeforeClose(editor); + } + }; + + lifecycleManager.addEditorLifecycleEventsListener(lifecycleListener); + } + + public void saveBeforeClose(IMultiDiagramEditor editor) { + if (editor.isDirty()) { + return; // User explicitly quit without saving. Do nothing (And if user wants to save during exit, the sashmodel will be saved anyway) + } + + ModelSet modelSet; // Required + LifeCycleEventsProvider internalLifecycleEventsProvider = null; // Optional + + try { + modelSet = registry.getService(ModelSet.class); + } catch (ServiceException ex) { + return; + } + + try { + ILifeCycleEventsProvider eventsProvider = registry.getService(ILifeCycleEventsProvider.class); + if (eventsProvider instanceof LifeCycleEventsProvider) { + internalLifecycleEventsProvider = (LifeCycleEventsProvider) eventsProvider; + } + } catch (ServiceException ex) { + // Ignore: the service is optional + } + + SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); + + try { + // We need to send pre- and post-save events, but we can only do that with the internal LifecycleEventsProvider + // The ISaveAndDirtyService can only save the whole model, but we just want to save the sash + DoSaveEvent event = new DoSaveEvent(registry, editor, true); + if (internalLifecycleEventsProvider != null) { + internalLifecycleEventsProvider.fireAboutToDoSaveEvent(event); + internalLifecycleEventsProvider.fireDoSaveEvent(event); + } + sashModel.saveModel(); + if (internalLifecycleEventsProvider != null) { + internalLifecycleEventsProvider.firePostDoSaveEvent(event); + } + } catch (IOException ex) { + Activator.log.error(ex); + } + } + + private void checkSharedLayout(IMultiDiagramEditor editor) { + try { + ModelSet modelSet = registry.getService(ModelSet.class); + SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); + + if (sashModel.isLegacyMode()) { + // Have we ever created the private sash model file? + URI privateURI = sashModel.getPrivateResourceURI(); + if (!modelSet.getURIConverter().exists(privateURI, null)) { + // Prompt the user + promptToEnablePrivateStorage(editor); + } + } + } catch (ServiceException ex) { + // Shared layout doesn't matter if there's no model-set + } + } + + private void promptToEnablePrivateStorage(IMultiDiagramEditor editor) { + YesNo preference = EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); + + if (preference == YesNo.PROMPT) { + MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoCancelQuestion(editor.getSite().getShell(), + Messages.SaveLayoutBeforeClose_0, + Messages.SaveLayoutBeforeClose_1, + Messages.SaveLayoutBeforeClose_2, false, null, null); + + switch (dlg.getReturnCode()) { + case IDialogConstants.YES_ID: + preference = YesNo.YES; + break; + case IDialogConstants.NO_ID: + preference = YesNo.NO; + break; + default: + // User cancelled + preference = YesNo.PROMPT; + break; + } + + if (dlg.getToggleState()) { + EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(preference); + } + } + + switch (preference) { + case YES: + // Change the storage to private + new TogglePageLayoutStorageHandler().togglePrivatePageLayout(editor); + + // And save the new layout scheme + saveBeforeClose(editor); + break; + case NO: + // Just create the empty resource and save it + try { + ModelSet modelSet = editor.getServicesRegistry().getService(ModelSet.class); + SashModel sashModel = (SashModel) modelSet.getModel(SashModel.MODEL_ID); + modelSet.createResource(sashModel.getPrivateResourceURI()); + saveBeforeClose(editor); + } catch (ServiceException e) { + // Without a model-set, much else is going wrong, so there's no need to deal + // with this here + } + break; + default: + // User cancelled + break; + } + } + + @Override + public void disposeService() throws ServiceException { + registry = null; + if (lifecycleManager != null) { + lifecycleManager.removeEditorLifecycleEventsListener(lifecycleListener); + lifecycleListener = null; + lifecycleManager = null; + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/EditorLifecycleManagerImpl.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/EditorLifecycleManagerImpl.java new file mode 100644 index 00000000000..b37b131962a --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/EditorLifecycleManagerImpl.java @@ -0,0 +1,128 @@ +/***************************************************************************** + * Copyright (c) 2013, 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 469188 + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.services.internal; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.SafeRunner; +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.infra.ui.services.EditorLifecycleEventListener; +import org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager; + + +public class EditorLifecycleManagerImpl implements EditorLifecycleManager, InternalEditorLifecycleManager { + + private final Set listeners = new HashSet(); + + @Override + public void init(ServicesRegistry servicesRegistry) throws ServiceException { + // Nothing + } + + @Override + public void startService() throws ServiceException { + // Nothing + } + + @Override + public void disposeService() throws ServiceException { + listeners.clear(); + } + + @Override + public void addEditorLifecycleEventsListener(EditorLifecycleEventListener listener) { + listeners.add(listener); + } + + @Override + public void removeEditorLifecycleEventsListener(EditorLifecycleEventListener listener) { + listeners.remove(listener); + } + + @Override + public void firePostInit(final IMultiDiagramEditor editor) { + for (final EditorLifecycleEventListener listener : listeners) { + SafeRunner.run(new ISafeRunnable() { + + @Override + public void run() throws Exception { + listener.postInit(editor); + } + + @Override + public void handleException(Throwable exception) { + // Already logged by the SafeRunner + } + }); + } + } + + @Override + public void firePreDisplay(final IMultiDiagramEditor editor) { + for (final EditorLifecycleEventListener listener : listeners) { + SafeRunner.run(new ISafeRunnable() { + + @Override + public void run() throws Exception { + listener.preDisplay(editor); + } + + @Override + public void handleException(Throwable exception) { + // Already logged by the SafeRunner + } + }); + } + } + + @Override + public void firePostDisplay(final IMultiDiagramEditor editor) { + for (final EditorLifecycleEventListener listener : listeners) { + SafeRunner.run(new ISafeRunnable() { + + @Override + public void run() throws Exception { + listener.postDisplay(editor); + } + + @Override + public void handleException(Throwable exception) { + // Already logged by the SafeRunner + } + }); + } + } + + @Override + public void fireBeforeClose(final IMultiDiagramEditor editor) { + for (final EditorLifecycleEventListener listener : listeners) { + SafeRunner.run(new ISafeRunnable() { + + @Override + public void run() throws Exception { + listener.beforeClose(editor); + } + + @Override + public void handleException(Throwable exception) { + // Already logged by the SafeRunner + } + }); + } + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/InternalEditorLifecycleManager.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/InternalEditorLifecycleManager.java new file mode 100644 index 00000000000..301557028d9 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/internal/InternalEditorLifecycleManager.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2013, 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 469188 + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.services.internal; + +import org.eclipse.papyrus.infra.core.services.IService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; + + +public interface InternalEditorLifecycleManager extends IService { + + /** + * Sends the postInit notification for this editor + * + * @param editor + */ + void firePostInit(IMultiDiagramEditor editor); + + /** + * Sets the preDisplay notification for this editor + * + * @param editor + */ + void firePreDisplay(IMultiDiagramEditor editor); + + /** + * Sends the postDisplay notification for this editor + * + * @param editor + */ + void firePostDisplay(IMultiDiagramEditor editor); + + /** + * Sends the beforeClose notification for this Editor + * + * @param editor + */ + void fireBeforeClose(IMultiDiagramEditor editor); +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/messages.properties b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/messages.properties new file mode 100644 index 00000000000..a6f77150932 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/services/messages.properties @@ -0,0 +1,15 @@ +# +# Copyright (c) 2015 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Christian W. Damus - Initial API and implementation +# + +SaveLayoutBeforeClose_0=Editor Layout Storage +SaveLayoutBeforeClose_1=This model stores the editor page layout in the DI resource, which if managed in a source control system will share the layout with others. Convert to local (private) storage of the page layout? +SaveLayoutBeforeClose_2=Remember my decision diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/AbstractCreateMenuFromCommandCategory.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/AbstractCreateMenuFromCommandCategory.java new file mode 100644 index 00000000000..82ef8983d95 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/AbstractCreateMenuFromCommandCategory.java @@ -0,0 +1,135 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.expressions.EvaluationResult; +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; +import org.eclipse.ui.menus.ExtensionContributionFactory; +import org.eclipse.ui.menus.IContributionRoot; +import org.eclipse.ui.services.IServiceLocator; + +/** + * Abstract Class to create menu from an Eclipse Command category + * + * @author VL222926 + * + */ +public abstract class AbstractCreateMenuFromCommandCategory extends ExtensionContributionFactory { + + /** the category of the command contributing to this menu */ + protected final String commandCateogyId; + + /** + * + * Constructor. + * + * @param commandCategoryId + * the category of the command contributing to this menu + */ + public AbstractCreateMenuFromCommandCategory(final String commandCategoryId) { + this.commandCateogyId = commandCategoryId; + } + + /** + * + * @see org.eclipse.ui.menus.AbstractContributionFactory#createContributionItems(org.eclipse.ui.services.IServiceLocator, org.eclipse.ui.menus.IContributionRoot) + * + * @param serviceLocator + * @param additions + */ + @Override + public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { + // test to know if we can create elements if it is possible... + Expression visibleWhen = new Expression() { + + @Override + public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { + return EvaluationResult.TRUE; + } + }; + for (final CommandContributionItem item : addCreationItems(serviceLocator, additions, null)) { + additions.addContributionItem(item, visibleWhen); + } + } + + /** + * + * @param serviceLocator + * @param additions + * @param parent + * @return + */ + protected List addCreationItems(final IServiceLocator serviceLocator, final IContributionRoot additions, IContributionManager parent) { + final ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); + final List items = new ArrayList(); + final Category category = commandService.getCategory(this.commandCateogyId); + final Set commands = new TreeSet(); + commands.addAll(Arrays.asList(commandService.getDefinedCommands())); + for (Command command : commands) { + Category currentCategory = null; + try { + currentCategory = command.getCategory(); + } catch (NotDefinedException e) { + Activator.log.debug(e.getLocalizedMessage()); + continue; + } + if (command.isDefined() && category.equals(currentCategory)) { + final IHandler handler = command.getHandler(); + if (handler instanceof AbstractHandler) { + + // required!?!?! in some case can avoid the message for handler conflicting (ex : Allocate in SysML NatTable Allocation + ((AbstractHandler) handler).setEnabled(null); + boolean isEnabled = handler.isEnabled(); + command.setEnabled(null); + ((AbstractHandler) handler).setEnabled(null); + + isEnabled = handler.isEnabled(); + try { + if (isEnabled) { + CommandContributionItemParameter p = new CommandContributionItemParameter(serviceLocator, "", command.getId(), SWT.PUSH); //$NON-NLS-1$ + p.label = command.getDescription(); + p.icon = EclipseCommandUtils.getCommandIcon(command); + CommandContributionItem item = new CommandContributionItem(p); + items.add(item); + } + } catch (NotDefinedException e) { + Activator.log.debug(e.getLocalizedMessage()); + } + } + } + } + return items; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/DisplayUtils.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/DisplayUtils.java new file mode 100644 index 00000000000..0781c1d0ce7 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/DisplayUtils.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.Activator; + + +/** + * Util class for display in Papyrus (label providers, etc...) + * + * @deprecated Use the LabelProviderService instead + */ +@Deprecated +public class DisplayUtils { + + /** + * Gets the shared label provider. + * + * @return Get the current {@link ILabelProvider} or null if + * not found + */ + public static ILabelProvider getLabelProvider() { + try { + ServicesRegistry registry = EditorUtils.getServiceRegistry(); + return registry == null ? null : registry.getService(ILabelProvider.class); + } catch (IllegalStateException e) { + // Registry can't be found, do nothing. + Activator.log.error(e); + } catch (ServiceException e) { + Activator.log.error(e); + } + return null; + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EclipseCommandUtils.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EclipseCommandUtils.java new file mode 100644 index 00000000000..d7d462e82ca --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EclipseCommandUtils.java @@ -0,0 +1,137 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import java.util.Collection; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.State; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandImageService; +import org.eclipse.ui.commands.ICommandService; + +/** + * This class provides useful methods to manipulate Eclipse Command + * + * @author vl222926 + * + */ +public class EclipseCommandUtils { + + private EclipseCommandUtils() { + // to prevent instanciation + } + + public static final String TOGGLE_STATE = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$ + + public static final String RADIO_STATE = "org.eclipse.ui.commands.radioState"; //$NON-NLS-1$ + + public static final String DELETE_COMMAND = "org.eclipse.ui.edit.delete"; //$NON-NLS-1$ + + /** + * + * @param categoryId + * a category id + * @return + * all commands defined for this category + */ + public static final Collection getAllExistingCommandsInCategory(final String categoryId) { + final Set commands = new TreeSet(); + final ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); + final Category category = commandService.getCategory(categoryId); + for (final Command command : commandService.getDefinedCommands()) { + Category currentCategory = null; + try { + currentCategory = command.getCategory(); + } catch (NotDefinedException e) { + Activator.log.debug(e.getLocalizedMessage()); + continue; + } + if (/* command.isDefined() && */category.equals(currentCategory)) { + commands.add(command); + } + } + return commands; + } + + /** + * + * @param command + * an Eclipse command + * @return + * the image descriptor associated to this command + */ + public static final ImageDescriptor getCommandIcon(final Command command) { + final IWorkbench workbench = PlatformUI.getWorkbench(); + final ICommandImageService service = workbench.getService(ICommandImageService.class); + final ImageDescriptor imageDescriptor = service.getImageDescriptor(command.getId()); + return imageDescriptor; + } + + /** + * + * @param command + * an eclipse command + * @param newValue + * the new boolean value to set to the state of this command + */ + public static final void updateToggleCommandState(final org.eclipse.core.commands.Command command, final boolean newValue) { + if (command != null) { + final State state = command.getState(TOGGLE_STATE); + if (state != null) { + state.setValue(newValue); + } + } + } + + /** + * + * @param command + * an eclipse command + * @param newValue + * the new value to set to the state of this command + */ + public static final void updateRadioCommandState(final org.eclipse.core.commands.Command command, final Object newValue) { + if (command != null) { + final State state = command.getState(RADIO_STATE); + if (state != null) { + state.setValue(newValue); + } + } + } + + /** + * + * @return + * the eclipse command service + */ + public static final ICommandService getCommandService() { + IWorkbench wb = PlatformUI.getWorkbench(); + if (wb != null) { + IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); + if (ww != null) { + return ww.getService(ICommandService.class); + } + } + return null; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorHelper.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorHelper.java new file mode 100644 index 00000000000..be7a0d1dbaa --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorHelper.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * 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: + * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * + * a helper for the Editor + * + */ +public class EditorHelper { + + private EditorHelper() { + // nothing to do + } + + /** + * + * @return + * the current editor or null if not found + */ + public static final IEditorPart getCurrentEditor() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); + if (activeWorkbench != null) { + final IWorkbenchPage activePage = activeWorkbench.getActivePage(); + if (activePage != null) { + return activePage.getActiveEditor(); + } + } + } + return null; + } + + /** + * + * @return + * the current active part or null if not found + */ + public static final IWorkbenchPart getActivePart() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); + if (activeWorkbench != null) { + final IWorkbenchPage activePage = activeWorkbench.getActivePage(); + if (activePage != null) { + return activePage.getActivePart(); + } + } + } + return null; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorUtils.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorUtils.java new file mode 100644 index 00000000000..eea097e6062 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/EditorUtils.java @@ -0,0 +1,721 @@ +/***************************************************************************** + * Copyright (c) 2008, 2013 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Thomas Szadel: Code simplification and NPE + * management. + * Christian W. Damus (CEA LIST) - API for determining URI of a resource in an editor + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr; +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.service.IPageManager; +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.DiResourceSet; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.editor.CoreMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; + +/** + * Set of utility methods for the CoreEditor.
+ * WARNING : Some of these methods rely on + * PlatformUI.getWorkbench().getActiveWorkbenchWindow()getActivePage() to lookup + * for shared objects owned by the main editor. This doesn't work during the + * initialization of the main editor because the main editor is not yet + * registered in the Eclipse workbench. This can lead to a null or an exception, + * and sometime this can lead to getting the shared object of another main + * editor ! + * + * @author cedric dumoulin + * @author Thomas Szadel + */ +// FIXME throws Exception (eg: NotFoundException) instead of null +public class EditorUtils { + + /** + * Gets the opened multi-diagram editors. + * + * @return The opened {@link IMultiDiagramEditor} or null if an error + * occured. + */ + public static IMultiDiagramEditor[] getMultiDiagramEditors() { + // Lookup ServiceRegistry + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (workbenchWindow == null) { + return null; + } + IWorkbenchPage page = workbenchWindow.getActivePage(); + if (page == null) { + return null; + } + List list = new ArrayList(); + for (IEditorReference editorRef : page.getEditorReferences()) { + IEditorPart editorPart = editorRef.getEditor(false); + if (editorPart instanceof IMultiDiagramEditor) { + list.add((IMultiDiagramEditor) editorPart); + } + } + return list.toArray(new IMultiDiagramEditor[list.size()]); + } + + /** + * Returns the editors that are related to to given file.
+ * + * @param file + * The file (model, di or notation). + * @return The associated editors. + */ + public static IMultiDiagramEditor[] getRelatedEditors(IFile file) { + // Get the DI file + IFile diFile = DiModelUtils.getRelatedDiFile(file); + if (diFile == null || !diFile.exists()) { + return new IMultiDiagramEditor[0]; + } + + IMultiDiagramEditor[] openedEditors = EditorUtils.getMultiDiagramEditors(); + if (openedEditors == null) { + return new IMultiDiagramEditor[0]; + } + List list = new ArrayList(openedEditors.length); + + for (IMultiDiagramEditor editorPart : openedEditors) { + if (editorPart.getEditorInput() instanceof IFileEditorInput && diFile.equals(((IFileEditorInput) editorPart.getEditorInput()).getFile())) { + list.add(editorPart); + } + } + return list.toArray(new IMultiDiagramEditor[list.size()]); + } + + /** + * 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 IPageManager getIPageMngr(Resource diResource) { + return DiSashModelMngr.createIPageMngr(diResource); + } + + + // ////////////////////////////////////////// + // 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 + // ////////////////////////////////////////// + + /** + * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active + * editor, if possible, or null if not possible.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if there is no active editor, or if the editor is + * not instance of IMultiDiagramEditor.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * 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; + } + } + + /** + * Lookup the currently active Diagram from the Papyrus editor. Return the + * current Diagram or null if none is active.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if the ServicesRegistry can not be found.
+ * TODO This method introduce dependency on GMF. It can be moved to a GMF + * plugin. + * + * @return The active diagram or null if not found. + * + * @deprecated The core do make suppositions about the type of nested + * 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(); + // } + + /** + * Lookup the currently active Diagram from the Papyrus editor. Return the + * current Diagram or null if none is active.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if the ServicesRegistry can not be found.
+ * TODO This method introduce dependency on GMF. It can be moved to a GMF + * plugin. + * + * @return the active diagram editor or null if not found. + * + * @deprecated The core do make suppositions about the type of nested + * 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(); + // // Check if it is a GMF DiagramEditor + // if(activeEditor instanceof DiagramEditor) { + // return ((DiagramEditor)activeEditor); + // } else { + // // Not found + // return null; + // } + // + // } + + /** + * Lookup the currently active {@link IEditorPart} from the Papyrus editor. + * Return the current nested editor part, or null if it can not be found.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if the ServicesRegistry can not be found.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * In any case, a check should be done on the returned value that can be + * null. An alternative is to use + * serviceRegistry.getService(ISashWindowsContainer + * .class).getActiveEditor();
+ * It is preferable to retrieve the ServiceRegistry from elsewhere whenever + * it is possible.
+ * + * + * @return + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static IEditorPart lookupActiveNestedIEditor() { + // Get the sashwindow container + ISashWindowsContainer container = getSashWindowContainer(); + // Get the active page within the sashcontainer + return container == null ? null : container.getActiveEditor(); + } + + /** + * Lookup the currently active IEditor in the SashSystem. If the currently + * eclipse active editor doesn't contains a {@link ISashWindowsContainer}, + * return null. If the current SashSystem page is not a IEditor, return + * null.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if the ServicesRegistry can not be found.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * In any case, a check should be done on the returned value that can be + * null. An alternative is to use + * serviceRegistry.getService(ISashWindowsContainer + * .class).getActiveSashWindowsPage();
+ * It is preferable to retrieve the ServiceRegistry from elsewhere whenever + * it is possible. + * + * @return + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static IPage lookupActiveNestedPage() { + + // Get the sashwindow container + ISashWindowsContainer container = getSashWindowContainer(); + // Get the active page within the sashcontainer + return container == null ? null : container.getActiveSashWindowsPage(); + } + + /** + * + * @return + */ + private static ISashWindowsContainer getSashWindowContainer() { + + try { + return getServiceRegistryChecked().getService(ISashWindowsContainer.class); + } catch (ServiceException e) { + // The contract says that we return null if not found + return null; + } + } + + /** + * Gets the di resource set. + * + * @return Get the current {@link DiResourceSet} or null if not found. + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static DiResourceSet getDiResourceSet() { + try { + ServicesRegistry registry = getServiceRegistry(); + return registry == null ? null : registry.getService(DiResourceSet.class); + } catch (ServiceException e) { + Activator.log.error(e); + } + return null; + } + + /** + * Gets the {@link TransactionalEditingDomain} of the current active Eclipse + * Editor. This method should be used only when it is sure that the active + * editor exist, and that you want the EditingDomain of this editor.
+ * This method return null if the TransactionalEditingDomain can not be + * found.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * In any case, a check should be done on the returned value that can be + * null. An alternative is to use {@link #getTransactionalEditingDomainChecked()} and to catch the + * exception.
+ * It is preferable to use {@link #getTransactionalEditingDomain(ServicesRegistry)} whenever it is + * possible.
+ * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved + * with methods from + * org.eclipse.papyrus.uml.diagram.common.util.DiagramCoreServiceUtils
+ * 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 Get the current {@link TransactionalEditingDomain} or null if not + * found + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static TransactionalEditingDomain getTransactionalEditingDomain() { + try { + ServicesRegistry registry = getServiceRegistry(); + return registry == null ? null : registry.getService(TransactionalEditingDomain.class); + } catch (IllegalStateException e) { + // Registry can't be found, do nothing. + } catch (ServiceException e) { + Activator.log.error(e); + } + return null; + } + + /** + * Gets the {@link TransactionalEditingDomain} of the current active Eclipse + * Editor. This method should be used only when it is sure that the active + * editor exist, and that you want the EditingDomain of this editor.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * It is preferable to use {@link #getTransactionalEditingDomain(ServicesRegistry)} whenever it is + * possible.
+ * This method throw a {@link ServiceException} if the + * TransactionalEditingDomain can not be found.
+ * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved + * with methods from + * org.eclipse.papyrus.uml.diagram.common.util.DiagramCoreServiceUtils + * + * + * WARNING: This method throws an exception when no Active Editor is found. + * This happen during the editor initialization, especially when there is no + * other editor opened. + * + * @return Get the current {@link TransactionalEditingDomain} + * @throws ServiceException + * @throws ServiceNotFoundException + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static TransactionalEditingDomain getTransactionalEditingDomainChecked() throws ServiceException { + try { + ServicesRegistry registry = getServiceRegistryChecked(); + return registry.getService(TransactionalEditingDomain.class); + } catch (IllegalStateException e) { + throw new ServiceException(e); + } catch (Exception e) { + throw new ServiceException(e); + } + } + + /** + * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. + * + * @param servicesRegistry + * @return + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
+ */ + @Deprecated + public static TransactionalEditingDomain getTransactionalEditingDomain(ServicesRegistry registry) { + try { + return registry.getService(TransactionalEditingDomain.class); + } catch (IllegalStateException e) { + // Registry can't be found, do nothing. + } catch (ServiceException e) { + Activator.log.error(e); + } + return null; + } + + /** + * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. + * + * @param servicesRegistry + * @return + * @throws ServiceException + * If the TransactionalEditingDomain can not be found. + * @deprecated Check + * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments + * /cookbook/PapyrusCookBook.odt and use one of the replacement: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
+ */ + @Deprecated + public static TransactionalEditingDomain getTransactionalEditingDomainChecked(ServicesRegistry registry) throws ServiceException { + return registry.getService(TransactionalEditingDomain.class); + } + + /** + * Get the {@link ServicesRegistry}of the currently active eclipse editor.
+ * WARNING - This method doesn't work during the initialization of the main + * editor. See note in class doc.
+ * This method return null if the ServicesRegistry can not be found.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * 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.
+ * It is preferable to retrieve the ServiceRegistry from elsewhere whenever + * it is possible.
+ * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved + * with methods from + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF + * + *
+ * 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: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @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.
+ * 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: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + static public ServicesRegistry getServiceRegistryChecked() throws ServiceException { + // Lookup ServiceRegistry + IMultiDiagramEditor editor = getMultiDiagramEditor(); + if (editor == null) { + throw new ServiceException("Can't get ServiceRegistry"); //$NON-NLS-1$ + } + + return editor.getAdapter(ServicesRegistry.class); + } + + /** + * Get the ISashWindowsContentProvider of the active Eclipse Editor, if + * possible.
+ * This method return null if the ServiceRegistry can not be found or if an + * error occur.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * 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: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @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.
+ * This method return null if the ServiceRegistry can not be found or if an + * error occur.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * This method should not be used during the editor initialization phase.
+ * 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: + *
    + *
  • org.eclipse.papyrus.infra.core.utils.ServiceUtils
  • + *
  • + * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
  • + *
  • + * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)
  • + *
+ */ + @Deprecated + public static IPageManager getIPageMngr() { + + try { + return getServiceRegistryChecked().getService(IPageManager.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.
+ * 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.
+ * This method is designed to be used by ui actions that interact with the + * active editor.
+ * + * + * @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."); //$NON-NLS-1$ + } + + 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() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * Obtains the URI of the EMF resource identified by the given editor reference. + * + * @param editorRef + * an editor reference + * + * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined, + * including the case when the editor input could not be obtained from the reference + */ + public static URI getResourceURI(IEditorReference editorRef) { + try { + return getResourceURI(editorRef.getEditorInput()); + } catch (PartInitException e) { + Activator.log.error("Could not obtain editor input from editor reference.", e); //$NON-NLS-1$ + return null; + } + } + + /** + * Obtains the URI of the EMF resource edited by the given {@code editor}. + * + * @param editor + * an open editor + * + * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined, + * such as if the editor input could not be obtained from the editor + */ + public static URI getResourceURI(IEditorPart editor) { + return getResourceURI(editor.getEditorInput()); + } + + /** + * Obtains the URI of the EMF resource identified by the given editor input. + * + * @param editorInput + * an editor input + * + * @return the best-effort URI of the resource that it edits, or {@code null} if it could not be determined + */ + public static URI getResourceURI(IEditorInput editorInput) { + URI result = null; + + if (editorInput instanceof IFileEditorInput) { + result = URI.createPlatformResourceURI(((IFileEditorInput) editorInput).getFile().getFullPath().toString(), true); + } else if (editorInput instanceof URIEditorInput) { + result = ((URIEditorInput) editorInput).getURI(); + } else if (editorInput instanceof IURIEditorInput) { + result = URI.createURI(((IURIEditorInput) editorInput).getURI().toASCIIString(), true); + } else if (editorInput != null) { + // desperation + Object adapter = editorInput.getAdapter(URI.class); + if (adapter instanceof URI) { + result = (URI) adapter; + } + } + + return result; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ICallableWithProgress.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ICallableWithProgress.java new file mode 100644 index 00000000000..bfcafbe8284 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ICallableWithProgress.java @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2014 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.util; + +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.Callable; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.operation.IRunnableWithProgress; + +/** + * The {@link Callable} analogue of an {@link IRunnableWithProgress}. + */ +public interface ICallableWithProgress { + /** + * Invokes me in a runnable context with a progress monitor. + * + * @param monitor + * the progress monitor to use to display progress and receive + * requests for cancellation + * @exception InvocationTargetException + * if the run method must propagate a checked exception, + * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically + * wrapped in an InvocationTargetException by the calling context + * @exception InterruptedException + * if the operation detects a request to cancel, + * using IProgressMonitor.isCanceled(), it should exit by throwing InterruptedException + * + * @see UIUtil#call(IRunnableContext, ICallableWithProgress) + * @see IRunnableContext#run + */ + V call(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException; +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/LocalMemento.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/LocalMemento.java new file mode 100644 index 00000000000..309542ee425 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/LocalMemento.java @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.util; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.ui.IMemento; + + +/** + * Invocation handler for the dynamic local memento implementation. + */ +class LocalMemento implements InvocationHandler { + + private static final Class[] INTERFACES = { IMemento.class }; + + private static final Map delegates = createDelegates(); + + private final String type; + + private final String id; + + private final List children = new ArrayList(); + + private final Map attributes = new HashMap(); + + private String textData; + + LocalMemento(String type, String id) { + super(); + + this.type = type; + this.id = id; + } + + static IMemento createMemento(String type, String id) { + LocalMemento handler = new LocalMemento(type, id); + return (IMemento) Proxy.newProxyInstance(LocalMemento.class.getClassLoader(), INTERFACES, handler); + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Object result = null; + + Method implementation = delegates.get(method); + if (implementation == null) { + throw new UnsupportedOperationException("dynamic proxy handler does not understand " + method.getName()); //$NON-NLS-1$ + } else { + result = implementation.invoke(this, args); + } + + return result; + } + + @API + String getType() { + return type; + } + + @API + String getID() { + return id; + } + + @API + IMemento createChild(String type) { + return createChild(type, null); + } + + @API + IMemento createChild(String type, String id) { + IMemento result = createMemento(type, id); + children.add(result); + return result; + } + + @API + IMemento getChild(String type) { + IMemento result = null; + for (IMemento next : children) { + if (type.equals(next.getType())) { + result = next; + break; + } + } + return result; + } + + @API + IMemento[] getChildren() { + return children.toArray(new IMemento[children.size()]); + } + + @API + IMemento[] getChildren(String type) { + List result = new ArrayList(children.size()); + for (IMemento next : children) { + if (type.equals(next.getType())) { + result.add(next); + } + } + return result.toArray(new IMemento[result.size()]); + } + + @API + Float getFloat(String key) { + return coerce(attributes.get(key), Float.class); + } + + private T coerce(Object value, Class type) { + Object result; + + if (value == null) { + result = value; + } else if (type.isInstance(value)) { + result = value; + } else if (Number.class.isAssignableFrom(type) && (value instanceof Number)) { + Number number = (Number) value; + if (type == Integer.class) { + result = number.intValue(); + } else if (type == Float.class) { + result = number.floatValue(); + } else { + throw new IllegalArgumentException("unsupported numeric type: " + type.getSimpleName()); //$NON-NLS-1$ + } + } else if (Number.class.isAssignableFrom(type) && (value instanceof String)) { + String string = (String) value; + if (type == Integer.class) { + result = Integer.valueOf(string); + } else if (type == Float.class) { + result = Float.valueOf(string); + } else { + throw new IllegalArgumentException("unsupported numeric type: " + type.getSimpleName()); //$NON-NLS-1$ + } + } else if (type == Boolean.class) { + // We know the value isn't a Boolean, otherwise we would have handled it already + if (value instanceof String) { + result = Boolean.valueOf((String) value); + } else { + throw new IllegalArgumentException("unsupported boolean conversion from type: " + ((value == null) ? "null" : value.getClass().getSimpleName())); //$NON-NLS-1$ + } + } else if (type == String.class) { + result = String.valueOf(value); + } else { + throw new IllegalArgumentException("unsupported attribute type: " + type.getSimpleName()); //$NON-NLS-1$ + } + + return type.cast(result); + } + + @API + Integer getInteger(String key) { + return coerce(attributes.get(key), Integer.class); + } + + @API + String getString(String key) { + return coerce(attributes.get(key), String.class); + } + + @API + Boolean getBoolean(String key) { + return coerce(attributes.get(key), Boolean.class); + } + + @API + String getTextData() { + return textData; + } + + @API + String[] getAttributeKeys() { + return attributes.keySet().toArray(new String[attributes.size()]); + } + + @API + void putFloat(String key, float value) { + attributes.put(key, value); + } + + @API + void putInteger(String key, int value) { + attributes.put(key, value); + } + + @API + void putString(String key, String value) { + attributes.put(key, value); + } + + @API + void putBoolean(String key, boolean value) { + attributes.put(key, value); + } + + @API + void putTextData(String data) { + textData = data; + } + + private boolean isLocalMemento(IMemento memento) { + return (memento != null) && Proxy.isProxyClass(memento.getClass()) && ((Proxy.getInvocationHandler(memento) instanceof LocalMemento)); + } + + @API + void putMemento(IMemento memento) { + if (!isLocalMemento(memento)) { + throw new IllegalArgumentException("memento is not a local memento"); //$NON-NLS-1$ + } + children.add(memento); + } + + @Override + @API(owner = Object.class) + public String toString() { + StringBuilder result = new StringBuilder(); + + append(result, 0); + + return result.toString(); + } + + private void append(StringBuilder buf, int depth) { + // Indent + for (int i = 0; i < depth; i++) { + buf.append(" "); //$NON-NLS-1$ + } + + buf.append("LocalMemento(");//$NON-NLS-1$ + buf.append(type); + if (id != null) { + buf.append('[').append(id).append(']'); + } + buf.append(") ").append(attributes); //$NON-NLS-1$ + buf.append('\n'); + + final int nextDepth = depth + 1; + for (IMemento next : children) { + ((LocalMemento) Proxy.getInvocationHandler(next)).append(buf, nextDepth); + } + } + + private static Map createDelegates() { + Map result = new HashMap(); + + for (Method implementation : LocalMemento.class.getDeclaredMethods()) { + if (implementation.isAnnotationPresent(API.class)) { + try { + Method api = implementation.getAnnotation(API.class).owner().getMethod(implementation.getName(), implementation.getParameterTypes()); + result.put(api, implementation); + } catch (NoSuchMethodException e) { + throw new LinkageError("Incompatible IMemento API change: " + implementation.getName()); + } + } + } + + return result; + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + private @interface API { + + Class owner() default IMemento.class; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/PapyrusImageUtils.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/PapyrusImageUtils.java new file mode 100644 index 00000000000..ee0d9fb314f --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/PapyrusImageUtils.java @@ -0,0 +1,67 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import java.io.IOException; +import java.net.URL; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +/** + * Services to access to Papyrus images + * + * @author tristan faure + * + */ +public class PapyrusImageUtils { + + private static final String default_icon_32 = "/icons/papyrus/32x32/Papyrus_32x32_t.gif"; //$NON-NLS-1$ + + private static final String default_icon = "/icons/papyrus/Papyrus.gif"; //$NON-NLS-1$ + + /** + * get the default icon for Papyrus the image does not have to be disposed + * as it is registered in an ImageRegistry + * + * @return the Image + */ + public static Image getDefaultIcon() { + return getIcon(default_icon); + } + + /** + * get the default icon 32x32 for Papyrus the image does not have to be + * disposed as it is registered in an ImageRegistry + * + * @return the Image + */ + public static Image getDefaultIcon32() { + return getIcon(default_icon_32); + } + + private static Image getIcon(String path) { + String key = Activator.PLUGIN_ID + path; + Image result = JFaceResources.getImageRegistry().get(key); + if (result == null) { + URL url = Activator.getDefault().getBundle().getEntry(path); + try { + result = new Image(Display.getDefault(), url.openStream()); + JFaceResources.getImageRegistry().put(key, result); + } catch (IOException e) { + } + } + return result; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/SelectionHelper.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/SelectionHelper.java new file mode 100644 index 00000000000..c642bc534fe --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/SelectionHelper.java @@ -0,0 +1,119 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.util; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * @author VL222926 + * + */ +public class SelectionHelper { + + /** + * Constructor. + * + */ + private SelectionHelper() { + // to avoid instanciation + } + + /** + * + * @return + * the selection service or null if not found + * + */ + public static final ISelectionService getSelectionService() { + IWorkbench wb = PlatformUI.getWorkbench(); + if (wb != null) { + // don't work + // ISelectionService s1 = (ISelectionService) wb.getService(ISelectionService.class); + IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); + if (ww != null) { + return (ISelectionService) ww.getService(ISelectionService.class); + } + } + return null; + } + + /** + * + * @return + * the current selection or an empty selection. can't be null + */ + public static final ISelection getCurrentSelection() { + ISelectionService selectionService = getSelectionService(); + if (selectionService != null) { + ISelection currentSelection = selectionService.getSelection(); + if (currentSelection != null) { + return currentSelection; + } + } + return StructuredSelection.EMPTY; + } + + /** + * + * @param viewId + * the id of the view for which we want the selection + * @return + * the current selection for the view, the returned value can't be null + */ + public static final ISelection getCurrentSelection(String viewId) { + ISelectionService selectionService = getSelectionService(); + if (selectionService != null) { + ISelection currentSelection = selectionService.getSelection(viewId); + if (currentSelection != null) { + return currentSelection; + } + } + return StructuredSelection.EMPTY; + } + + /** + * + * @return + * a structured selection. + * the returned value can't be null + */ + public static final IStructuredSelection getCurrentStructuredSelection() { + ISelection selection = getCurrentSelection(); + if (selection instanceof IStructuredSelection) { + return (IStructuredSelection) selection; + } + return StructuredSelection.EMPTY; + } + + /** + * + * @param viewId + * the id of the view for which we want the selection + * @return + * the current selection for the view, the returned value can't be null + */ + public static final IStructuredSelection getCurrentStructuredSelection(String viewId) { + ISelection selection = getCurrentSelection(viewId); + if (selection instanceof IStructuredSelection) { + return (IStructuredSelection) selection; + } + return StructuredSelection.EMPTY; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForActionHandlers.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForActionHandlers.java new file mode 100644 index 00000000000..917a41e8688 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForActionHandlers.java @@ -0,0 +1,149 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.util; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; +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.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.ui.IEditorPart; + +/** + * Set of utility methods for accessing core Services. This class provide + * methods to access the Papyrus well known services. This class is designed to + * be used from ui Action Handlers or from any code relying on the Eclipse + * Active Editor.
+ * All methods from this class rely on the Eclipse Active Editor, which should + * be an instance of {@link IMultiDiagramEditor}. If this is not the case, + * methods throw an exception {@link ServiceException}. + * + * @author cedric dumoulin + * + * @deprecated 0.10: Use org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers instead + */ +@Deprecated +public class ServiceUtilsForActionHandlers extends AbstractServiceUtils { + + private ServiceUtilsForActionHandlers() { + // Singleton + } + + private final static ServiceUtilsForActionHandlers instance = new ServiceUtilsForActionHandlers(); + + /** + * Get the singleton instance of the class. + * + * @return + */ + public static final ServiceUtilsForActionHandlers getInstance() { + return instance; + } + + @Override + public ServicesRegistry getServiceRegistry(Void from) throws ServiceException { + return getServiceRegistry(); + } + + /** + * Get the service registry from the specified parameter. + * + * @param from + * @return + */ + public ServicesRegistry getServiceRegistry() throws ServiceException { + ServicesRegistry serviceRegistry = getContextualServiceRegistry(); + if (serviceRegistry != null) { + return serviceRegistry; + } + + // Not found + throw new ServiceNotFoundException("Can't get the ServiceRegistry from current Eclipse Active Editor"); //$NON-NLS-1$ + } + + /** + * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}. + * + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public TransactionalEditingDomain getTransactionalEditingDomain() throws ServiceException { + return getServiceRegistry().getService(TransactionalEditingDomain.class); + } + + /** + * Gets the {@link IPageManager} registered in the {@link ServicesRegistry}. + * + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public IPageManager getIPageManager() throws ServiceException { + return getServiceRegistry().getService(IPageManager.class); + } + + /** + * Gets the {@link IPageMngr} registered in the {@link ServicesRegistry}. + * + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public ModelSet getModelSet() throws ServiceException { + return getServiceRegistry().getService(ModelSet.class); + } + + /** + * Gets the {@link ILifeCycleEventsProvider} registered in the {@link ServicesRegistry}. + * + * @param from + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public ILifeCycleEventsProvider getILifeCycleEventsProvider() throws ServiceException { + return getServiceRegistry().getService(ILifeCycleEventsProvider.class); + } + + /** + * Gets the {@link ISashWindowsContainer} registered in the {@link ServicesRegistry}. + * + * @param from + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public ISashWindowsContainer getISashWindowsContainer() throws ServiceException { + return getServiceRegistry().getService(ISashWindowsContainer.class); + } + + /** + * Gets the {@link IEditorPart} of the currently nested active editor. + * + * @param from + * @return + * @throws ServiceException + * If an error occurs while getting the requested service. + */ + public IEditorPart getNestedActiveIEditorPart() throws ServiceException { + return getISashWindowsContainer().getActiveEditor(); + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForWorkbenchPage.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForWorkbenchPage.java new file mode 100644 index 00000000000..624257964cc --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/ServiceUtilsForWorkbenchPage.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * 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.ui.util; + +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.papyrus.infra.core.utils.AbstractServiceUtils; +import org.eclipse.ui.IWorkbenchPage; + +/** + * A ServiceUtils implementation for manipulating the Papyrus services from an IWorkbenchPage + * + * @author Camille Letavernier + * + */ +public class ServiceUtilsForWorkbenchPage extends AbstractServiceUtils { + + @Override + public ServicesRegistry getServiceRegistry(IWorkbenchPage from) throws ServiceException { + IAdaptable adaptable = null; + if (from instanceof IAdaptable) { + adaptable = (IAdaptable) from; + } else if (from != null) { + // 421392: [Model Explorer] Link with Editor does not work properly + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=421392 + + // Since Eclipse 4.4, the concrete WorkbenchPage is not IAdaptable anymore. + // Try the ActivePart + adaptable = from.getActivePart(); + } + + if (adaptable != null) { + ServicesRegistry registry = (ServicesRegistry) adaptable.getAdapter(ServicesRegistry.class); + if (registry != null) { + return registry; + } + } + + + throw new ServiceException("Cannot resolve the ServiceRegistry from the IWorkbenchPage. Page: " + from); //$NON-NLS-1$ + } + + public static ServiceUtilsForWorkbenchPage getInstance() { + return instance; + } + + private static ServiceUtilsForWorkbenchPage instance = new ServiceUtilsForWorkbenchPage(); + + private ServiceUtilsForWorkbenchPage() { + // Singleton + } + +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/TransactionUIHelper.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/TransactionUIHelper.java new file mode 100644 index 00000000000..825a99386a3 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/TransactionUIHelper.java @@ -0,0 +1,81 @@ +/***************************************************************************** + * Copyright (c) 2014, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 465416 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.emf.common.util.WrappedException; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.jface.operation.IRunnableWithProgress; + + +/** + * Helper utilities for working with transactions on the UI thread. + */ +public class TransactionUIHelper { + + /** + * Create a privileged runnable with progress, which is like a regular {@linkplain TransactionalEditingDomain#createPrivilegedRunnable(Runnable) + * privileged runnable} except that it is given a progress monitor for progress reporting. + * This enables execution of monitored runnables on the modal-context thread using the transaction borrowed from the UI thread. + * + * @param domain + * an editing domain + * @param runnable + * a runnable with progress that is to borrow the {@code domain}'s active transaction on the modal context thread + * @return the privileged runnable, ready to pass into the progress service or other such API + */ + public static IRunnableWithProgress createPrivilegedRunnableWithProgress(TransactionalEditingDomain domain, final IRunnableWithProgress runnable) { + final IProgressMonitor monitorHolder[] = { null }; + + final Runnable privileged = domain.createPrivilegedRunnable(new Runnable() { + + @Override + public void run() { + try { + runnable.run(monitorHolder[0]); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new WrappedException(e); + } + } + }); + + return new IRunnableWithProgress() { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitorHolder[0] = monitor; + + try { + privileged.run(); + } catch (OperationCanceledException e) { + throw new InterruptedException(e.getLocalizedMessage()); + } catch (WrappedException e) { + Exception unwrapped = e.exception(); + if (unwrapped instanceof InvocationTargetException) { + throw (InvocationTargetException) unwrapped; + } else if (unwrapped instanceof InterruptedException) { + throw (InterruptedException) unwrapped; + } else { + throw e; + } + } + } + }; + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/UIUtil.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/UIUtil.java new file mode 100644 index 00000000000..1dd62db4ff5 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/UIUtil.java @@ -0,0 +1,517 @@ +/* + * Copyright (c) 2014, 2016 CEA, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * Christian W. Damus - bug 399859 + * Christian W. Damus - bug 451557 + * Christian W. Damus - bug 485220 + * + */ +package org.eclipse.papyrus.infra.ui.util; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.AbstractExecutorService; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import org.eclipse.core.databinding.observable.Realm; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.AbstractTreeIterator; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.papyrus.infra.tools.util.IExecutorService; +import org.eclipse.papyrus.infra.tools.util.Iterators2; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IMemento; + +import com.google.common.collect.Iterators; + + +/** + * Miscellaneous general-purpose UI utilities. + */ +public class UIUtil { + + /** + * Not instantiable by clients. + */ + private UIUtil() { + super(); + } + + /** + * Create an executor that runs tasks asynchronously on the UI thread. If you need synchronous execution, schedule {@link Future}s and {@linkplain Future#get() wait} for them. + * + * @param display + * the display on which thread to execute tasks + * + * @return the executor + */ + public static IExecutorService createUIExecutor(Display display) { + return new DisplayExecutorService(display); + } + + /** + * Create an executor that runs tasks asynchronously on an observable {@link Realm}. If you need synchronous execution, schedule {@link Future}s and {@linkplain Future#get() wait} for them. + * + * @param realm + * the observable realm on which thread to execute tasks + * + * @return the executor + */ + public static ExecutorService createObservableExecutor(Realm realm) { + return new RealmExecutorService(realm); + } + + /** + * Creates a local memento that is not persistable and is not based on an XML document. This is useful for capturing the + * state of UI elements locally in cases where persistence of the memento is not required. + * + * @return the memento + */ + public static IMemento createLocalMemento() { + return LocalMemento.createMemento("__anonymous__", null); //$NON-NLS-1$ + } + + /** + * Synchronously invokes a {@code callable} on the given {@code display}'s thread. + * + * @param display + * a display + * @param callable + * a callable to invoke + * @return the callable's result (which, because this method is synchronous, will be ready) + * + * @see #asyncCall(Display, Callable) + * @see #createUIExecutor(Display) + */ + public static Future syncCall(Display display, Callable callable) { + final FutureTask result = new FutureTask(callable); + display.syncExec(result); + return result; + } + + /** + * Synchronously invokes a {@code callable} on the default display thread. + * + * @param callable + * a callable to invoke + * @return the callable's result (which, because this method is synchronous, will be ready) + * + * @see #syncCall(Display, Callable) + * @see #asyncCall(Callable) + * @see #createUIExecutor(Display) + */ + public static Future syncCall(Callable callable) { + return syncCall(Display.getDefault(), callable); + } + + /** + * Asynchronously invokes a {@code callable} on the given {@code display}'s thread. + * + * @param display + * a display + * @param callable + * a callable to invoke + * @return the callable's result + * + * @see #syncCall(Display, Callable) + * @see #createUIExecutor(Display) + */ + public static Future asyncCall(Display display, Callable callable) { + final FutureTask result = new FutureTask(callable); + display.asyncExec(result); + return result; + } + + /** + * Asynchronously invokes a {@code callable} on the default display thread. + * + * @param callable + * a callable to invoke + * @return the callable's result + * + * @see #asyncCall(Display, Callable) + * @see #syncCall(Callable) + * @see #createUIExecutor(Display) + */ + public static Future asyncCall(Callable callable) { + return asyncCall(Display.getDefault(), callable); + } + + /** + * Calls a {@code callable} in the given {@code context}. + * + * @param fork + * {@code true} if the runnable should be run in a separate thread, + * and {@code false} to run in the same thread + * @param cancelable + * {@code true} to enable the cancellation, and {@code false} to make the operation uncancellable + * @param runnable + * the runnable to run + * + * @exception InvocationTargetException + * wraps any exception or error which occurs + * while running the runnable + * @exception InterruptedException + * propagated by the context if the runnable + * acknowledges cancellation by throwing this exception. This should not be thrown + * if {@code cancelable} is {@code false}. + */ + public static V call(IRunnableContext context, boolean fork, boolean cancelable, ICallableWithProgress callable) throws InvocationTargetException, InterruptedException { + class RunnableWrapper implements IRunnableWithProgress { + final ICallableWithProgress delegate; + + V result; + + RunnableWrapper(ICallableWithProgress delegate) { + this.delegate = delegate; + } + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + result = delegate.call(monitor); + } + } + + RunnableWrapper wrapper = new RunnableWrapper(callable); + context.run(fork, cancelable, wrapper); + return wrapper.result; + } + + /** + * Obtains a simple executor that asynchronously executes at most one task on the default + * display thread. While any task is still pending execution on this executor, + * all others are silently discarded. This is useful for cases where, for example, UI + * refreshes are posted repeatedly from independent events that aren't aware of each other + * but where each refresh task would repeat the same work. + * + * @param display + * a display on which thread to execute tasks + * + * @return the executor + * + * @see #createAsyncOnceExecutor(Display) + */ + public static Executor createAsyncOnceExecutor() { + return createAsyncOnceExecutor(Display.getDefault()); + } + + /** + * Obtains a simple executor that asynchronously executes at most one task on the given {@code display}'s thread. While any task is still pending execution on this executor, + * all others are silently discarded. This is useful for cases where, for example, UI + * refreshes are posted repeatedly from independent events that aren't aware of each other + * but where each refresh task would repeat the same work. + * + * @param display + * a display on which thread to execute tasks + * + * @return the executor + */ + public static Executor createAsyncOnceExecutor(final Display display) { + return new Executor() { + private final AtomicBoolean pending = new AtomicBoolean(); + + @Override + public void execute(final Runnable task) { + if (pending.compareAndSet(false, true)) { + display.asyncExec(new Runnable() { + + @Override + public void run() { + pending.set(false); + task.run(); + } + }); + } + } + }; + } + + /** + * Obtains a tree iterator over all of the controls contained within a given {@code root} control, not including that {@code root}. + * + * @param root + * a control to iterate + * @return an unmodifiable iterator over all of its nested controls, which naturally will be empty if the {@code root} is not a {@link Composite} + */ + public static TreeIterator allChildren(Control root) { + return new AbstractTreeIterator(root, false) { + private static final long serialVersionUID = 1L; + + @Override + protected Iterator getChildren(Object object) { + return (object instanceof Composite) ? Iterators.forArray(((Composite) object).getChildren()) : Iterators. emptyIterator(); + } + }; + } + + /** + * Obtains a tree iterator over all of the controls of a particular type contained within a given {@code root} control, not including that {@code root}. + * + * @param root + * a control to iterate + * @param type + * the type of children to include in the iteration + * + * @return an unmodifiable iterator over all of its nested controls, which naturally will be empty if the {@code root} is not a {@link Composite} + */ + public static TreeIterator allChildren(Control root, final Class type) { + return Iterators2.filter(allChildren(root), type); + } + + // + // Nested types + // + + private static abstract class UIExecutorService extends AbstractExecutorService implements IExecutorService { + + private final Lock lock = new ReentrantLock(); + + private final Condition emptyCond = lock.newCondition(); + + private final Queue pending = new LinkedList(); + + private volatile boolean shutdown; + + UIExecutorService() { + super(); + } + + @Override + public void execute(Runnable command) { + if (isShutdown()) { + throw new RejectedExecutionException("Executor service is shut down"); //$NON-NLS-1$ + } + + asyncExec(enqueue(command)); + } + + @Override + public V syncCall(Callable callable) throws InterruptedException, ExecutionException { + class SyncResult implements Runnable { + V result; + ExecutionException fail; + + @Override + public void run() { + try { + result = callable.call(); + } catch (Exception e) { + fail = new ExecutionException(e); + fail.fillInStackTrace(); + } + } + } + + SyncResult result = new SyncResult(); + + syncExec(result); + + if (result.fail != null) { + throw result.fail; + } + + return result.result; + } + + abstract void asyncExec(Runnable runnable); + + @Override + public List shutdownNow() { + List result = new ArrayList(); + + shutdown(); + + for (Runnable dequeued = dequeue(); dequeued != null; dequeued = dequeue()) { + result.add(dequeued); + } + + return result; + } + + private RunnableWrapper enqueue(Runnable task) { + RunnableWrapper result = new RunnableWrapper(task); + + lock.lock(); + try { + boolean wasEmpty = pending.isEmpty(); + pending.offer(result); + if (wasEmpty) { + // Now not empty + emptyCond.signalAll(); + } + } finally { + lock.unlock(); + } + + return result; + } + + private RunnableWrapper dequeue() { + RunnableWrapper result = null; + + lock.lock(); + try { + result = pending.poll(); + if (result == null) { + // Now empty + emptyCond.signalAll(); + } + } finally { + lock.unlock(); + } + + return result; + } + + boolean dequeue(RunnableWrapper task) { + boolean result = false; + + lock.lock(); + try { + result = pending.remove(task); + if (result && pending.isEmpty()) { + // Now empty + emptyCond.signalAll(); + } + } finally { + lock.unlock(); + } + + return result; + } + + @Override + public void shutdown() { + shutdown = true; + } + + @Override + public boolean isTerminated() { + lock.lock(); + try { + return isShutdown() && pending.isEmpty(); + } finally { + lock.unlock(); + } + } + + @Override + public boolean isShutdown() { + return shutdown; + } + + @Override + public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { + if (timeout < 0L) { + throw new IllegalArgumentException("negative timeout"); //$NON-NLS-1$ + } + + final Date deadline = (timeout == 0L) ? null : new Date(System.currentTimeMillis() + unit.toMillis(timeout)); + boolean result = false; + + lock.lock(); + try { + boolean stillWaiting = true; + for (result = isTerminated(); !result && stillWaiting; result = isTerminated()) { + if (deadline == null) { + emptyCond.await(); + } else { + stillWaiting = emptyCond.awaitUntil(deadline); + } + } + } finally { + lock.unlock(); + } + + return result; + } + + // + // Nested types + // + + private class RunnableWrapper implements Runnable { + + private final Runnable delegate; + + RunnableWrapper(Runnable delegate) { + this.delegate = delegate; + } + + @Override + public void run() { + // Don't run if I was cancelled by shutdown + if (dequeue(this)) { + delegate.run(); + } + } + } + }; + + private static class DisplayExecutorService extends UIExecutorService { + private final Display display; + + DisplayExecutorService(Display display) { + super(); + + this.display = display; + } + + @Override + void asyncExec(Runnable runnable) { + display.asyncExec(runnable); + } + + @Override + public void syncExec(Runnable task) { + display.syncExec(task); + } + } + + private static class RealmExecutorService extends UIExecutorService { + private final Realm realm; + + RealmExecutorService(Realm realm) { + super(); + + this.realm = realm; + } + + @Override + void asyncExec(Runnable runnable) { + realm.asyncExec(runnable); + } + + @Override + public void syncExec(Runnable task) { + realm.exec(task); + } + } +} diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java new file mode 100644 index 00000000000..c94256dd8f5 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * 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: + * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.util; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * + * a helper for the Eclipse workbench part + * + */ +public class WorkbenchPartHelper { + + private WorkbenchPartHelper() { + // nothing to do + } + + /** + * + * @return + * the current IWorkbenchPart or null if not found + */ + public static final IWorkbenchPart getCurrentActiveWorkbenchPart() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); + if (activeWorkbench != null) { + final IWorkbenchPage activePage = activeWorkbench.getActivePage(); + if (activePage != null) { + return activePage.getActivePart(); + } + } + } + return null; + } + + /** + * + * @return + * the current IEditorPart or null if not found + */ + public static final IEditorPart getCurrentActiveEditorPart() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow(); + if (activeWorkbench != null) { + final IWorkbenchPage activePage = activeWorkbench.getActivePage(); + if (activePage != null) { + return activePage.getActiveEditor(); + } + } + } + return null; + } +} diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/META-INF/MANIFEST.MF index ce545700a3b..ccc8e7e1367 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/META-INF/MANIFEST.MF @@ -10,15 +10,14 @@ Require-Bundle: org.eclipse.emf.edit.ui, org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.equinox.registry, - org.eclipse.emf.workspace, - org.eclipse.gmf.runtime.common.core, - org.eclipse.gmf.runtime.emf.commands.core, org.eclipse.gmf.runtime.emf.type.core, org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor.di;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/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/plugin.xml index 38292af0361..21a1aaee0c4 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/plugin.xml +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/plugin.xml @@ -26,7 +26,7 @@ priority="9" startKind="startup"> + serviceKeyRef="org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider"> diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/LoadDiagramCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/LoadDiagramCommand.java index b39ffad2732..4c7b74f71f9 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/LoadDiagramCommand.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/LoadDiagramCommand.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST and others. + * Copyright (c) 2014, 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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -17,7 +18,7 @@ import java.util.List; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource; @@ -57,7 +58,7 @@ public class LoadDiagramCommand implements Runnable { public LoadDiagramCommand(Resource resource) { try { - pageManager = ServiceUtilsForResource.getInstance().getIPageManager(resource); + pageManager = ServiceUtilsForResource.getInstance().getService(IPageManager.class, resource); } catch (ServiceException e) { // nothing to do } diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/LoadResourceSnippet.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/LoadResourceSnippet.java index 7f5287822e9..5d59edf742f 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/LoadResourceSnippet.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/LoadResourceSnippet.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST and others. + * Copyright (c) 2014, 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: * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -20,8 +21,7 @@ import org.eclipse.emf.transaction.RollbackException; import org.eclipse.papyrus.infra.core.resource.IModelSetSnippet; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ResourceAdapter; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper; +import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.services.controlmode.commands.LoadDiagramCommand; diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/UncontrolModeSaveListener.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/UncontrolModeSaveListener.java index fe057ddc229..0855d6dca5f 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/UncontrolModeSaveListener.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/listener/UncontrolModeSaveListener.java @@ -18,13 +18,13 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.transaction.RollbackException; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.services.controlmode.ControlModePlugin; import org.eclipse.papyrus.infra.services.controlmode.service.IUncontrolledObjectsProvider; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; /** @@ -58,7 +58,7 @@ public class UncontrolModeSaveListener implements ISaveEventListener { * * @param event * the event - * @see org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener#doSaveAs(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent) + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener#doSaveAs(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent) */ public void doSaveAs(DoSaveEvent event) { doSave(event); @@ -69,7 +69,7 @@ public class UncontrolModeSaveListener implements ISaveEventListener { * * @param event * the event - * @see org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener#doSave(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent) + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener#doSave(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent) */ public void doSave(DoSaveEvent event) { diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/service/ControlModeService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/service/ControlModeService.java index 2027c42cba2..89f48ab34c9 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/service/ControlModeService.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/service/ControlModeService.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST and others. + * Copyright (c) 2014, 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,18 +8,19 @@ * * Contributors: * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.services.controlmode.service; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; import org.eclipse.papyrus.infra.core.services.IService; 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.services.controlmode.listener.UncontrolModeSaveListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ILifeCycleEventsProvider; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; /** * Service to registry SaveListener for Uncontrol. @@ -56,7 +57,7 @@ public class ControlModeService implements IService { */ public void init(ServicesRegistry servicesRegistry) throws ServiceException { - lifeCycleEventsProvider = ServiceUtils.getInstance().getILifeCycleEventsProvider(servicesRegistry); + lifeCycleEventsProvider = ServiceUtils.getInstance().getService(ILifeCycleEventsProvider.class, servicesRegistry); uncontrolledObjectsProvider = ServiceUtils.getInstance().getService(IUncontrolledObjectsProvider.class, servicesRegistry); diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/OptionalMessageDialog.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/OptionalMessageDialog.java index d44e0f786e3..3f36fd63072 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/OptionalMessageDialog.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/OptionalMessageDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation, 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,13 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Christian W. Damus - bug 485220 *******************************************************************************/ package org.eclipse.papyrus.infra.services.controlmode.ui; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.infra.core.Activator; +import org.eclipse.papyrus.infra.services.controlmode.ControlModePlugin; import org.eclipse.papyrus.infra.services.controlmode.messages.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -111,10 +112,10 @@ public class OptionalMessageDialog extends MessageDialog { * @return the settings to be used */ private static IDialogSettings getDialogSettings() { - IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings settings = ControlModePlugin.getDefault().getDialogSettings(); settings = settings.getSection(STORE_ID); if (settings == null) { - settings = Activator.getDefault().getDialogSettings().addNewSection(STORE_ID); + settings = ControlModePlugin.getDefault().getDialogSettings().addNewSection(STORE_ID); } return settings; } @@ -139,7 +140,7 @@ public class OptionalMessageDialog extends MessageDialog { * Clears all remembered information about hidden dialogs */ public static void clearAllRememberedStates() { - IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings settings = ControlModePlugin.getDefault().getDialogSettings(); settings.addNewSection(STORE_ID); } } diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/META-INF/MANIFEST.MF index 78ab51e991f..13e90b26c28 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", - org.eclipse.jface + org.eclipse.jface, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/src/org/eclipse/papyrus/infra/services/navigation/provider/impl/ActiveEditorNavigationTargetProvider.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/src/org/eclipse/papyrus/infra/services/navigation/provider/impl/ActiveEditorNavigationTargetProvider.java index 837ce51f8be..01aa8a27373 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/src/org/eclipse/papyrus/infra/services/navigation/provider/impl/ActiveEditorNavigationTargetProvider.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.navigation/src/org/eclipse/papyrus/infra/services/navigation/provider/impl/ActiveEditorNavigationTargetProvider.java @@ -13,10 +13,10 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.services.navigation.provider.impl; -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.services.navigation.provider.NavigationTargetProvider; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement; import org.eclipse.papyrus.infra.widgets.util.NavigationTarget; import org.eclipse.papyrus.infra.widgets.util.RevealSemanticElementWrapper; diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/META-INF/MANIFEST.MF index 9bb19169d4e..61829247955 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/META-INF/MANIFEST.MF @@ -9,7 +9,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.emf.transaction;bundle-version="1.4.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/OpenElementService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/OpenElementService.java index 7c2b5000a27..00e19b6c125 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/OpenElementService.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/OpenElementService.java @@ -12,9 +12,9 @@ package org.eclipse.papyrus.infra.services.openelement.service; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.services.IService; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.ui.PartInitException; /** diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/impl/OpenElementServiceImpl.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/impl/OpenElementServiceImpl.java index f1579e31a0f..94505d40048 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/impl/OpenElementServiceImpl.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/impl/OpenElementServiceImpl.java @@ -29,18 +29,18 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IPapyrusPageInput; -import org.eclipse.papyrus.infra.core.editor.PapyrusPageInput; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.services.navigation.service.NavigationService; import org.eclipse.papyrus.infra.services.openelement.Activator; import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IPapyrusPageInput; +import org.eclipse.papyrus.infra.ui.editor.PapyrusPageInput; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IWorkbenchPage; 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 9795e217a31..4d0609a636d 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 @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.core.resources;bundle-version="3.8.0", org.eclipse.emf.common.ui;bundle-version="2.7.0", - org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0", + org.eclipse.emf.common;bundle-version="2.12.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/META-INF/MANIFEST.MF index b55fc457e2c..d21ae07957e 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/META-INF/MANIFEST.MF @@ -13,11 +13,13 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.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.sasheditor.di;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0", org.eclipse.ui.ide;bundle-version="3.8.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.2.0" + org.eclipse.papyrus.infra.emf;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/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/plugin.xml index 88f75898483..a98ea1234d0 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/plugin.xml +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/plugin.xml @@ -39,7 +39,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorFactory.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorFactory.java index 7f33cf92a82..0c4f87fc896 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorFactory.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorFactory.java @@ -4,10 +4,10 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.EditorDescriptor; -import org.eclipse.papyrus.infra.core.extension.diagrameditor.IPluggableEditorFactory; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; 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; public class UnloadResourcesEditorFactory implements IPluggableEditorFactory { diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java index 77c2aa65b9e..94f12c8d020 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java @@ -26,11 +26,11 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.services.resourceloading.ILoadingStrategy; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification; import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable; import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java index d74bc11d2dd..4944ada0793 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java @@ -38,15 +38,15 @@ import org.eclipse.gef.util.EditPartUtilities; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; import org.eclipse.papyrus.infra.services.resourceloading.Activator; import org.eclipse.papyrus.infra.services.resourceloading.Messages; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.TransactionUIHelper; import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder; import org.eclipse.papyrus.uml.tools.model.UmlModel; @@ -268,7 +268,7 @@ public class LoadingUtils { Diagram diag = ((Diagram) eobject); if (pageMngr.isOpen(diag)) { - IDiagramGraphicalViewer graphicalViewer = (IDiagramGraphicalViewer) core.getAdapter(IDiagramGraphicalViewer.class); + IDiagramGraphicalViewer graphicalViewer = core.getAdapter(IDiagramGraphicalViewer.class); if (graphicalViewer == null) { continue; } @@ -308,11 +308,11 @@ public class LoadingUtils { } static void runInEditingDomain(TransactionalEditingDomain domain, IEditorPart editorContext, IRunnableWithProgress operation) { - final IWorkbenchSiteProgressService progress = (IWorkbenchSiteProgressService) editorContext.getSite().getService(IWorkbenchSiteProgressService.class); + final IWorkbenchSiteProgressService progress = editorContext.getSite().getService(IWorkbenchSiteProgressService.class); try { progress.incrementBusy(); - progress.busyCursorWhile(TransactionHelper.createPrivilegedRunnableWithProgress(domain, operation)); + progress.busyCursorWhile(TransactionUIHelper.createPrivilegedRunnableWithProgress(domain, operation)); } catch (InterruptedException e) { Activator.log.error(e); } catch (InvocationTargetException e) { @@ -329,6 +329,7 @@ public class LoadingUtils { * @see #getExtensions(ModelSet) */ private static final Set COMMON_EXTENSIONS = new HashSet(); + static { COMMON_EXTENSIONS.add(UmlModel.UML_FILE_EXTENSION); COMMON_EXTENSIONS.add(NotationModel.NOTATION_FILE_EXTENSION); diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF index 6de36ac057f..d89c4ab7b87 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.markerlistener;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.markerlistener;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %pluginProvider Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/preferences/PreferencePage.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/preferences/PreferencePage.java index 84251fa911c..cfea834cf2a 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/preferences/PreferencePage.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/preferences/PreferencePage.java @@ -17,13 +17,13 @@ import org.eclipse.emf.common.notify.impl.NotificationImpl; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; 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.services.validation.Activator; import org.eclipse.papyrus.infra.services.validation.Messages; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF index 190f1c7b4a8..d97f48dfce7 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF @@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, org.eclipse.ui.forms;bundle-version="3.5.100", org.eclipse.draw2d;bundle-version="3.8.1", - org.eclipse.papyrus.infra.core;bundle-version="1.2.0" + org.eclipse.papyrus.infra.core;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/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java index 18d877382de..37e917f3ce6 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.LocalResourceManager; import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.core.utils.PapyrusImageUtils; +import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils; import org.eclipse.papyrus.infra.widgets.toolbox.SwtUtil; import org.eclipse.papyrus.infra.widgets.toolbox.SwtUtil.FadeJob; import org.eclipse.swt.SWT; diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java index 18ff17da2b5..93aa5e399b0 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java @@ -18,7 +18,7 @@ import java.util.Map; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.infra.core.utils.PapyrusImageUtils; +import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils; import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator; import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification; import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable; diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java index e8e7d9e0141..a6d5a7d99fb 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java @@ -20,7 +20,7 @@ import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; -import org.eclipse.papyrus.infra.core.utils.PapyrusImageUtils; +import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils; import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICallBack; import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator; import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable; diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF index 49839ec41ee..a92502791bf 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, com.ibm.icu;bundle-version="4.4.2", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", - org.eclipse.jface.text;bundle-version="3.10.0" + org.eclipse.jface.text;bundle-version="3.10.0", + org.eclipse.emf.edit;bundle-version="2.12.0" Export-Package: org.eclipse.papyrus.infra.widgets, org.eclipse.papyrus.infra.widgets.creation, org.eclipse.papyrus.infra.widgets.databinding, diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF index 56fe2ff5001..e24f1e25465 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF @@ -45,12 +45,12 @@ Require-Bundle: org.eclipse.ui, org.eclipse.uml2.uml;bundle-version="4.0.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0", - org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0" + org.eclipse.papyrus.infra.extendedtypes;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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml index 9a82f0eeb78..feadd47335a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml @@ -10,7 +10,7 @@ - + - + diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF index 555bf2e024d..15f243eed30 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF @@ -42,13 +42,13 @@ Require-Bundle: org.eclipse.ui, org.eclipse.uml2.uml;bundle-version="4.0.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0", - org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0" + org.eclipse.papyrus.infra.extendedtypes;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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml index bf649166ca2..e249da1e89b 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml @@ -10,7 +10,7 @@ - + diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/part/InternalBlockDiagramEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/part/InternalBlockDiagramEditor.java index 3cacdc1fb72..e497248cd40 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/part/InternalBlockDiagramEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/part/InternalBlockDiagramEditor.java @@ -41,10 +41,10 @@ import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.papyrus.commands.util.OperationHistoryDirtyState; import org.eclipse.papyrus.gmf.diagram.common.compatibility.IDiagramVersionUpdater; -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.sysml.diagram.internalblock.Activator; import org.eclipse.papyrus.sysml.diagram.internalblock.compatibility.DiagramVersionUpdater; import org.eclipse.papyrus.sysml.diagram.internalblock.factory.InternalBlockDiagramViewFactory; diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramCondition.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramCondition.java index 276607b58d1..a8a6c943e07 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramCondition.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramCondition.java @@ -14,7 +14,7 @@ package org.eclipse.papyrus.sysml.diagram.internalblock; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence; +import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence; /** * InternalBlockDiagramCondition to set conditions for the diagram creation diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF index 218ab53c54d..0540f382812 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF @@ -41,8 +41,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.uml2.uml;bundle-version="4.0.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.2.0", org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0", org.eclipse.papyrus.sysml.diagram.common;bundle-version="1.2.0", @@ -51,7 +50,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.databinding.observable;bundle-version="1.4.1", org.eclipse.papyrus.views.properties.model;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", - org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0" + org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml index 210861cce0d..f6263dbe6a3 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml @@ -21,7 +21,7 @@ - + - + + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - 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 getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof org.eclipse.uml2.uml.Package) { List nestedPackages = ((org.eclipse.uml2.uml.Package) fromElement).getNestedPackages(); List pages = new ArrayList(); - + 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 viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestedPackage, true, false); pages.addAll(viewerSearchResults); } } - + for (Object page : pages) { - + if (page instanceof Diagram && ((Diagram) page).getType().equals(ModelEditPart.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.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java index bd6648763df..93385ea1499 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/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) - 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 getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof org.eclipse.uml2.uml.Package) { org.eclipse.uml2.uml.Package nestingPackage = ((org.eclipse.uml2.uml.Package) fromElement).getNestingPackage(); List pages = new ArrayList(); - + if (nestingPackage != null) { ViewerSearchService viewerSearchService = null; try { @@ -76,19 +79,19 @@ public class NestingPackageHyperlinkContributor implements HyperlinkContributor } } } - + if (viewerSearchService != null) { List viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestingPackage, true, false); pages.addAll(viewerSearchResults); } } - + for (Object page : pages) { if (page instanceof Diagram && ((Diagram) page).getType().equals(ModelEditPart.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.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/ClassDiagramContributionPolicyClass.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/ClassDiagramContributionPolicyClass.java index 552dfd6cb9f..c9843902f07 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/ClassDiagramContributionPolicyClass.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/ClassDiagramContributionPolicyClass.java @@ -18,7 +18,7 @@ import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.IPopup import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml index 96e096471d4..8ae9da86384 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml @@ -273,7 +273,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> @@ -214,7 +214,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -20,13 +21,13 @@ import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; 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; import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.hyperlink.Activator; -import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject; import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor; @@ -49,14 +50,15 @@ public class DirectedRelationshipSourceHyperlinkContributor implements Hyperlink * @param fromElement * @return */ + @Override public List getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof Element) { List relationships = ((Element) fromElement).getTargetDirectedRelationships(); - + List objectsInViews = new ArrayList(); - + for (DirectedRelationship relationship : relationships) { for (Element source : relationship.getSources()) { ViewerSearchService viewerSearchService = null; @@ -80,26 +82,26 @@ public class DirectedRelationshipSourceHyperlinkContributor implements Hyperlink } } } - + if (viewerSearchService != null) { List viewerSearchResults = viewerSearchService.getViewersInCurrentModel(source, null, false, false); objectsInViews.addAll(viewerSearchResults); } } } - + // Get active page to later check if a found object is in the active page (we don't want the object then) TreeIterator allViewsOfActivatePage = null; View page = null; try { - IPage activePage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((Element) fromElement).getActiveSashWindowsPage(); - + IPage activePage = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, (Element) fromElement).getActiveSashWindowsPage(); + if (activePage != null) { Object pageId = activePage.getRawModel(); - + if (pageId instanceof PageRef) { Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier(); - + if (emfPageId instanceof View) { page = ((View) emfPageId); } @@ -108,13 +110,13 @@ public class DirectedRelationshipSourceHyperlinkContributor implements Hyperlink } catch (Exception e) { Activator.log.error(e); } - + for (Object object : objectsInViews) { if (object instanceof View) { // Check if the activate page contains the object // If so, we do not create a hyperlink for the object boolean inActivePage = false; - if (page != null) { + if (page != null) { allViewsOfActivatePage = page.eAllContents(); while (allViewsOfActivatePage.hasNext()) { EObject next = allViewsOfActivatePage.next(); @@ -130,7 +132,7 @@ public class DirectedRelationshipSourceHyperlinkContributor implements Hyperlink } } } - + if (!inActivePage) { HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object); hyperlinks.add(hyperlink); @@ -138,8 +140,8 @@ public class DirectedRelationshipSourceHyperlinkContributor implements Hyperlink } } } - - + + return hyperlinks; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java index 35dd66e81f7..702e6c61004 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.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) - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -20,13 +21,13 @@ import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; 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; import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.hyperlink.Activator; -import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject; import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject; import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor; @@ -49,14 +50,15 @@ public class DirectedRelationshipTargetHyperlinkContributor implements Hyperlink * @param fromElement * @return */ + @Override public List getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof Element) { List relationships = ((Element) fromElement).getSourceDirectedRelationships(); - + List objectsInViews = new ArrayList(); - + for (DirectedRelationship relationship : relationships) { for (Element target : relationship.getTargets()) { ViewerSearchService viewerSearchService = null; @@ -80,26 +82,26 @@ public class DirectedRelationshipTargetHyperlinkContributor implements Hyperlink } } } - + if (viewerSearchService != null) { List viewerSearchResults = viewerSearchService.getViewersInCurrentModel(target, null, false, false); objectsInViews.addAll(viewerSearchResults); } } } - + // Get active page to later check if a found object is in the active page (we don't want the object then) TreeIterator allViewsOfActivatePage = null; View page = null; try { - IPage activePage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((Element) fromElement).getActiveSashWindowsPage(); - + IPage activePage = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, (Element) fromElement).getActiveSashWindowsPage(); + if (activePage != null) { Object pageId = activePage.getRawModel(); - + if (pageId instanceof PageRef) { Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier(); - + if (emfPageId instanceof View) { page = ((View) emfPageId); } @@ -108,13 +110,13 @@ public class DirectedRelationshipTargetHyperlinkContributor implements Hyperlink } catch (Exception e) { Activator.log.error(e); } - + for (Object object : objectsInViews) { if (object instanceof View) { // Check if the activate page contains the object // If so, we do not create a hyperlink for the object boolean inActivePage = false; - if (page != null) { + if (page != null) { allViewsOfActivatePage = page.eAllContents(); while (allViewsOfActivatePage.hasNext()) { EObject next = allViewsOfActivatePage.next(); @@ -130,7 +132,7 @@ public class DirectedRelationshipTargetHyperlinkContributor implements Hyperlink } } } - + if (!inActivePage) { HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object); hyperlinks.add(hyperlink); @@ -138,7 +140,7 @@ public class DirectedRelationshipTargetHyperlinkContributor implements Hyperlink } } } - + return hyperlinks; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java index 95d5891c198..64c1e5a51c8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java @@ -11,11 +11,11 @@ import org.eclipse.emf.common.notify.Notifier; import org.eclipse.gef.KeyHandler; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.contexts.IContextService; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AbstractActionStateSourceProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AbstractActionStateSourceProvider.java index fae79a11fab..40bf7ac3d22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AbstractActionStateSourceProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AbstractActionStateSourceProvider.java @@ -17,7 +17,7 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.AbstractSourceProvider; import org.eclipse.ui.IPartListener; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/PartActivationListener.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/PartActivationListener.java index 0a6838f2235..eb3733cbb9d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/PartActivationListener.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/PartActivationListener.java @@ -35,10 +35,10 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; import org.eclipse.papyrus.infra.services.resourceloading.util.LoadingUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.diagram.common.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/ResourceUpdateService.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/ResourceUpdateService.java index 7739c337585..35afb97482d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/ResourceUpdateService.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/ResourceUpdateService.java @@ -31,12 +31,12 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.IService; 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.infra.ui.lifecycleevents.ILifeCycleEventsProvider; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.uml2.uml.Profile; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/SaveListener.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/SaveListener.java index 766bbc7a116..1e1ba5ed173 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/SaveListener.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/resourceupdate/SaveListener.java @@ -14,8 +14,8 @@ package org.eclipse.papyrus.uml.diagram.common.resourceupdate; -import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; import org.eclipse.swt.widgets.Display; /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java index c51a22e2800..8e8cbe1a265 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2009, 2015 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2009, 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,8 +8,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - * Christian W. Damus - bug 454578 - * Christian W. Damus - bug 458197 + * Christian W. Damus - bugs 454578, 458197, 485220 * *****************************************************************************/ @@ -19,6 +18,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent; import org.eclipse.papyrus.commands.Activator; import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.uml.tools.listeners.ProfileApplicationListener; @@ -48,7 +48,7 @@ public class PaletteProfileApplicationListener implements IPapyrusListener { if (ProfileApplicationListener.isProfileApplicationNotification(notification)) { try { Package package_ = (Package) notification.getNotifier(); - IEditorPart editor = ServiceUtilsForEObject.getInstance().getNestedActiveIEditorPart(package_); + IEditorPart editor = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, package_).getActiveEditor(); if (editor == null) { return; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AbstractPreConditionAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AbstractPreConditionAction.java index 7fa4b220cd3..93a9c89c351 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AbstractPreConditionAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AbstractPreConditionAction.java @@ -20,7 +20,7 @@ import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AssociationEndPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AssociationEndPostAction.java index 4a32d06a670..2fd0ffc9358 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AssociationEndPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/AssociationEndPostAction.java @@ -29,7 +29,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.helper.AssociationHelper; import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java index 10a9f35123d..ab83479d55b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java @@ -22,7 +22,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper; import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant; import org.eclipse.papyrus.uml.diagram.common.Activator; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java index 763bb715af1..0baa21c800c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java @@ -33,7 +33,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper; import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant; import org.eclipse.swt.SWT; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java index 9f1b1573d9c..28134892207 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java @@ -33,7 +33,7 @@ import org.eclipse.jface.viewers.ICheckStateProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper; import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant; import org.eclipse.papyrus.uml.diagram.common.Activator; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/GraphicalPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/GraphicalPostAction.java index d504e3c9b68..1b54a85c50d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/GraphicalPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/GraphicalPostAction.java @@ -24,7 +24,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant; import org.eclipse.swt.SWT; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ModelPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ModelPostAction.java index 72d07485acc..f637a55280f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ModelPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ModelPostAction.java @@ -23,7 +23,7 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gef.EditPart; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.swt.graphics.Image; import org.w3c.dom.Node; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/SemanticPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/SemanticPostAction.java index d8cbccaa269..26eeb6ad9ba 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/SemanticPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/SemanticPostAction.java @@ -57,10 +57,10 @@ import org.eclipse.jface.window.Window; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.emf.utils.ProviderHelper; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java index 9aee7c59a59..1bb12645508 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java @@ -54,7 +54,7 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.Messages; import org.eclipse.papyrus.uml.diagram.common.commands.ApplyStereotypeCommand; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLModelTester.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLModelTester.java index 9a7185a4034..28edeecf777 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLModelTester.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLModelTester.java @@ -17,7 +17,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; -import org.eclipse.papyrus.infra.tools.util.EditorHelper; +import org.eclipse.papyrus.infra.ui.util.EditorHelper; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPart; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLSelectionTester.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLSelectionTester.java index 63ffb2e25a4..43b1414b39c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLSelectionTester.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/UMLSelectionTester.java @@ -16,12 +16,12 @@ package org.eclipse.papyrus.uml.diagram.common.util; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.Profile; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF index d4b7f323224..2942ab1f6e8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF @@ -74,7 +74,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.core.databinding.observable, org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0", - com.google.guava;bundle-version="11.0.0" + com.google.guava;bundle-version="11.0.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 Eclipse-LazyStart: true Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java index eabcb54241b..ca15e6be502 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.communication; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence; +import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence; /** * The Class CommunicationDiagramCreationCondition. diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml index 05e11a1d0a4..e58ab7e9f00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml @@ -36,7 +36,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java index dc14a422e98..f4898a8e74a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java @@ -37,10 +37,10 @@ import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; 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; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF index a019923d711..d2356144a22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF @@ -65,7 +65,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0", - org.eclipse.core.databinding.observable + org.eclipse.core.databinding.observable, + org.eclipse.papyrus.infra.ui;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.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java index d35a6cde107..f6ff4adf0b6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java @@ -11,7 +11,7 @@ package org.eclipse.papyrus.uml.diagram.component; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence; +import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence; /** * ComponentDiagramCreationCondition class allows to check if a Component diagram can be added to the diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml index 5d5905255da..1fc8e2e9e49 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml @@ -125,7 +125,7 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - 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 getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof org.eclipse.uml2.uml.Package) { List nestedPackages = ((org.eclipse.uml2.uml.Package) fromElement).getNestedPackages(); List pages = new ArrayList(); - + 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 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) - 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 getHyperlinks(Object fromElement) { ArrayList hyperlinks = new ArrayList(); - + if (fromElement instanceof org.eclipse.uml2.uml.Package) { org.eclipse.uml2.uml.Package nestingPackage = ((org.eclipse.uml2.uml.Package) fromElement).getNestingPackage(); List pages = new ArrayList(); - + if (nestingPackage != null) { ViewerSearchService viewerSearchService = null; try { @@ -76,19 +79,19 @@ public class NestingPackageHyperlinkContributor implements HyperlinkContributor } } } - + if (viewerSearchService != null) { List 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 @@ + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - + + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - + + point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java index c765e1e3201..7a1c1011211 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.wizards.category; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand; +import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand; /** * The Class DiagramCategoryDescriptor. diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java index 9a91e05e663..328b9a63447 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Platform; import org.eclipse.papyrus.infra.core.extension.BadClassNameException; import org.eclipse.papyrus.infra.core.extension.ExtensionUtils; -import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand; +import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -36,7 +36,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; public class DiagramCategoryRegistry extends ExtensionUtils { /** The Constant CATEGORY_EXTENSION_POINT_NAME. */ - private static final String CATEGORY_EXTENSION_POINT_NAME = "org.eclipse.papyrus.infra.core.papyrusDiagram"; //$NON-NLS-1$ + private static final String CATEGORY_EXTENSION_POINT_NAME = "org.eclipse.papyrus.infra.ui.papyrusDiagram"; //$NON-NLS-1$ /** ID of the editor extension (schema filename). */ public static final String CATEGORY_ELEMENT_NAME = "diagramCategory"; //$NON-NLS-1$ @@ -136,10 +136,10 @@ public class DiagramCategoryRegistry extends ExtensionUtils { * Builds the category descriptor. * * @param confElement - * the conf element + * the conf element * @return the diagram category descriptor * @throws BadClassNameException - * the bad class name exception + * the bad class name exception */ protected DiagramCategoryDescriptor buildCategoryDescriptor(IConfigurationElement confElement) throws BadClassNameException { Class commandClazz = (Class) parseClass(confElement, CATEGORY_CLASS, CATEGORY_ELEMENT_NAME); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java index 6089c582e44..3b8a13deeb7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java @@ -84,7 +84,7 @@ public class SelectDiagramKindPage extends WizardPage { private static EObject modelRoot; /** The Constant DEFAULT_CREATION_COMMAND_REGISTRY. */ - public static final ICreationCommandRegistry DEFAULT_CREATION_COMMAND_REGISTRY = CreationCommandRegistry.getInstance(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); + public static final ICreationCommandRegistry DEFAULT_CREATION_COMMAND_REGISTRY = CreationCommandRegistry.getInstance(org.eclipse.papyrus.infra.ui.Activator.PLUGIN_ID); /** * Instantiates a new select diagram kind page. diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java index ce6c12be508..ef56743ed44 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java @@ -46,14 +46,14 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; 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.ui.extension.commands.IModelCreationCommand; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.wizards.Activator; import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor; diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF index a6dd40cb1ed..38f133f0811 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF @@ -13,14 +13,14 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable.common;bundle-version="1.2.0", - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", org.eclipse.core.expressions, org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", org.eclipse.uml2.uml, - org.eclipse.papyrus.infra.tools;bundle-version="1.2.0" + org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF index 3de08586c5d..fa3a9e161bb 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.uml.nattable;bundle-version="1.2.0", org.eclipse.gmf.runtime.diagram.core;bundle-version="1.7.0", org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.nattable.stereotype.display, org.eclipse.papyrus.uml.nattable.stereotype.display.configuration, org.eclipse.papyrus.uml.nattable.stereotype.display.label.provider, diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java index 2cd0ef4786e..5312ff102ec 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java @@ -24,7 +24,7 @@ import org.eclipse.papyrus.infra.nattable.layer.PapyrusGridLayer; import org.eclipse.papyrus.infra.nattable.layerstack.RowHeaderHierarchicalLayerStack; import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis; -import org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; import org.eclipse.papyrus.uml.nattable.stereotype.display.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.uml2.uml.Element; diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/StereotypeDisplayTreeTableCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/StereotypeDisplayTreeTableCellManager.java index a855f8c9dff..e7bff945515 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/StereotypeDisplayTreeTableCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/StereotypeDisplayTreeTableCellManager.java @@ -19,7 +19,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; -import org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter; import org.eclipse.papyrus.uml.nattable.stereotype.display.utils.StereotypeDisplayTreeTableConstants; import org.eclipse.papyrus.uml.nattable.stereotype.display.utils.StereotypeDisplayTreeTableHelper; import org.eclipse.uml2.uml.Property; @@ -176,7 +176,7 @@ public class StereotypeDisplayTreeTableCellManager implements ICellManager { * {@inheritDoc} * * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetStringValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.String, - * org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) */ @Override public Command getSetStringValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final String newValue, final AbstractStringValueConverter valueConverter, final INattableModelManager tableManager) { @@ -207,7 +207,7 @@ public class StereotypeDisplayTreeTableCellManager implements ICellManager { /** * {@inheritDoc} * - * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter, + * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter, * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager, java.util.Map) */ @Override diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/TableSelectionProviderCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/TableSelectionProviderCellManager.java index 141726eea33..3518a792511 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/TableSelectionProviderCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/cell/TableSelectionProviderCellManager.java @@ -7,7 +7,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; -import org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter; /** * Used to get Rows in the Stereotype Display Tree Table. From the Selection. @@ -85,7 +85,7 @@ public class TableSelectionProviderCellManager implements ICellManager { /** * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetStringValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.String, - * org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) * * @param domain * @param columnElement @@ -130,7 +130,7 @@ public class TableSelectionProviderCellManager implements ICellManager { } /** - * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter, + * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter, * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager, java.util.Map) * * @param columnElement diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/META-INF/MANIFEST.MF index c3a7f2c2df9..fed79a90e67 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.uml2.uml, com.google.inject, org.eclipse.papyrus.uml.nattable.xtext.integration;bundle-version="1.2.0", org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.2.0" + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.nattable.xtext.valuespecification, org.eclipse.papyrus.uml.nattable.xtext.valuespecification.celleditor, org.eclipse.papyrus.uml.nattable.xtext.valuespecification.manager.cell diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/manager/cell/ValueSpecificationCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/manager/cell/ValueSpecificationCellManager.java index 381d2157642..5d6ac768ffb 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/manager/cell/ValueSpecificationCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/manager/cell/ValueSpecificationCellManager.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST. + * 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: * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.uml.nattable.xtext.valuespecification.manager.cell; @@ -26,15 +27,13 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.emf.nattable.manager.cell.EMFFeatureValueCellManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; -import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectAxis; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; -import org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter; import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.internal.UmlValueSpecificationActivator; import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.ValueSpecificationSetCommand; import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; import com.google.inject.Injector; @@ -56,12 +55,12 @@ public class ValueSpecificationCellManager extends EMFFeatureValueCellManager { final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) { if (newValue instanceof IAdaptable) { - final ICommand cmd = (ICommand) ((IAdaptable) newValue) + final ICommand cmd = ((IAdaptable) newValue) .getAdapter(ICommand.class); if (null != cmd && cmd.canExecute()) { return new GMFtoEMFCommandWrapper(cmd); } else { - final String editedString = (String) ((IAdaptable) newValue) + final String editedString = ((IAdaptable) newValue) .getAdapter(String.class); return getSetStringValueCommand(domain, columnElement, rowElement, editedString, null, tableManager); @@ -89,9 +88,9 @@ public class ValueSpecificationCellManager extends EMFFeatureValueCellManager { EStructuralFeature structuralFeature = null; if (columnElement instanceof EStructuralFeatureAxis) { - structuralFeature = (EStructuralFeature) ((EStructuralFeatureAxis) columnElement).getElement(); + structuralFeature = ((EStructuralFeatureAxis) columnElement).getElement(); } else { - structuralFeature = (EStructuralFeature) ((EStructuralFeatureAxis) rowElement).getElement(); + structuralFeature = ((EStructuralFeatureAxis) rowElement).getElement(); } if (UMLPackage.Literals.VALUE_SPECIFICATION == structuralFeature diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF index 2e9c3897130..c932aac44ae 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF @@ -15,8 +15,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.uml2.uml;bundle-version="4.1.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", @@ -36,7 +35,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.swt, org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0", ca.odell.glazedlists;bundle-version="1.9.0", - org.eclipse.jface.text;bundle-version="3.10.0" + org.eclipse.jface.text;bundle-version="3.10.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java index cd80234d6b2..cd1741db2aa 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java @@ -35,10 +35,10 @@ import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.paste.PastePostActionRegistry; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; -import org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter; -import org.eclipse.papyrus.infra.tools.converter.ConvertedValueContainer; -import org.eclipse.papyrus.infra.tools.converter.MultiConvertedValueContainer; -import org.eclipse.papyrus.infra.tools.converter.StringValueConverterStatus; +import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.ConvertedValueContainer; +import org.eclipse.papyrus.infra.ui.converter.MultiConvertedValueContainer; +import org.eclipse.papyrus.infra.ui.converter.StringValueConverterStatus; import org.eclipse.papyrus.uml.nattable.Activator; import org.eclipse.papyrus.uml.nattable.messages.Messages; import org.eclipse.papyrus.uml.nattable.paste.StereotypeApplicationStructure; diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLFeatureCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLFeatureCellManager.java index 5c6d47d9ca4..370783abb4f 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLFeatureCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLFeatureCellManager.java @@ -18,7 +18,7 @@ import java.util.Map; import org.eclipse.papyrus.infra.emf.nattable.manager.cell.EMFFeatureValueCellManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; -import org.eclipse.papyrus.infra.tools.converter.AbstractStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter; import org.eclipse.papyrus.uml.tools.utils.UMLStringValueConverter; import org.eclipse.uml2.uml.Element; diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/menu/AbstractCreateStereotypePropertyMenuFactory.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/menu/AbstractCreateStereotypePropertyMenuFactory.java index 845f32c8085..d6525040506 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/menu/AbstractCreateStereotypePropertyMenuFactory.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/menu/AbstractCreateStereotypePropertyMenuFactory.java @@ -28,7 +28,7 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.FeatureIdAxis; -import org.eclipse.papyrus.infra.tools.util.EditorHelper; +import org.eclipse.papyrus.infra.ui.util.EditorHelper; import org.eclipse.papyrus.infra.widgets.Activator; import org.eclipse.papyrus.infra.widgets.providers.HierarchicToFlatContentProvider; import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider; diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF index f5a12951497..b096c0428a4 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.2.0" + org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.commands.command Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java index 499e17647c1..b3a7dab09a3 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java @@ -61,7 +61,7 @@ public abstract class AbstractEMFCommandHandler extends AbstractHandler { protected TransactionalEditingDomain getEditingDomain() { TransactionalEditingDomain editingDomain = null; try { - editingDomain = org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain(); + editingDomain = org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain(); } catch (ServiceException e) { // we are closing the editor, so the model explorer has nothing to display // e.printStackTrace(); diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/META-INF/MANIFEST.MF index 12d34227556..1fba60d0277 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", org.eclipse.emf.edit.ui;bundle-version="2.10.0", org.eclipse.uml2.uml.edit;bundle-version="5.0.0", - org.eclipse.ui.ide;bundle-version="3.10.100" + org.eclipse.ui.ide;bundle-version="3.10.100", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/SwitchLibraryHandler.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/SwitchLibraryHandler.java index e9faef18eff..f2a28e5981e 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/SwitchLibraryHandler.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/SwitchLibraryHandler.java @@ -26,11 +26,11 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.ui.SwitchLibraryDialog; import org.eclipse.swt.widgets.Shell; diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java index efee5280387..842c01cb4fb 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java @@ -34,7 +34,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.IModelSetSnippet; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; @@ -42,6 +41,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.ui.IZombieStereotypePresenter; import org.eclipse.papyrus.uml.modelrepair.ui.ZombieStereotypeDialogPresenter; diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairService.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairService.java index 1a62c8e2b6b..8b8fac8e6ec 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairService.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairService.java @@ -32,7 +32,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.IService; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.tools.util.UIUtil; +import org.eclipse.papyrus.infra.ui.util.UIUtil; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.service.IStereotypeRepairService; import org.eclipse.swt.widgets.Display; diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchLibraryDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchLibraryDialog.java index 321384debf1..565c5b1da66 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchLibraryDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchLibraryDialog.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST and others. + * Copyright (c) 2014, 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 @@ -9,6 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Inspired from Class {@link SwitchPackageImportDialog} + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.uml.modelrepair.ui; @@ -54,12 +55,12 @@ import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.window.Window; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.emf.resource.DependencyManager; import org.eclipse.papyrus.infra.emf.resource.Replacement; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialog; +import org.eclipse.papyrus.infra.ui.util.TransactionUIHelper; import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider; import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider; @@ -266,7 +267,7 @@ public class SwitchLibraryDialog extends SelectionDialog { final Collection allReplacements = new LinkedList(); final BasicDiagnostic diagnostics = new BasicDiagnostic(Activator.PLUGIN_ID, 0, "Problems in switching library", null); - IRunnableWithProgress runnable = TransactionHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { + IRunnableWithProgress runnable = TransactionUIHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, librariesToEdit.size()); diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java index d488ca62bc5..c727e597f53 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013, 2014 CEA LIST and others. + * 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 @@ -9,6 +9,7 @@ * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 408491 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.uml.modelrepair.ui; @@ -56,12 +57,12 @@ import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.emf.resource.DependencyManager; import org.eclipse.papyrus.infra.emf.resource.Replacement; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialog; +import org.eclipse.papyrus.infra.ui.util.TransactionUIHelper; import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.tools.util.ProfileHelper; @@ -282,7 +283,7 @@ public class SwitchProfileDialog extends SelectionDialog { final Collection allReplacements = new LinkedList(); final BasicDiagnostic diagnostics = new BasicDiagnostic(Activator.PLUGIN_ID, 0, "Problems in switching profile", null); - IRunnableWithProgress runnable = TransactionHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { + IRunnableWithProgress runnable = TransactionUIHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, profilesToEdit.size()); diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypeDialogPresenter.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypeDialogPresenter.java index 6ae5cac7e2e..9a0b4de9b5e 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypeDialogPresenter.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypeDialogPresenter.java @@ -38,7 +38,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl; -import org.eclipse.papyrus.infra.tools.util.UIUtil; +import org.eclipse.papyrus.infra.ui.util.UIUtil; import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.ZombieStereotypesDescriptor; diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java index c3bc7e5351a..7059a20b61e 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 CEA, Christian W. Damus, and others. + * Copyright (c) 2013, 2016 CEA, 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 @@ -9,11 +9,8 @@ * Contributors: * CEA - Initial API and implementation * Christian W. Damus (CEA) - bug 431953 (adapted from SwitchProfileDialog) - * Christian W. Damus - bug 451338 - * Christian W. Damus - bug 451557 + * Christian W. Damus - bugs 451338, 451557, 436666, 458736, 485220 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 454997 - * Christian W. Damus - bug 436666 - * Christian W. Damus - bug 458736 * */ package org.eclipse.papyrus.uml.modelrepair.ui; @@ -67,11 +64,11 @@ import org.eclipse.jface.wizard.ProgressMonitorPart; import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.utils.AdapterUtils; -import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialog; -import org.eclipse.papyrus.infra.tools.util.UIUtil; +import org.eclipse.papyrus.infra.ui.util.TransactionUIHelper; +import org.eclipse.papyrus.infra.ui.util.UIUtil; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IRepairAction; import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IStereotypeOrphanGroup; @@ -258,7 +255,7 @@ public class ZombieStereotypesDialog extends TrayDialog { final BasicDiagnostic diagnostics = new BasicDiagnostic(Activator.PLUGIN_ID, 0, "Problems in repairing stereotypes", null); - IRunnableWithProgress runnable = TransactionHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { + IRunnableWithProgress runnable = TransactionUIHelper.createPrivilegedRunnableWithProgress(editingDomain, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, actionsToApply.size()); diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF index 67d839ae9cf..839905b88f7 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF @@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", - org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0" + org.eclipse.papyrus.uml.modelrepair;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/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml index fbf8a739ccb..542552f5343 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml @@ -132,7 +132,7 @@ priority="1" startKind="startup"> + serviceKeyRef="org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager"> diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/service/ReapplyProfilesService.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/service/ReapplyProfilesService.java index a5be822ad2f..d0e9dab804e 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/service/ReapplyProfilesService.java +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/service/ReapplyProfilesService.java @@ -23,14 +23,14 @@ import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.NotFoundException; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleEventListener; -import org.eclipse.papyrus.infra.core.services.EditorLifecycleManager; import org.eclipse.papyrus.infra.core.services.IService; 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.infra.ui.services.EditorLifecycleEventListener; +import org.eclipse.papyrus.infra.ui.services.EditorLifecycleManager; import org.eclipse.papyrus.uml.modelrepair.service.IStereotypeRepairService; import org.eclipse.papyrus.uml.profile.Activator; import org.eclipse.papyrus.uml.profile.service.ui.RefreshProfileDialog; diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF index 5f9737e10ab..565cf6ced20 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF @@ -28,7 +28,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ltk.ui.refactoring;bundle-version="3.7.100", org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0", - org.eclipse.gmf.runtime.notation + org.eclipse.gmf.runtime.notation, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-Vendor: %vendorName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/AbstractPapyrusQuery.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/AbstractPapyrusQuery.java index 45fc3140aad..4cb868634d6 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/AbstractPapyrusQuery.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/AbstractPapyrusQuery.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013 CEA LIST and others. - * + * 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 @@ -10,6 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA LIST) - Fix leaking of all UML models in search results + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.uml.search.ui.query; @@ -25,7 +25,7 @@ import org.eclipse.core.runtime.SubMonitor; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.uml.search.ui.Activator; @@ -39,9 +39,9 @@ import org.eclipse.uml2.uml.Element; * */ public abstract class AbstractPapyrusQuery implements ISearchQuery { - + protected SubMonitor progressMonitor; - + /** * Getter for the text query * @@ -95,21 +95,22 @@ public abstract class AbstractPapyrusQuery implements ISearchQuery { return ""; } } - + /** * Get views in which the UML element is shown + * * @param element * @return */ - + protected List getViews(Element element) { if (element == null) { return null; } - + IPageManager pageManager; try { - pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(element); + pageManager = ServiceUtilsForEObject.getInstance().getService(IPageManager.class, element); } catch (ServiceException e) { Activator.log.error(e); return null; @@ -146,7 +147,7 @@ public abstract class AbstractPapyrusQuery implements ISearchQuery { Activator.log.error(e); return null; } - + return viewsToSelect; } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/results/PapyrusSearchResult.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/results/PapyrusSearchResult.java index 8832f6b7b13..dfbee73a55d 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/results/PapyrusSearchResult.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/results/PapyrusSearchResult.java @@ -32,7 +32,7 @@ import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.uml.search.ui.Activator; import org.eclipse.papyrus.uml.search.ui.Messages; import org.eclipse.papyrus.uml.search.ui.query.AbstractPapyrusQuery; diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF index 16664cbde6e..26746b21af6 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF @@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0", org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.uml2.uml;bundle-version="5.1.0", - org.eclipse.emf.ecore;bundle-version="2.11.0" + org.eclipse.emf.ecore;bundle-version="2.11.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/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateCommandHandler.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateCommandHandler.java index 5ee94451da2..4243ca0162f 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateCommandHandler.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateCommandHandler.java @@ -24,7 +24,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; import org.eclipse.papyrus.uml.service.types.filter.ICommandFilter; import org.eclipse.papyrus.uml.service.types.filter.UmlElementCommandFilter; import org.eclipse.papyrus.uml.service.types.utils.ICommandContext; diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateElementCommandHandler.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateElementCommandHandler.java index ea84866346e..a91a34ac5a7 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateElementCommandHandler.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/handlers/AbstractCreateElementCommandHandler.java @@ -24,7 +24,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; import org.eclipse.papyrus.uml.service.types.filter.ICommandFilter; import org.eclipse.papyrus.uml.service.types.filter.UmlElementCommandFilter; import org.eclipse.papyrus.uml.service.types.utils.ICommandContext; diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExtensionHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExtensionHelper.java index 23b5848c168..9dd4c2ff787 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExtensionHelper.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExtensionHelper.java @@ -32,13 +32,13 @@ import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.EMFtoGEFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.IModel; import org.eclipse.papyrus.infra.core.resource.ModelSet; 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.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper; import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/menu/AbstractCreateUmlChildMenu.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/menu/AbstractCreateUmlChildMenu.java index 22f81dd048a..69b18636891 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/menu/AbstractCreateUmlChildMenu.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/menu/AbstractCreateUmlChildMenu.java @@ -11,7 +11,7 @@ *****************************************************************************/ package org.eclipse.papyrus.uml.service.types.menu; -import org.eclipse.papyrus.infra.tools.util.AbstractCreateMenuFromCommandCategory; +import org.eclipse.papyrus.infra.ui.util.AbstractCreateMenuFromCommandCategory; /** diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF index ede8b04d5eb..cb97ce8810e 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.databinding.property, org.eclipse.jface.databinding, com.ibm.icu, - org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0" + org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.profile.drafter, org.eclipse.papyrus.uml.profile.drafter.exceptions, org.eclipse.papyrus.uml.profile.drafter.ui.handler, diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/handler/AbstractBaseHandler.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/handler/AbstractBaseHandler.java index b478cf22fec..d272df89b06 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/handler/AbstractBaseHandler.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/handler/AbstractBaseHandler.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.uml.profile.drafter.ui.handler; @@ -28,6 +31,7 @@ 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.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForIEvaluationContext; @@ -37,6 +41,7 @@ import org.eclipse.ui.IEditorPart; /** * Base class for Handlers . * This class provide utility methods. + * * @author cedric dumoulin * */ @@ -62,10 +67,11 @@ public abstract class AbstractBaseHandler extends AbstractHandler { * @throws ExecutionException * */ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { - + resetCachedValues(); - + // Get requested objects IEvaluationContext context; try { @@ -77,7 +83,7 @@ public abstract class AbstractBaseHandler extends AbstractHandler { // Execute the command in 3 phases - if (!preExecute(event, context) ) { + if (!preExecute(event, context)) { return null; } executeTransaction(event, context); @@ -100,7 +106,7 @@ public abstract class AbstractBaseHandler extends AbstractHandler { * outside of the transaction. * * @param event - * @param context + * @param context * @return true if the doExecute() should be called, false if the command should stop */ protected boolean preExecute(ExecutionEvent event, IEvaluationContext context) throws ExecutionException { @@ -113,19 +119,20 @@ public abstract class AbstractBaseHandler extends AbstractHandler { * outside of the transaction. * * @param event - * @param context + * @param context */ protected void postExecute(ExecutionEvent event, IEvaluationContext context) throws ExecutionException { // TODO Auto-generated method stub - + } /** * Execute as transaction - * @param event - * @param selections - * @param context + * + * @param event + * @param selections + * @param context */ private void executeTransaction(ExecutionEvent event, final IEvaluationContext context) { @@ -152,7 +159,7 @@ public abstract class AbstractBaseHandler extends AbstractHandler { } } - + }; editingDomain.getCommandStack().execute(cmd); @@ -161,31 +168,33 @@ public abstract class AbstractBaseHandler extends AbstractHandler { /** * get the selected objects from the context. + * * @param context * @return */ protected List getCachedSelections(IEvaluationContext context) { - if( cachedSelections == null) { + if (cachedSelections == null) { cachedSelections = getSelections(context); } - + return cachedSelections; } - + /** * get the selected objects from the context. + * * @param context * @return */ @SuppressWarnings("unchecked") protected List getSelections(IEvaluationContext context) { Object sel = context.getVariable("selection"); - if(! (sel instanceof IStructuredSelection)) { + if (!(sel instanceof IStructuredSelection)) { return Collections.emptyList(); } - IStructuredSelection structuredSelection = (IStructuredSelection)sel; + IStructuredSelection structuredSelection = (IStructuredSelection) sel; return structuredSelection.toList(); } @@ -203,26 +212,26 @@ public abstract class AbstractBaseHandler extends AbstractHandler { List results = new ArrayList(); // create model with EList objects - for(Object obj : selections) { - + for (Object obj : selections) { + T ele = null; // Bug in Tree Explorer // ModelExplorer tree element do not implements IAdaptable. So, we should manually get the underlying adaptable object. -// if( obj instanceof EObjectTreeElement ) { -// obj = ((EObjectTreeElement)obj).getEObject(); -// } + // if( obj instanceof EObjectTreeElement ) { + // obj = ((EObjectTreeElement)obj).getEObject(); + // } // Adapt object to NamedElement - if(obj instanceof IAdaptable) { - ele = (T)((IAdaptable)obj).getAdapter(expectedType); + if (obj instanceof IAdaptable) { + ele = ((IAdaptable) obj).getAdapter(expectedType); } - if(ele == null) { - ele = (T)Platform.getAdapterManager().getAdapter(obj, expectedType); + if (ele == null) { + ele = Platform.getAdapterManager().getAdapter(obj, expectedType); } // Add uml element if found - if(ele != null) { + if (ele != null) { results.add(ele); } @@ -232,7 +241,7 @@ public abstract class AbstractBaseHandler extends AbstractHandler { } /** - * Get the name used in the {@link RecordingCommand}. This name will be visible in + * Get the name used in the {@link RecordingCommand}. This name will be visible in * undo/redo. * * @return The command name to show. @@ -247,37 +256,40 @@ public abstract class AbstractBaseHandler extends AbstractHandler { */ protected abstract void doExecute(ExecutionEvent event, IEvaluationContext context); -// /** -// * -// * @return -// * @throws NotFoundException -// */ -// protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { -// -// return lookupLayersViewChecked().getLayerStackMngrChecked(); -// -// } - - + // /** + // * + // * @return + // * @throws NotFoundException + // */ + // protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { + // + // return lookupLayersViewChecked().getLayerStackMngrChecked(); + // + // } + + protected IEvaluationContext getIEvaluationContext(ExecutionEvent event) throws NotFoundException { try { - return (IEvaluationContext)event.getApplicationContext(); + return (IEvaluationContext) event.getApplicationContext(); } catch (ClassCastException e) { throw new NotFoundException("IEvaluationContext can't be found."); } - + } + /** * Try to lookup the TransactionalEditingDomain. + * * @return - * @throws ServiceException If the Editing domain can't be found. + * @throws ServiceException + * If the Editing domain can't be found. */ protected TransactionalEditingDomain lookupTransactionalEditingDomain(IEvaluationContext context) throws ServiceException { // Get page from the event ! -// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); - - return ServiceUtilsForIEvaluationContext.getInstance().getTransactionalEditingDomain(context); + // IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); + + return ServiceUtilsForIEvaluationContext.getInstance().getTransactionalEditingDomain(context); } /** @@ -286,7 +298,7 @@ public abstract class AbstractBaseHandler extends AbstractHandler { * * @param context * @return - * @throws ServiceException + * @throws ServiceException */ protected ServicesRegistry lookupServicesRegistry(IEvaluationContext context) throws ServiceException { return ServiceUtilsForIEvaluationContext.getInstance().getServiceRegistry(context); @@ -302,25 +314,26 @@ public abstract class AbstractBaseHandler extends AbstractHandler { */ @Override public void setEnabled(Object evaluationContext) { - + resetCachedValues(); - - if( ! (evaluationContext instanceof IEvaluationContext)) { + + if (!(evaluationContext instanceof IEvaluationContext)) { setBaseEnabled(false); return; } - - IEvaluationContext context = (IEvaluationContext)evaluationContext; + + IEvaluationContext context = (IEvaluationContext) evaluationContext; List selections = getCachedSelections(context); // Ask the subclass setBaseEnabled(isEnabled(context, selections)); - + } - + /** * Return true if the action is enabled, false otherwise. * Subclasses should implements this method. The default implementation return true. + * * @param context * @return */ @@ -328,112 +341,112 @@ public abstract class AbstractBaseHandler extends AbstractHandler { return true; } - // /** - // * - // * @return - // * @throws NotFoundException - // */ - // protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { - // - // return lookupLayersViewChecked().getLayerStackMngrChecked(); - // - // } - + // /** + // * + // * @return + // * @throws NotFoundException + // */ + // protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { + // + // return lookupLayersViewChecked().getLayerStackMngrChecked(); + // + // } + /** * lookup the notation diagram helper. * This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}. * - * @return The + * @return The * @throws NotFoundException - * @throws ServiceException + * @throws ServiceException */ -// protected NotationDiagramHelper lookupNotationDiagramHelperChecked(IEvaluationContext context) throws NotFoundException, ServiceException { -// -// -// // Get page from the event ! -//// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); -// -// IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context); -// -// if( ! (editor instanceof DiagramDocumentEditor) ) { -// throw new NotFoundException("Selected editor do not contains Diagram"); -// } -// DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor)editor; -// -// Diagram diagram = diagramEditor.getDiagram(); -// if(diagram == null) { -// throw new NotFoundException("Selected editor do not contains Diagram"); -// } -// -// // Lookup the Layer model -// LayersModel layersModel = (LayersModel)ServiceUtilsForIEvaluationContext.getInstance().getModelSet(context).getModel(LayersModel.MODEL_ID); -// // Return a new instance of the Helper -// return new NotationDiagramHelper(layersModel, diagram); -// } + // protected NotationDiagramHelper lookupNotationDiagramHelperChecked(IEvaluationContext context) throws NotFoundException, ServiceException { + // + // + // // Get page from the event ! + //// IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); + // + // IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context); + // + // if( ! (editor instanceof DiagramDocumentEditor) ) { + // throw new NotFoundException("Selected editor do not contains Diagram"); + // } + // DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor)editor; + // + // Diagram diagram = diagramEditor.getDiagram(); + // if(diagram == null) { + // throw new NotFoundException("Selected editor do not contains Diagram"); + // } + // + // // Lookup the Layer model + // LayersModel layersModel = (LayersModel)ServiceUtilsForIEvaluationContext.getInstance().getModelSet(context).getModel(LayersModel.MODEL_ID); + // // Return a new instance of the Helper + // return new NotationDiagramHelper(layersModel, diagram); + // } /** * lookup the LayerStack application object from context.. * This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}. * - * @return The + * @return The * @throws NotFoundException - * @throws ServiceException - * @throws org.eclipse.papyrus.infra.core.resource.NotFoundException + * @throws ServiceException + * @throws org.eclipse.papyrus.infra.core.resource.NotFoundException */ -// protected LayersStackApplication lookupLayersStackApplicationChecked(IEvaluationContext context) throws NotFoundException, ServiceException, org.eclipse.papyrus.infra.core.resource.NotFoundException { -// -// ModelSet modelSet = ServiceUtilsForIEvaluationContext.getInstance().getModelSet(context); -// LayersModel model = (LayersModel)modelSet.getModelChecked(LayersModel.MODEL_ID); -// -// return model.lookupLayerStackApplication(); -// } - - // /** - // * - // * @return - // * @throws NotFoundException - // */ - // protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { - // - // return lookupLayersViewChecked().getLayerStackMngrChecked(); - // - // } - - /** - * Get the notation diagram helper. - * This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}. - * - * @return The - * @throws NotFoundException - * @throws ServiceException - */ - protected Diagram lookupNotationDiagramChecked(IEvaluationContext context) throws NotFoundException, ServiceException { - - IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getNestedActiveIEditorPart(context); - - if(!(editor instanceof DiagramDocumentEditor)) { - throw new NotFoundException("Selected editor do not contains Diagram"); //$NON-NLS-1$ - } - DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor)editor; - - Diagram diagram = diagramEditor.getDiagram(); - if(diagram == null) { - throw new NotFoundException("Selected editor do not contains Diagram"); //$NON-NLS-1$ - } - - // Return a new instance of the Helper - return diagram; + // protected LayersStackApplication lookupLayersStackApplicationChecked(IEvaluationContext context) throws NotFoundException, ServiceException, org.eclipse.papyrus.infra.core.resource.NotFoundException { + // + // ModelSet modelSet = ServiceUtilsForIEvaluationContext.getInstance().getModelSet(context); + // LayersModel model = (LayersModel)modelSet.getModelChecked(LayersModel.MODEL_ID); + // + // return model.lookupLayerStackApplication(); + // } + + // /** + // * + // * @return + // * @throws NotFoundException + // */ + // protected LayerStackMngr lookupLayerStackMngrChecked() throws NotFoundException { + // + // return lookupLayersViewChecked().getLayerStackMngrChecked(); + // + // } + + /** + * Get the notation diagram helper. + * This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}. + * + * @return The + * @throws NotFoundException + * @throws ServiceException + */ + protected Diagram lookupNotationDiagramChecked(IEvaluationContext context) throws NotFoundException, ServiceException { + + 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$ } + DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor) editor; - /** - * Return true if the first element of the selection is instance of the specified type. - */ - protected boolean selectionFirstElementInstanceOf(List selections, Class type) { - if( selections.size() != 1) { - return false; - } - Object first = selections.get(0); - return type.isInstance(first); + Diagram diagram = diagramEditor.getDiagram(); + if (diagram == null) { + throw new NotFoundException("Selected editor do not contains Diagram"); //$NON-NLS-1$ } + // Return a new instance of the Helper + return diagram; + } + + /** + * Return true if the first element of the selection is instance of the specified type. + */ + protected boolean selectionFirstElementInstanceOf(List selections, Class type) { + if (selections.size() != 1) { + return false; + } + Object first = selections.get(0); + return type.isInstance(first); + } + } diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF index 76fef3a609b..9e6d12bb9cf 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.state.xtext;bundle-version="1.2 org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.2.0", - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.2.0" + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contentassist/UmlStateProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contentassist/UmlStateProposalProvider.java index 0cac1c26eee..bdd67bc04c2 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contentassist/UmlStateProposalProvider.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contentassist/UmlStateProposalProvider.java @@ -21,7 +21,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.text.contentassist.CompletionProposal; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.papyrus.infra.core.utils.DisplayUtils; +import org.eclipse.papyrus.infra.ui.util.DisplayUtils; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.QualifiedName; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.StateRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.SubmachineRule; diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF index 331089c2d27..68a9cba3545 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.uml2.uml, org.eclipse.ui.workbench;bundle-version="3.105.0", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0" + org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %pluginProvider Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/UMLStringValueConverter.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/UMLStringValueConverter.java index 6868fdd8eae..f2d83bbed92 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/UMLStringValueConverter.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/UMLStringValueConverter.java @@ -28,10 +28,10 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.infra.emf.Activator; -import org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter; -import org.eclipse.papyrus.infra.tools.converter.ConvertedValueContainer; -import org.eclipse.papyrus.infra.tools.converter.MultiConvertedValueContainer; -import org.eclipse.papyrus.infra.tools.converter.StringValueConverterStatus; +import org.eclipse.papyrus.infra.ui.converter.ConvertedValueContainer; +import org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter; +import org.eclipse.papyrus.infra.ui.converter.MultiConvertedValueContainer; +import org.eclipse.papyrus.infra.ui.converter.StringValueConverterStatus; import org.eclipse.papyrus.uml.tools.utils.messages.Messages; import org.eclipse.uml2.uml.DataType; import org.eclipse.uml2.uml.Element; @@ -73,7 +73,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#dispose() + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#dispose() * */ @Override @@ -84,7 +84,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#getFeatureUpperBound(java.lang.Object) + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#getFeatureUpperBound(java.lang.Object) * * @param feature * @return @@ -99,7 +99,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#getFeatureType(java.lang.Object) + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#getFeatureType(java.lang.Object) * * @param feature * @return @@ -140,7 +140,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#doDeduceValueFromString(java.lang.Object, java.lang.String) + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#doDeduceValueFromString(java.lang.Object, java.lang.String) * * @param feature * @param valueAsString @@ -157,7 +157,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#deduceValueFromString(java.lang.Object, org.eclipse.emf.ecore.EClassifier, java.lang.String) + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#deduceValueFromString(java.lang.Object, org.eclipse.emf.ecore.EClassifier, java.lang.String) * * @param feature * @param featureType @@ -179,7 +179,7 @@ public class UMLStringValueConverter extends EMFStringValueConverter { /** * - * @see org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter#deduceEObjectValue(org.eclipse.emf.ecore.EObject, java.lang.Object, org.eclipse.emf.ecore.EClass, boolean, java.lang.String) + * @see org.eclipse.papyrus.infra.ui.converter.EMFStringValueConverter#deduceEObjectValue(org.eclipse.emf.ecore.EObject, java.lang.Object, org.eclipse.emf.ecore.EClass, boolean, java.lang.String) * * @param resolutionContext * @param feature diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF index c6526baf898..86a267b24ce 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF @@ -39,7 +39,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0", org.eclipse.uml2.uml.validation;bundle-version="5.0.0", com.google.guava;bundle-version="11.0.0", - org.eclipse.jface.text;bundle-version="3.10.0" + org.eclipse.jface.text;bundle-version="3.10.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlUtils.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlUtils.java index ea5eb380585..e45e1bba554 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlUtils.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlUtils.java @@ -30,7 +30,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelUtils; 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.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.tools.Activator; import com.google.common.collect.Iterables; diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java index 09a64cf5ef7..aa91d1c5b93 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java @@ -27,9 +27,9 @@ import org.eclipse.jface.viewers.Viewer; 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.core.utils.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.emf.providers.EMFEnumeratorContentProvider; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider; import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider; import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider; diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF index 888c24a4b07..f413836bd16 100644 --- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.gef;bundle-version="3.9.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.uml.service.validation;bundle-version="1.2.0", org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: Eclipse Modeling Project Bundle-Version: 1.2.0.qualifier Bundle-Name: GMF Xtext Integration diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java index 4936b3e0286..f57ada93cb5 100644 --- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java +++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java @@ -20,7 +20,7 @@ import java.util.List; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.papyrus.infra.core.utils.DisplayUtils; +import org.eclipse.papyrus.infra.ui.util.DisplayUtils; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Namespace; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF index 98d1f603c90..2845497ce6d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF @@ -52,7 +52,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.emf.facet.efacet;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.efacet.metamodel;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.util.emf.core;bundle-version="1.2.0", - org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0" + org.eclipse.papyrus.infra.viewpoints.policy;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 Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java index 7725e29c554..d48240555f9 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * + * Copyright (c) 2010, 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 @@ -9,6 +8,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer; @@ -21,8 +21,8 @@ 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.core.utils.ServiceUtilsForWorkbenchPage; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForWorkbenchPage; import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement; import org.eclipse.papyrus.infra.widgets.util.NavigationTarget; import org.eclipse.ui.IEditorInput; @@ -44,6 +44,7 @@ public class LinkHelper implements ILinkHelper { * @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput) * */ + @Override public IStructuredSelection findSelection(IEditorInput anInput) { return null; } @@ -53,6 +54,7 @@ public class LinkHelper implements ILinkHelper { * @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection) * */ + @Override public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) { // no selection if (aSelection == null || aSelection.isEmpty()) { @@ -65,7 +67,7 @@ public class LinkHelper implements ILinkHelper { // if the diagram has been selected the selection is not a TreeSelection if (selection instanceof ITreeSelection) { try { - ISashWindowsContainer windowsContainer = ServiceUtilsForWorkbenchPage.getInstance().getISashWindowsContainer(aPage); + ISashWindowsContainer windowsContainer = ServiceUtilsForWorkbenchPage.getInstance().getService(ISashWindowsContainer.class, aPage); Iterator iterPart = windowsContainer.getVisibleIEditorParts().iterator(); diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java index d9eafdb9713..8471551eab6 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java @@ -16,7 +16,7 @@ package org.eclipse.papyrus.views.modelexplorer; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ViewPartPage; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java index 4364ac9db1f..60305c0e877 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java @@ -20,10 +20,10 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.papyrus.infra.core.editor.reload.EMFTreeViewerContext; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.additional.AdditionalResourcesModel; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.editor.reload.EMFTreeViewerContext; import org.eclipse.papyrus.views.modelexplorer.matching.IMatchingItem; import org.eclipse.papyrus.views.modelexplorer.matching.LinkItemMatchingItem; import org.eclipse.papyrus.views.modelexplorer.matching.ModelElementItemMatchingItem; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java index f62485ecdc4..61daef45ed0 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2014 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 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 @@ -9,12 +9,8 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - post refreshes for transaction commit asynchronously (CDO) - * Christian W. Damus (CEA) - bug 429826 - * Christian W. Damus (CEA) - bug 434635 - * Christian W. Damus (CEA) - bug 437217 - * Christian W. Damus (CEA) - bug 441857 - * Christian W. Damus - bug 450235 - * Christian W. Damus - bug 451683 + * Christian W. Damus (CEA) - bugs 429826, 434635, 437217, 441857 + * Christian W. Damus - bugs 450235, 451683, 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer; @@ -52,22 +48,15 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerColumn; import org.eclipse.jface.window.ToolTip; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IReloadableEditor; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadAdapter; -import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent; -import org.eclipse.papyrus.infra.core.editor.reload.TreeViewerContext; -import org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2; import org.eclipse.papyrus.infra.core.resource.IReadOnlyListener; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ReadOnlyEvent; import org.eclipse.papyrus.infra.core.resource.additional.AdditionalResourcesModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageLifeCycleEventsListener; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.AdapterUtils; @@ -78,6 +67,13 @@ import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderSer import org.eclipse.papyrus.infra.services.navigation.service.NavigableElement; import org.eclipse.papyrus.infra.services.navigation.service.NavigationMenu; import org.eclipse.papyrus.infra.services.navigation.service.NavigationService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadAdapter; +import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent; +import org.eclipse.papyrus.infra.ui.editor.reload.TreeViewerContext; +import org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement; import org.eclipse.papyrus.views.modelexplorer.SharedModelExplorerState.StateChangedEvent; import org.eclipse.papyrus.views.modelexplorer.listener.DoubleClickListener; @@ -118,6 +114,7 @@ import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.views.properties.IPropertySheetPage; import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; + import com.google.common.base.Supplier; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -172,6 +169,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti */ private ISelectionListener pageSelectionListener = new ISelectionListener() { + @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { handleSelectionChangedFromDiagramEditor(part, selection); } @@ -185,10 +183,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti /** * This method is called when the editor input is changed from the ISaveAndDirtyService. * - * @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput) + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput) * * @param fileEditorInput */ + @Override public void editorInputChanged(FileEditorInput fileEditorInput) { // Change the editor input. setPartName(fileEditorInput.getName()); @@ -197,9 +196,10 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti /** * The isDirty flag has changed, reflect its new value * - * @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged() + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.IEditorInputChangedListener#isDirtyChanged() * */ + @Override public void isDirtyChanged() { firePropertyChange(IEditorPart.PROP_DIRTY); } @@ -322,7 +322,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // IPageMngr iPageMngr = EditorUtils.getIPageMngr(); IPageManager iPageMngr; try { - iPageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + iPageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry); } catch (ServiceException e) { // This shouldn't happen. return Collections.emptyList(); @@ -391,6 +391,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti viewer.getNavigatorContentService().getActivationService().addExtensionActivationListener(new IExtensionActivationListener() { + @Override public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { sharedState.updateNavigatorContentExtensions(theNavigatorExtensionIds, isActive); } @@ -454,6 +455,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti getCommonViewer().setSorter(null); ((CustomCommonViewer) getCommonViewer()).getDropAdapter().setFeedbackEnabled(true); getCommonViewer().addDoubleClickListener(new DoubleClickListener(new Supplier() { + @Override public ServicesRegistry get() { return serviceRegistry; } @@ -473,6 +475,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti tree.addKeyListener(new KeyListener() { + @Override public void keyReleased(KeyEvent e) { if (navigationMenu != null) { if (e.keyCode == SWT.ALT) { @@ -481,6 +484,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti } } + @Override public void keyPressed(KeyEvent e) { if (e.keyCode != SWT.ALT) { return; @@ -535,6 +539,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti tree.addMouseMoveListener(new MouseMoveListener() { + @Override public void mouseMove(MouseEvent e) { if (navigationMenu != null) { navigationMenu.handleRequest(e, getTreeItem(e)); @@ -592,6 +597,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // Self-listen for property changes addPropertyListener(new IPropertyListener() { + @Override public void propertyChanged(Object source, int propId) { switch (propId) { case IS_LINKING_ENABLED_PROPERTY: @@ -671,6 +677,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private Runnable createRefreshRunnable() { return new Runnable() { + @Override public void run() { // Only run if I'm still pending synchronized (ModelExplorerView.this) { @@ -937,6 +944,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * * @return the EditingDomain used by the properties view */ + @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -952,6 +960,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti } } + @Override public void revealSemanticElement(List elementList) { // Ensure that the ModelExplorer is refreshed before // trying to display an element. Useful if the element has just been created, @@ -1003,6 +1012,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti if (rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet) rs, r.getURI())) { commonViewer.getControl().getDisplay().syncExec(new Runnable() { + @Override public void run() { commonViewer.expandToLevel(new ReferencableMatchingItem(rs), 1); commonViewer.expandToLevel(new ReferencableMatchingItem(resource), 1); @@ -1034,6 +1044,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti commonViewer.getControl().getDisplay().syncExec(new Runnable() { + @Override public void run() { commonViewer.expandToLevel(itemToExpand, 1); } @@ -1046,6 +1057,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti commonViewer.getControl().getDisplay().syncExec(new Runnable() { + @Override public void run() { commonViewer.expandToLevel(itemToExpand, 1); } @@ -1067,6 +1079,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti public static void selectReveal(final ISelection structuredSelection, final Viewer commonViewer) { Display.getDefault().syncExec(new Runnable() { + @Override public void run() { commonViewer.setSelection(structuredSelection, true); } @@ -1088,6 +1101,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti } else { viewer.getControl().getDisplay().syncExec(new Runnable() { + @Override public void run() { viewer.setSelection(selection); } @@ -1095,10 +1109,12 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti } } + @Override public void pageOpened(IPage page) { refreshTree(); } + @Override public void pageClosed(IPage page) { refreshTree(); } @@ -1106,6 +1122,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private void refreshTree() { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { if (getCommonViewer().getControl() == null || getCommonViewer().getControl().isDisposed()) { return; @@ -1117,22 +1134,27 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }); } + @Override public void pageChanged(IPage newPage) { // Nothing } + @Override public void pageActivated(IPage page) { // Nothing } + @Override public void pageDeactivated(IPage page) { // Nothing } + @Override public void pageAboutToBeOpened(IPage page) { // Nothing } + @Override public void pageAboutToBeClosed(IPage page) { // Nothing } @@ -1140,6 +1162,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private IReadOnlyListener createReadOnlyListener() { return new IReadOnlyListener() { + @Override public void readOnlyStateChanged(ReadOnlyEvent event) { switch (event.getEventType()) { case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED: @@ -1200,6 +1223,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private volatile Runnable contentUpdate; + @Override public void sharedStateChanged(StateChangedEvent event) { switch (event.getEventType()) { case StateChangedEvent.LINKING_ENABLED: @@ -1220,6 +1244,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti if (contentUpdate == null) { contentUpdate = new Runnable() { + @Override public void run() { CommonViewer viewer = getCommonViewer(); if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java index 748a08b4436..810bb9389a5 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java @@ -28,7 +28,7 @@ import org.eclipse.jface.action.Separator; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.infra.core.utils.EditorUtils; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.views.modelexplorer.factory.IActionHandlerFactory; import org.eclipse.ui.IActionBars; import org.eclipse.ui.navigator.CommonNavigator; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/OpenWithMenu.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/OpenWithMenu.java index 6d83f81aac4..6566708136c 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/OpenWithMenu.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/OpenWithMenu.java @@ -20,9 +20,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.action.ContributionItem; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelManager; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java index e628c202ebd..58843573b46 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview; import org.eclipse.core.runtime.CoreException; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.views.modelexplorer.Activator; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewPart; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java index 08645f83cc3..3ee852677e6 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010-2014 CEA LIST. - * + * Copyright (c) 2010, 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 @@ -11,6 +10,8 @@ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Céline Janssens (ALL4TEC) Celine.Janssens@all4tec.net - Bug 420593 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 447025 + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.dnd; @@ -48,6 +49,7 @@ import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -448,7 +450,7 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD */ private List getEditors(EObject context) { try { - return ServiceUtilsForEObject.getInstance().getIPageManager(context).allPages(); + return ServiceUtilsForEObject.getInstance().getService(IPageManager.class, context).allPages(); } catch (ServiceException ex) { return Collections.emptyList(); } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java index cdc02e5420c..674a6d23703 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java @@ -25,10 +25,10 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.ui.handlers.HandlerUtil; /** @@ -48,7 +48,7 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { protected TransactionalEditingDomain getEditingDomain() { TransactionalEditingDomain editingDomain = null; try { - editingDomain = org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain(); + editingDomain = org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain(); } catch (ServiceException e) { // we are closing the editor, so the model explorer has nothing to display // e.printStackTrace(); diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java index 396afa0cc23..f1aecd3601a 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java index 2de12e791ce..eb7a9dbc318 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2014 CEA LIST and others. - * + * Copyright (c) 2010, 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 @@ -11,6 +10,7 @@ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr _ Bug 436952 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec - Bug 436952 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.handler; @@ -27,7 +27,7 @@ import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -79,7 +79,7 @@ public class DeleteCommandHandler extends AbstractCommandHandler implements IHan */ protected static boolean isPage(EObject current) { try { - IPageManager pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(current); + IPageManager pageManager = ServiceUtilsForEObject.getInstance().getService(IPageManager.class, current); if (pageManager.allPages().contains(current)) { return true; } @@ -95,10 +95,10 @@ public class DeleteCommandHandler extends AbstractCommandHandler implements IHan * Build the delete command for a set of EObject selected in the ModelExplorer. * The delete command is given by the {@link IElementEditService} of selected * elements. - * @param selectedElements elements to delete - * @return the composite deletion command for current selection + * @param selectedElements elements to delete + * @return the composite deletion command for current selection * - * @TODO : Manage possible Diagrams listed in the selection + * @TODO : Manage possible Diagrams listed in the selection * * */ diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java index 07885c4d5ce..d45b9051c64 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * + * Copyright (c) 2010, 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 @@ -9,6 +8,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.handler; @@ -40,7 +40,7 @@ import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCal import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -80,6 +80,7 @@ public class LoadBrowserCustomization extends AbstractHandler { /** * {@inheritDoc} */ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { if (Activator.getDefault().getCustomizationManager() != null) { @@ -92,11 +93,13 @@ public class LoadBrowserCustomization extends AbstractHandler { Shell shell = HandlerUtil.getActiveShell(event); IDialogCallbackWithPreCommit, Boolean, Dialog> dialogCallBack = new IDialogCallbackWithPreCommit, Boolean, Dialog>() { + @Override public void committed(List result, Boolean precommitResult) { // TODO Auto-generated method stub } + @Override public Dialog openPrecommitDialog(List result, IDialogCallback precommitCallback) { // TODO Auto-generated method stub return null; @@ -239,12 +242,12 @@ public class LoadBrowserCustomization extends AbstractHandler { // } catch (Exception e) { // Activator.log.error(e); // } - // return ""; //$NON-NLS-1$ + // return ""; //$NON-NLS-1$ // } /** * Get the metmodel URI - * **/ + **/ protected List getMetamodels(ServicesRegistry serviceRegistry) { List ePackages = new ArrayList(); @@ -254,7 +257,7 @@ public class LoadBrowserCustomization extends AbstractHandler { */ IPageManager pageMngr = null; try { - pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + pageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry); List pages = pageMngr.allPages(); for (int i = 0; i < pages.size(); i++) { if (pages.get(i) instanceof EObject) { diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java index 7209c3c30d7..726b957edb7 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java index 3b2f5c0b1c4..32601727417 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2014 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 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 @@ -9,6 +9,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Christian W. Damus - bug 450235 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.listener; @@ -23,8 +24,8 @@ import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; @@ -45,7 +46,8 @@ public class DoubleClickListener implements IDoubleClickListener { /** * Initializes me with a fixed service registry. * - * @param servicesRegistry a service registry + * @param servicesRegistry + * a service registry * * @deprecated The editor that the Model Explorer views can change dynamically, replacing its service registry. Use the {@link #DoubleClickListener(Supplier)} constructor instead to account for the variability of the registry. */ @@ -57,7 +59,8 @@ public class DoubleClickListener implements IDoubleClickListener { /** * Initializes me with a variable service registry. * - * @param servicesRegistrySupplier a supplier of a dynamically variable service registry + * @param servicesRegistrySupplier + * a supplier of a dynamically variable service registry */ public DoubleClickListener(Supplier servicesRegistrySupplier) { this.servicesRegistry = servicesRegistrySupplier; @@ -68,12 +71,13 @@ public class DoubleClickListener implements IDoubleClickListener { * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) * */ + @Override public void doubleClick(DoubleClickEvent event) { ISelection selection = event.getSelection(); final IPageManager pageManager; // get the page Manager try { - pageManager = ServiceUtils.getInstance().getIPageManager(servicesRegistry.get()); + pageManager = ServiceUtils.getInstance().getService(IPageManager.class, servicesRegistry.get()); } catch (Exception e) { Activator.log.error(Messages.DoubleClickListener_Error_NoLoadManagerToOpen, e); return; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java index d83150b6375..f4bee137ce2 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2011, 2014 CEA LIST and others. - * + * Copyright (c) 2011, 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 @@ -10,6 +9,7 @@ * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 408491 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.provider; @@ -23,8 +23,8 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection; @@ -66,6 +66,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester * @param expectedValue * @return */ + @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (IS_EOBJECT.equals(property) && receiver instanceof IStructuredSelection) { boolean answer = isObject((IStructuredSelection) receiver); @@ -124,14 +125,14 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester * Returns the page manager * * @return - * the page manager + * the page manager */ protected IPageManager getPageManager(IStructuredSelection selection) { IPageManager pageMngr = null; try { ServiceUtilsForSelection instance = ServiceUtilsForSelection.getInstance(); if (instance != null) { - pageMngr = instance.getIPageManager(selection); + pageMngr = instance.getService(IPageManager.class, selection); } } catch (NullPointerException npe) { // We cannot find the page manager. Just return null. diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java index 5170de1cdbd..48ce8f89fae 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java @@ -15,11 +15,11 @@ package org.eclipse.papyrus.views.modelexplorer.queries; import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry; -import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended; -import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistry; +import org.eclipse.papyrus.infra.ui.editorsfactory.IPageIconsRegistryExtended; +import org.eclipse.papyrus.infra.ui.editorsfactory.PageIconsRegistry; /** * diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java index 285eab5d568..803d05f8072 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013 CEA LIST. + * Copyright (c) 2013, 2016 CEA LIST 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,8 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.queries; @@ -16,7 +18,7 @@ import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -24,9 +26,10 @@ import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; public class IsOpenedPage implements IJavaQuery2 { + @Override public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException { try { - IPageManager pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(source); + IPageManager pageManager = ServiceUtilsForEObject.getInstance().getService(IPageManager.class, source); return pageManager.isOpen(source); } catch (ServiceException ex) { // Ignore diff --git a/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF b/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF index 1378d5f30ad..4c0b72f2e9d 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF +++ b/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0", org.eclipse.ui.ide, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.openelement;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.openelement;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %vendorName Bundle-Version: 1.2.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java index 06e40cf7fe7..5b5a0e85c58 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java @@ -25,12 +25,12 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServiceMultiException; import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; 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.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl; import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService; import org.eclipse.papyrus.infra.services.openelement.service.impl.OpenElementServiceImpl; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; import org.eclipse.papyrus.views.search.Activator; import org.eclipse.papyrus.views.search.Messages; import org.eclipse.papyrus.views.search.utils.IServiceRegistryTracker; diff --git a/plugins/views/validation/org.eclipse.papyrus.views.validation/META-INF/MANIFEST.MF b/plugins/views/validation/org.eclipse.papyrus.views.validation/META-INF/MANIFEST.MF index 3440cf75631..9a0f80ff1c2 100644 --- a/plugins/views/validation/org.eclipse.papyrus.views.validation/META-INF/MANIFEST.MF +++ b/plugins/views/validation/org.eclipse.papyrus.views.validation/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", com.google.guava;bundle-version="11.0.0", org.eclipse.ui.ide;bundle-version="3.10.100", - org.eclipse.core.expressions;bundle-version="3.4.600" + org.eclipse.core.expressions;bundle-version="3.4.600", + 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/plugins/views/validation/org.eclipse.papyrus.views.validation/src/org/eclipse/papyrus/views/validation/internal/ModelValidationView.java b/plugins/views/validation/org.eclipse.papyrus.views.validation/src/org/eclipse/papyrus/views/validation/internal/ModelValidationView.java index 88ff665bb60..fb6317f127d 100644 --- a/plugins/views/validation/org.eclipse.papyrus.views.validation/src/org/eclipse/papyrus/views/validation/internal/ModelValidationView.java +++ b/plugins/views/validation/org.eclipse.papyrus.views.validation/src/org/eclipse/papyrus/views/validation/internal/ModelValidationView.java @@ -11,9 +11,9 @@ *****************************************************************************/ package org.eclipse.papyrus.views.validation.internal; -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.ui.editor.IMultiDiagramEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; diff --git a/releng/main-tests/pom.xml b/releng/main-tests/pom.xml index e83b771ec95..de5005fb6fa 100644 --- a/releng/main-tests/pom.xml +++ b/releng/main-tests/pom.xml @@ -41,6 +41,7 @@ ../../tests/junit/plugins/customization/org.eclipse.papyrus.customization.properties.tests ../../tests/junit/plugins/infra/org.eclipse.papyrus.infra.filters.tests ../../tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests + ../../tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests ../../tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests ../../tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests ../../tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests diff --git a/releng/main/pom.xml b/releng/main/pom.xml index b4380de5641..42be8632e13 100755 --- a/releng/main/pom.xml +++ b/releng/main/pom.xml @@ -110,6 +110,7 @@ ../../plugins/infra/core/org.eclipse.papyrus.infra.core.pluginexplorer ../../plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor ../../plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di + ../../plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di ../../plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome ../../plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.nattable ../../plugins/infra/discovery/org.eclipse.papyrus.infra.discovery @@ -149,6 +150,7 @@ ../../plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd + ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink ../../plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu 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; diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/META-INF/MANIFEST.MF index dcb426e75f1..ad238dde17c 100644 --- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/META-INF/MANIFEST.MF +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/META-INF/MANIFEST.MF @@ -2,12 +2,9 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.cdo.core;bundle-version="1.2.0";visibility:=reexport, org.junit;bundle-version="4.11.0";visibility:=reexport, org.eclipse.uml2.uml;bundle-version="4.0.0";visibility:=reexport, - org.eclipse.emf.cdo.server.net4j;bundle-version="[4.1.0, - 5.0.0)", - org.eclipse.emf.cdo.net4j;bundle-version="[4.1.0, - 5.0.0)", - org.eclipse.net4j.jvm;bundle-version="[4.1.0, - 5.0.0)", + org.eclipse.emf.cdo.server.net4j;bundle-version="[4.1.0,5.0.0)", + org.eclipse.emf.cdo.net4j;bundle-version="[4.1.0,5.0.0)", + org.eclipse.net4j.jvm;bundle-version="[4.1.0,5.0.0)", org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.core.expressions;bundle-version="3.4.0", @@ -15,7 +12,8 @@ Require-Bundle: org.eclipse.papyrus.cdo.core;bundle-version="1.2.0";visibility:= org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.resourceloading.preferences;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0";visibility:=reexport, - org.eclipse.papyrus.junit.framework;bundle-version="1.2.0" + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.cdo.core.resource.tests, org.eclipse.papyrus.cdo.core.tests, org.eclipse.papyrus.cdo.core.util.tests, diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF index 5e788299afa..6e56d99de51 100644 --- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF @@ -1,20 +1,15 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.core.runtime, - org.eclipse.ui.ide;bundle-version="[3.8.0, - 4.0.0)", + org.eclipse.ui.ide;bundle-version="[3.8.0,4.0.0)", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.ui.workbench, org.eclipse.papyrus.cdo.core;bundle-version="1.2.0", - org.eclipse.emf.cdo.ui;bundle-version="[4.2.0, - 5.0.0)", + org.eclipse.emf.cdo.ui;bundle-version="[4.2.0,5.0.0)", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", - org.eclipse.emf.cdo.dawn;bundle-version="[2.0.0, - 3.0.0)", - org.eclipse.emf.cdo.dawn.gmf;bundle-version="[2.1.0, - 3.0.0)", - org.eclipse.emf.cdo.dawn.ui;bundle-version="[2.0.0, - 3.0.0)", + org.eclipse.emf.cdo.dawn;bundle-version="[2.0.0,3.0.0)", + org.eclipse.emf.cdo.dawn.gmf;bundle-version="[2.1.0,3.0.0)", + org.eclipse.emf.cdo.dawn.ui;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.cdo.core.tests;bundle-version="1.2.0", org.eclipse.papyrus.cdo.ui;bundle-version="1.2.0", @@ -24,7 +19,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.cdo.validation.problems.edit;bundle-version="1.2.0", org.eclipse.emf.cdo.server.ocl;bundle-version="4.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", - org.eclipse.papyrus.junit.framework;bundle-version="1.2.0" + org.eclipse.papyrus.junit.framework;bundle-version="1.2.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.cdo.internal.ui.editors.tests;x-internal:=true, org.eclipse.papyrus.cdo.internal.ui.markers.tests;x-internal:=true, org.eclipse.papyrus.cdo.internal.ui.views.tests;x-internal:=true, diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AbstractPapyrusCDOUITest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AbstractPapyrusCDOUITest.java index 798f2f595b6..2e36b84f9e0 100644 --- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AbstractPapyrusCDOUITest.java +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AbstractPapyrusCDOUITest.java @@ -44,8 +44,8 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.cdo.core.tests.AbstractPapyrusCDOTest; import org.eclipse.papyrus.cdo.internal.ui.editors.PapyrusCDOEditorManager; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPerspectiveDescriptor; @@ -87,7 +87,7 @@ public abstract class AbstractPapyrusCDOUITest extends AbstractPapyrusCDOTest { private DiagramDocumentEditor lastDiagramEditor; @SuppressWarnings("restriction") - private org.eclipse.papyrus.infra.core.internal.preferences.YesNo initialSashStoragePreference; + private org.eclipse.papyrus.infra.ui.internal.preferences.YesNo initialSashStoragePreference; public AbstractPapyrusCDOUITest() { super(); @@ -147,8 +147,8 @@ public abstract class AbstractPapyrusCDOUITest extends AbstractPapyrusCDOTest { @SuppressWarnings("restriction") @Before public void suppressSashLayoutMigrationDialog() { - initialSashStoragePreference = org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); - org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(org.eclipse.papyrus.infra.core.internal.preferences.YesNo.NO); + initialSashStoragePreference = org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); + org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(org.eclipse.papyrus.infra.ui.internal.preferences.YesNo.NO); } @After @@ -176,7 +176,7 @@ public abstract class AbstractPapyrusCDOUITest extends AbstractPapyrusCDOTest { @SuppressWarnings("restriction") @After public void restoreSashLayoutMigrationDialog() { - org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(initialSashStoragePreference); + org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(initialSashStoragePreference); } private void importResource(CDOTransaction transaction, String srcPath, String dstPath, Map importMap) { diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui.tests/META-INF/MANIFEST.MF index 084f3a19dda..afa8396f8c3 100644 --- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui.tests/META-INF/MANIFEST.MF +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui.tests/META-INF/MANIFEST.MF @@ -8,7 +8,8 @@ Require-Bundle: org.junit;bundle-version="4.10.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.papyrus.cdo.ui;bundle-version="1.2.0", org.eclipse.emf.cdo.server.ocl;bundle-version="4.2.0", - org.eclipse.papyrus.junit.framework;bundle-version="1.2.0" + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.cdo.uml.internal.ui.importsources.tests;x-internal:=true, org.eclipse.papyrus.cdo.uml.ui.tests Bundle-Vendor: %providerName diff --git a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/META-INF/MANIFEST.MF index 78819fb80ee..e1c45076502 100644 --- a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/META-INF/MANIFEST.MF +++ b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/META-INF/MANIFEST.MF @@ -16,7 +16,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.cdt.core, org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.cpp.codegen.tests Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy diff --git a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/src/org/eclipse/papyrus/cpp/codegen/tests/CppCodegenTest.java b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/src/org/eclipse/papyrus/cpp/codegen/tests/CppCodegenTest.java index cf8ca0f8519..7e859312bec 100644 --- a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/src/org/eclipse/papyrus/cpp/codegen/tests/CppCodegenTest.java +++ b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/src/org/eclipse/papyrus/cpp/codegen/tests/CppCodegenTest.java @@ -26,10 +26,10 @@ import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.papyrus.uml.tools.model.UmlUtils; diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF index 127e716d1ce..c8ff1195bdf 100644 --- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF @@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.gef, org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0", - org.eclipse.papyrus.junit.framework;bundle-version="1.2.0" + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.migration.rsa.tests, org.eclipse.papyrus.migration.rsa.tests.qvt Bundle-Vendor: Eclipse Modeling Project diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java index 601a4dadb4a..dd82013060d 100644 --- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java @@ -22,9 +22,9 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.Config; diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java index 34f36115df9..13253211d23 100644 --- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java @@ -35,7 +35,6 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelMultiException; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelsReader; @@ -43,6 +42,7 @@ import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.FilesUtils; diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/META-INF/MANIFEST.MF index e609c893741..b6554d65507 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/META-INF/MANIFEST.MF @@ -31,7 +31,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.uml.diagram.sequence;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.editor.integration.tests, org.eclipse.papyrus.editor.integration.tests.tests Bundle-Vendor: Eclipse Modeling Project diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditorReloadTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditorReloadTest.java index b857574e390..cd443491697 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditorReloadTest.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditorReloadTest.java @@ -45,7 +45,6 @@ import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.IService; @@ -53,6 +52,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.ExpensiveTest; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.Duck; diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java index 4de36203f18..f4ffc871dd0 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java @@ -17,13 +17,13 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.papyrus.commands.ICreationCommand; import org.eclipse.papyrus.editor.integration.tests.Activator; -import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.DiResourceSet; +import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand; import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor; @@ -64,7 +64,7 @@ public class ModelSetTests extends AbstractEditorIntegrationTest { emptyModelCreationProject.create(new NullProgressMonitor()); emptyModelCreationProject.open(new NullProgressMonitor()); - String modelName = "++nëw môdèl & spécîâl chàr$++"; + String modelName = "++n�w m�d�l & sp�c��l ch�r$++"; final IFile emptyModelDi = emptyModelCreationProject.getFile(modelName + ".di"); diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java index 95881d857fb..6371f14123e 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013, 2014 CEA LIST and others. + * 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 @@ -9,6 +9,7 @@ * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 433371 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.editor.integration.tests.tests; @@ -38,11 +39,10 @@ import org.eclipse.papyrus.commands.ICreationCommand; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.editor.integration.tests.Activator; -import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; 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.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; @@ -50,6 +50,7 @@ import org.eclipse.papyrus.infra.core.utils.DiResourceSet; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand; import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor; @@ -97,17 +98,17 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { registry.add(ModelSet.class, Integer.MAX_VALUE, modelSet); registry.startRegistry(); } catch (ServiceException ex) { - //Ignore + // Ignore } IModelCreationCommand creationCommand = new CreateUMLModelCommand(); creationCommand.createModel(modelSet); - //Create the root UML Model - UmlModel umlModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID); - Model model = (Model)umlModel.lookupRoot(); + // Create the root UML Model + UmlModel umlModel = (UmlModel) modelSet.getModel(UmlModel.MODEL_ID); + Model model = (Model) umlModel.lookupRoot(); - //Creates and opens a Papyrus Class Diagram + // Creates and opens a Papyrus Class Diagram ICreationCommand diagramCreationCommand = new CreateClassDiagramCommand(); diagramCreationCommand.createDiagram(modelSet, model, "TestDiagram1"); @@ -135,7 +136,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { try { registry.disposeRegistry(); } catch (ServiceException ex) { - //Ignore + // Ignore } } @@ -192,7 +193,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { ModelSet modelSet = editor.getServicesRegistry().getService(ModelSet.class); Assert.assertNotNull("Cannot retrieve the ModelSet", modelSet); - UmlModel umlModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID); + UmlModel umlModel = (UmlModel) modelSet.getModel(UmlModel.MODEL_ID); Assert.assertNotNull("Cannot retrieve the UML Model", umlModel); EObject rootEObject = umlModel.lookupRoot(); @@ -212,12 +213,12 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); Assert.assertEquals(2, pageManager.allPages().size()); - Assert.assertTrue(editor.getActiveEditor() instanceof UmlClassDiagramForMultiEditor); //TODO: The PageManager doesn't provide the getActivePage() method + Assert.assertTrue(editor.getActiveEditor() instanceof UmlClassDiagramForMultiEditor); // TODO: The PageManager doesn't provide the getActivePage() method Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource(); - Diagram classDiagram = (Diagram)notationResource.getContents().get(0); - Diagram timingDiagram = (Diagram)notationResource.getContents().get(1); + Diagram classDiagram = (Diagram) notationResource.getContents().get(0); + Diagram timingDiagram = (Diagram) notationResource.getContents().get(1); TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, timingDiagram))); @@ -228,8 +229,8 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { ISashWindowsContainer container = editor.getServicesRegistry().getService(ISashWindowsContainer.class); IPage selectedPage = container.getActiveSashWindowsPage(); - //FIXME: Does not work yet. See Bug 401107: [IPageManager] selectPage does not work - //TODO: There should be a specific test for selectPage, with a basic and a complex model + // FIXME: Does not work yet. See Bug 401107: [IPageManager] selectPage does not work + // TODO: There should be a specific test for selectPage, with a basic and a complex model pageManager.selectPage(classDiagram); Assert.assertTrue("Couldn't change the page selection", editor.getActiveEditor() instanceof UmlClassDiagramForMultiEditor); @@ -244,44 +245,44 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { @Test @Ignore("new papyrus table are not yet in the main build") public void testAvailableAndActivePageWithNatTable() throws Exception { - // initModel("availableAndActivePage2", "two_tables_model"); - // IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - // Assert.assertEquals(2, pageManager.allPages().size()); - // IEditorPart tableEditor = editor.getActiveEditor(); - // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method - // INattableModelManager manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); - // Assert.assertNotNull(manager); - // Assert.assertEquals("PapyrusGenericTable", manager.getTable().getTableConfiguration().getType()); + // initModel("availableAndActivePage2", "two_tables_model"); + // IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); + // Assert.assertEquals(2, pageManager.allPages().size()); + // IEditorPart tableEditor = editor.getActiveEditor(); + // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method + // INattableModelManager manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); + // Assert.assertNotNull(manager); + // Assert.assertEquals("PapyrusGenericTable", manager.getTable().getTableConfiguration().getType()); // - // Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource(); + // Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource(); // - // Table genericTable = (Table)notationResource.getContents().get(0); - // Table tableOfViews = (Table)notationResource.getContents().get(1); + // Table genericTable = (Table)notationResource.getContents().get(0); + // Table tableOfViews = (Table)notationResource.getContents().get(1); // - // TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); - // editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, tableOfViews))); - // tableEditor = editor.getActiveEditor(); - // Assert.assertTrue(tableEditor instanceof NatTableEditor); - // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); - // Assert.assertNotNull(manager); - // Assert.assertEquals("PapyrusViewsTable", manager.getTable().getTableConfiguration().getType()); + // TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); + // editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, tableOfViews))); + // tableEditor = editor.getActiveEditor(); + // Assert.assertTrue(tableEditor instanceof NatTableEditor); + // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); + // Assert.assertNotNull(manager); + // Assert.assertEquals("PapyrusViewsTable", manager.getTable().getTableConfiguration().getType()); // - // //FIXME: Does not work yet. See Bug 401107: [IPageManager] selectPage does not work - // //TODO: There should be a specific test for selectPage, with a basic and a complex model - // pageManager.selectPage(genericTable); - // tableEditor = editor.getActiveEditor(); - // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method - // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); - // Assert.assertNotNull(manager); - // Assert.assertEquals("Couldn't change the page selection", "PapyrusGenericTable", manager.getTable().getTableConfiguration().getType()); + // //FIXME: Does not work yet. See Bug 401107: [IPageManager] selectPage does not work + // //TODO: There should be a specific test for selectPage, with a basic and a complex model + // pageManager.selectPage(genericTable); + // tableEditor = editor.getActiveEditor(); + // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method + // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); + // Assert.assertNotNull(manager); + // Assert.assertEquals("Couldn't change the page selection", "PapyrusGenericTable", manager.getTable().getTableConfiguration().getType()); // // - // pageManager.selectPage(tableOfViews); - // tableEditor = editor.getActiveEditor(); - // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method - // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); - // Assert.assertNotNull(manager); - // Assert.assertEquals("Couldn't change the page selection", "PapyrusViewsTable", manager.getTable().getTableConfiguration().getType()); + // pageManager.selectPage(tableOfViews); + // tableEditor = editor.getActiveEditor(); + // Assert.assertTrue(tableEditor instanceof NatTableEditor); //TODO: The PageManager doesn't provide the getActivePage() method + // manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class); + // Assert.assertNotNull(manager); + // Assert.assertEquals("Couldn't change the page selection", "PapyrusViewsTable", manager.getTable().getTableConfiguration().getType()); } @Test @@ -304,7 +305,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { public void testDiagramDeletion() throws Exception { initModel("diagramDeletion", "simple_class_model", getBundle()); ModelSet modelSet = getModelSet(); - final Diagram diagram = (Diagram)NotationUtils.getNotationModel(modelSet).getResource().getContents().get(0); + final Diagram diagram = (Diagram) NotationUtils.getNotationModel(modelSet).getResource().getContents().get(0); testPageDeletion(diagram, UmlClassDiagramForMultiEditor.class); } @@ -312,7 +313,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { public void testDiagramIndirectDeletion_bug433371() throws Exception { initModel("bug433371", "delete_sash_page", getBundle()); ModelSet modelSet = getModelSet(); - final Diagram diagram = (Diagram)NotationUtils.getNotationModel(modelSet).getResource().getContents().get(1); + final Diagram diagram = (Diagram) NotationUtils.getNotationModel(modelSet).getResource().getContents().get(1); IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); pageManager.selectPage(diagram); // Make sure the one we want deleted is active @@ -327,15 +328,15 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { @Test @Ignore("new papyrus table are not yet in the main build") public void testNatTableDeletion() throws Exception { - // initModel("tableDeletion", "simple_uml_generic_table_model"); - // ModelSet modelSet = getModelSet(); - // final Table diagram = (Table)NotationUtils.getNotationModel(modelSet).getResource().getContents().get(0); - // testPageDeletion(diagram, NatTableEditor.class); + // initModel("tableDeletion", "simple_uml_generic_table_model"); + // ModelSet modelSet = getModelSet(); + // final Table diagram = (Table)NotationUtils.getNotationModel(modelSet).getResource().getContents().get(0); + // testPageDeletion(diagram, NatTableEditor.class); } - //Does not work. The table creation produces two executable commands (Create Table Editor and Identity) - //Only Identity (which does nothing) is undoable. Undoing the table creation does nothing - //This is an EMF Facet Table bug, which tries to delete columns for an empty table as soon as the table is created + // Does not work. The table creation produces two executable commands (Create Table Editor and Identity) + // Only Identity (which does nothing) is undoable. Undoing the table creation does nothing + // This is an EMF Facet Table bug, which tries to delete columns for an empty table as soon as the table is created @Test public void testTableCreation() throws Exception { initModel("tableCreation", "empty_model", getBundle()); @@ -353,7 +354,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { private void testPageCreation(ICommand creationCommand, Class expectedEditorClass) throws Exception { IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - //Check initial state + // Check initial state Assert.assertTrue(pageManager.allPages().isEmpty()); Assert.assertNull(editor.getActiveEditor()); @@ -361,7 +362,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(creationCommand)); - for(int i = 0; i < 3; i++) { //Undo/Redo 3 times + for (int i = 0; i < 3; i++) { // Undo/Redo 3 times Assert.assertEquals("The page has not been correctly created", 1, pageManager.allPages().size()); Assert.assertTrue("The editor has not been correctly opened", expectedEditorClass.isInstance(editor.getActiveEditor())); @@ -377,7 +378,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { private void testPageDeletion(final EObject page, Class expectedEditorClass) throws Exception { final IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - //Check initial state + // Check initial state Assert.assertFalse(pageManager.allPages().isEmpty()); int initialPagesSize = pageManager.allPages().size(); @@ -391,7 +392,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { @Override protected void doExecute() { - pageManager.removePage(page); + pageManager.closeAllOpenedPages(page); } }; @@ -401,7 +402,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { editingDomain.getCommandStack().execute(command); - for(int i = 0; i < 3; i++) { //Undo/Redo 3 times + for (int i = 0; i < 3; i++) { // Undo/Redo 3 times Assert.assertNull("The editor should be closed", editor.getActiveEditor()); Assert.assertEquals("The page has not been correctly deleted", initialPagesSize - 1, pageManager.allPages().size()); @@ -417,7 +418,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { private void testPageDeletion(final EObject elementToDelete, final Object dependentPage, Class expectedEditorClass) throws Exception { final IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - //Check initial state + // Check initial state assertThat("Page not open", pageManager.allPages(), hasItem(dependentPage)); assertThat("Wrong kind of page", editor.getActiveEditor(), instanceOf(expectedEditorClass)); @@ -425,13 +426,13 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); Element clazz = getRootUMLModel().getOwnedType("Class1"); - Behavior toDelete = ((BehavioredClassifier)clazz).getOwnedBehaviors().get(0); + Behavior toDelete = ((BehavioredClassifier) clazz).getOwnedBehaviors().get(0); IElementEditService edit = ElementEditServiceUtils.getCommandProvider(clazz); ICommand command = edit.getEditCommand(new DestroyElementRequest(toDelete, false)); editingDomain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(command)); - for(int i = 0; i < 3; i++) { //Undo/Redo 3 times + for (int i = 0; i < 3; i++) { // Undo/Redo 3 times assertThat("The editor page should be closed", pageManager.allPages(), not(hasItem(dependentPage))); editingDomain.getCommandStack().undo(); @@ -450,7 +451,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { TransactionalEditingDomain editingDomain = getTransactionalEditingDomain(); final int initialSize = pageManager.allPages().size(); - Model model = (Model)UmlUtils.getUmlModel(modelSet).getResource().getContents().get(0); + Model model = (Model) UmlUtils.getUmlModel(modelSet).getResource().getContents().get(0); IElementEditService provider; @@ -464,7 +465,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(destroyFirstElementCommand)); Assert.assertEquals("The page should have been destroyed", initialSize - 1, pageManager.allPages().size()); - //TODO: Test the opened pages too + // TODO: Test the opened pages too } { @@ -502,7 +503,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { TransactionalEditingDomain editingDomain = getTransactionalEditingDomain(); final int initialSize = pageManager.allPages().size(); - Model model = (Model)UmlUtils.getUmlModel(modelSet).lookupRoot(); + Model model = (Model) UmlUtils.getUmlModel(modelSet).lookupRoot(); IElementEditService provider; @@ -516,7 +517,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest { editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(destroyFirstElementCommand)); Assert.assertEquals("The page should have been destroyed", initialSize - 1, pageManager.allPages().size()); - //TODO: Test the opened pages too + // TODO: Test the opened pages too } { diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java index db3221e50e8..d1d039a09d3 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * 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 @@ -8,6 +8,8 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.editor.integration.tests.tests; @@ -20,7 +22,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor; @@ -45,18 +47,18 @@ public class RecoveryTest extends AbstractEditorIntegrationTest { private static final String SOURCE_PATH = "/model/recovery/"; - //Should work + // Should work @Test public void testInvalidAvailablePage() throws Exception { initModel("invalidAvailablePage", "invalidAvailablePage", getBundle()); Assert.assertTrue(editor.getActiveEditor() instanceof UmlClassDiagramForMultiEditor); - //IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class); - //Is the page manager supposed to filter the invalid pages..? - //Assert.assertEquals(2, manager.allPages().size()); + // IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class); + // Is the page manager supposed to filter the invalid pages..? + // Assert.assertEquals(2, manager.allPages().size()); } - //Should work - //Bug 401109: [PageManager] Deleting an element which contains an opened page leads to critical model corruption + // Should work + // Bug 401109: [PageManager] Deleting an element which contains an opened page leads to critical model corruption @Test public void testInvalidTab() throws Exception { initModel("invalidTab", "invalid_child_tab", getBundle()); @@ -65,32 +67,32 @@ public class RecoveryTest extends AbstractEditorIntegrationTest { } @Ignore("Recovery not supported") - //Not fixed yet - //Starts with an empty Di Model (All the contents have been erased, except the root xmi tag) - //We should be able to open a Papyrus editor and manipulate the PageManager + // Not fixed yet + // Starts with an empty Di Model (All the contents have been erased, except the root xmi tag) + // We should be able to open a Papyrus editor and manipulate the PageManager @Test public void testEmptyDiModel() throws Exception { initModel("emptyDiModel", "empty_di_model", getBundle()); IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class); Assert.assertEquals(0, manager.allPages().size()); - NotationModel notationModel = (NotationModel)editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID); + NotationModel notationModel = (NotationModel) editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID); Assert.assertEquals(1, notationModel.getResource().getContents().size()); - Diagram diagram = (Diagram)notationModel.getResource().getContents().get(0); + Diagram diagram = (Diagram) notationModel.getResource().getContents().get(0); manager.openPage(diagram); Assert.assertEquals(1, manager.allPages().size()); } - //We should be able to open a page even if is not (yet) in the availablePages list + // We should be able to open a page even if is not (yet) in the availablePages list @Test @Ignore("This test is not required anymore, as the allPages() is computed dynamically (Bug 429239)") public void testUnavailablePageRecovery() throws Exception { initModel("unavailablePageRecovery", "missing_page_recovery", getBundle()); final IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class); int availablePages = manager.allPages().size(); - NotationModel notationModel = (NotationModel)editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID); + NotationModel notationModel = (NotationModel) editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID); Assert.assertEquals("Cannot find the diagram to open", 1, notationModel.getResource().getContents().size()); - final Diagram diagram = (Diagram)notationModel.getResource().getContents().get(0); + final Diagram diagram = (Diagram) notationModel.getResource().getContents().get(0); TransactionalEditingDomain domain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); domain.getCommandStack().execute(new RecordingCommand(domain, "Open diagram") { @@ -104,7 +106,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest { Assert.assertEquals("A new page should be available", availablePages + 1, manager.allPages().size()); } - //Should work. The invalid tab is loaded as an "unresolved tab" and displays a warning. + // Should work. The invalid tab is loaded as an "unresolved tab" and displays a warning. @Test public void testProxyDiagram() throws Exception { initModel("proxyDiagram", "proxy_diagram_recovery", getBundle()); @@ -113,35 +115,35 @@ public class RecoveryTest extends AbstractEditorIntegrationTest { } @Ignore("Disabled because the Papyrus Editor opens a user dialog. Won't run on Hudson.") - //Should work + // Should work /** @see {link #testInvalidTab()} */ @Test public void testProxyTable() throws Exception { initModel("proxyTable", "proxy_table_recovery", getBundle()); - //IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - //Assert.assertEquals(2, pageManager.allPages()); + // IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); + // Assert.assertEquals(2, pageManager.allPages()); } - //This model contains a few different errors (Unresolved proxy, invalid tabs, invalid available pages, ...) + // This model contains a few different errors (Unresolved proxy, invalid tabs, invalid available pages, ...) @Test public void testCompleteCase() throws Exception { initModel("completeCase", "complex_invalid_model", getBundle()); - // IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - // Assert.assertEquals(3, pageManager.allPages().size()); + // IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); + // Assert.assertEquals(3, pageManager.allPages().size()); } - //We should be able to delete a diagram, even when there is an invalid page in the model + // We should be able to delete a diagram, even when there is an invalid page in the model @Test public void testDeleteDiagramWithInvalidAvailablePage() throws Exception { initModel("deleteDiagramWithInvalidPage", "invalidAvailablePage", getBundle()); - //Di layout: Diagram 0 - Invalid page - Diagram 1 - //We take the diagram at index 1 (i.e. after the invalid page) and try to delete it - final Diagram diagram = (Diagram)NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource().getContents().get(1); + // Di layout: Diagram 0 - Invalid page - Diagram 1 + // We take the diagram at index 1 (i.e. after the invalid page) and try to delete it + final Diagram diagram = (Diagram) NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource().getContents().get(1); final IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class); - //Check initial state + // Check initial state int availablePages = pageManager.allPages().size(); TransactionalEditingDomain editingDomain = editor.getServicesRegistry().getService(TransactionalEditingDomain.class); @@ -152,7 +154,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest { @Override protected void doExecute() { - pageManager.removePage(diagram); + pageManager.closeAllOpenedPages(diagram); } }; diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java new file mode 100644 index 00000000000..0e0479fac06 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java @@ -0,0 +1,487 @@ +/***************************************************************************** + * Copyright (c) 2009, 2016 CEA LIST, LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory; +import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; +import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; +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.impl.TabFolderImpl; +import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.swt.SWT; +import org.junit.Before; +import org.junit.Test; + + +/** + * @author dumoulin + */ +public class PageManagerImplTest extends AbstractPapyrusTest { + + /** + * The {@link PageManagerImpl} under test. + */ + protected PageManagerImpl pageMngr; + + /** + * The associated {@link DiContentProvider}. Not tested, but used to check events. + */ + protected DiContentProvider contentProvider; + + /** + * @see junit.framework.TestCase#setUp() + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr(); + + // Fix bug to match refactoring in Bug 429239. The current implementation computes allPages() dynamically, + // and doesn't support addPage() and removePage() anymore + // Because this test is used in a different context, where allPages() cannot be computed dynamically, + // we need to create a specific setup + diSashModel.setPageList(DiFactory.eINSTANCE.createPageList()); + ContentChangedEventProvider eventProvider = new ContentChangedEventProvider(diSashModel); + pageMngr = new PageManagerImpl(diSashModel, eventProvider) { + @Override + protected boolean isLegacyMode() { + return true; + } + }; + + IPageModelFactory pageModelFactory = new FakePageModelFactory(); + contentProvider = new DiContentProvider(diSashModel.getSashModel(), pageModelFactory, eventProvider); + + } + + /** + * Lookup for a folder in the SashModel. Return the first folder found. + * + * @return + */ + private ITabFolderModel lookupFolderModel() { + if (contentProvider == null) { + return null; + } + + Object rawModel = contentProvider.getRootModel(); + // Create the requested model suitable for the folder. + // It is possible (but not recommended) to create several models for the same object. + // We can avoid this by using a Map of created models. + IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel); + + return lookupFolderModel(panelModel); + } + + /** + * Recursively search in sash models for a FolderModel. + * Return the first encountered folder. + * + * @param panelModel + * @return + */ + private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) { + + if (panelModel instanceof ITabFolderModel) { + return (ITabFolderModel) panelModel; + } else { + ISashPanelModel sashModel = (ISashPanelModel) panelModel; + // Iterate on children + for (Object child : sashModel.getChildren()) { + IAbstractPanelModel childModel = contentProvider.createChildSashModel(child); + ITabFolderModel res = lookupFolderModel(childModel); + if (res != null) { + return res; + } + } + } + // Not found + return null; + } + + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(org.eclipse.emf.ecore.EObject)}. + */ + @Test + public void testAddPage() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.addPage(id); + + // Check no fired events + assertEquals("One event fired", 0, changeListener.getChangeCount()); + } + + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#allPages()}. + */ + @Test + public void testAllPages() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + // Check if pages are in PageList + assertEquals("all pages found", 10, pageMngr.allPages().size()); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closePage(org.eclipse.emf.ecore.EObject)}. + */ + @Test + public void testClosePage() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + + // Close page + changeListener.reset(); + pageMngr.closePage(identifiers.get(3)); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + + // Check page still in pages + assertEquals("all pages still in list", 10, pageMngr.allPages().size()); + + // Check if pages are in SashStructure + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); + assertNull("Page removed from sashStructure ", pageRef); + + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}. + */ + @Test + public void testCloseAllOpenedPages() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + + // Close page + changeListener.reset(); + pageMngr.closeAllOpenedPages(); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + + // Check page still in pages + assertEquals("all pages still in list", 10, pageMngr.allPages().size()); + + // Check if pages are in SashStructure + for (int i = 0; i < 10; i++) { + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i)); + assertNull("Page " + i + " removed from sashStructure ", pageRef); + } + + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}. + */ + @Test + public void testCloseOtherOpenedPages() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + + // Close page + changeListener.reset(); + pageMngr.closeOtherPages(identifiers.get(3)); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + + // Check page still in pages + assertEquals("all pages still in list", 10, pageMngr.allPages().size()); + + // Check if pages are in SashStructure + for (int i = 0; i < 10; i++) { + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i)); + if (i != 3) { + assertNull("Page " + i + " removed from sashStructure ", pageRef); + } else { + assertNotNull("Page " + i + " not removed from sashStructure ", pageRef); + } + } + + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#openPage(org.eclipse.emf.ecore.EObject)}. + */ + @Test + public void testOpenPage() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + + // Check if pages are in SashStructure + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); + assertNotNull("Page exist in sashStructure ", pageRef); + assertSame("found the right page", identifiers.get(3), pageRef.getPageIdentifier()); + + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(org.eclipse.emf.ecore.EObject)}. + */ + @Test + public void testRemovePage() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add 10 folders + for (int i = 0; i < 10; i++) { + // reset change count + changeListener.reset(); + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + } + // Check if pages are in PageList + assertEquals("all pages added", 10, pageMngr.allPages().size()); + // Check if page id is in page list + assertTrue("check page id is added to page list", pageMngr.allPages().contains(identifiers.get(3))); + + // Close page + changeListener.reset(); + pageMngr.removePage(identifiers.get(3)); + + // Check fired events + assertEquals("One event fired", 1, changeListener.getChangeCount()); + + // Check page still in pages + assertEquals("page remove from list", 9, pageMngr.allPages().size()); + + // Check removed from page list + assertFalse("check removed from page list", pageMngr.allPages().contains(identifiers.get(3))); + + // Check if pages are in SashStructure + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); + assertNull("Page removed from sashStructure ", pageRef); + } + + /** + * Check if closing the last page in a second tabfolder work propoerly. + * Create 3 editors, move one in a new folder, then remove the moved one. + * The new folder should automatically be removed. + * + */ + @Test + public void testCloseLastPageOfTabFolder() { + // A listener on change event. + ContentChangeListener changeListener = new ContentChangeListener(); + + // Set change listener + contentProvider.getContentChangedEventProvider().addListener(changeListener); + + // Create 3 editors, move one in another table + // Then remove the moved one. + + // Add identifiers + // Use Object as identifiers. + List identifiers = new ArrayList(); + // Add pages + int pageCount = 3; + for (int i = 0; i < pageCount; i++) { + // Add Editor + Object id = new Object(); + identifiers.add(id); + pageMngr.openPage(id); + } + // Check if pages are in PageList + assertEquals("all pages added", pageCount, pageMngr.allPages().size()); + + + // Move the last page + int movedPageIndex = 0; + ITabFolderModel tabFolder = lookupFolderModel(); + assertTrue("Moved page index is valid", movedPageIndex < pageCount); + + contentProvider.createFolder(tabFolder, movedPageIndex, tabFolder, SWT.TOP); + // check if the folder is created + // List folders = getAllFolders(contentProvider.getDiSashModel()); + // assertEquals("additional folder is removed", 2, folders.size()); + + // Close page + pageMngr.closePage(identifiers.get(movedPageIndex)); + + // Check the resulting model: we should have one folder with two page. + // folders = getAllFolders(contentProvider.getDiSashModel()); + // assertEquals("additional folder is removed", 1, folders.size()); + + List children = contentProvider.getDiSashModel().getWindows().get(0).getChildren(); + assertEquals("Windows has one child", 1, children.size()); + assertEquals("Windows child is the tabfolder", TabFolderImpl.class, children.get(0).getClass()); + + // Check if pages are in SashStructure + PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(movedPageIndex)); + assertNull("Page removed from sashStructure ", pageRef); + + } + + + +} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java deleted file mode 100644 index c0b4841b4ea..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java +++ /dev/null @@ -1,482 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 CEA LIST & LIFL - * - * - * 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: - * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory; -import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel; -import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory; -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.impl.TabFolderImpl; -import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; -import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; -import org.eclipse.swt.SWT; -import org.junit.Before; -import org.junit.Test; - - -/** - * @author dumoulin - */ -public class PageMngrImplTest extends AbstractPapyrusTest { - - /** - * The {@link PageMngrImpl} under test. - */ - protected PageMngrImpl pageMngr; - - /** - * The associated {@link DiContentProvider}. Not tested, but used to check events. - */ - protected DiContentProvider contentProvider; - - /** - * @see junit.framework.TestCase#setUp() - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr(); - - //Fix bug to match refactoring in Bug 429239. The current implementation computes allPages() dynamically, - //and doesn't support addPage() and removePage() anymore - //Because this test is used in a different context, where allPages() cannot be computed dynamically, - //we need to create a specific setup - diSashModel.setPageList(DiFactory.eINSTANCE.createPageList()); - ContentChangedEventProvider eventProvider = new ContentChangedEventProvider(diSashModel); - pageMngr = new PageMngrImpl(diSashModel, eventProvider); - - IPageModelFactory pageModelFactory = new FakePageModelFactory(); - contentProvider = new DiContentProvider(diSashModel.getSashModel(), pageModelFactory, eventProvider); - - } - - /** - * Lookup for a folder in the SashModel. Return the first folder found. - * - * @return - */ - private ITabFolderModel lookupFolderModel() { - if(contentProvider == null) { - return null; - } - - Object rawModel = contentProvider.getRootModel(); - // Create the requested model suitable for the folder. - // It is possible (but not recommended) to create several models for the same object. - // We can avoid this by using a Map of created models. - IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel); - - return lookupFolderModel(panelModel); - } - - /** - * Recursively search in sash models for a FolderModel. - * Return the first encountered folder. - * - * @param panelModel - * @return - */ - private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) { - - if(panelModel instanceof ITabFolderModel) { - return (ITabFolderModel)panelModel; - } else { - ISashPanelModel sashModel = (ISashPanelModel)panelModel; - // Iterate on children - for(Object child : sashModel.getChildren()) { - IAbstractPanelModel childModel = contentProvider.createChildSashModel(child); - ITabFolderModel res = lookupFolderModel(childModel); - if(res != null) { - return res; - } - } - } - // Not found - return null; - } - - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(org.eclipse.emf.ecore.EObject)}. - */ - @Test - public void testAddPage() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.addPage(id); - - // Check no fired events - assertEquals("One event fired", 0, changeListener.getChangeCount()); - } - - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#allPages()}. - */ - @Test - public void testAllPages() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - // Check if pages are in PageList - assertEquals("all pages found", 10, pageMngr.allPages().size()); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closePage(org.eclipse.emf.ecore.EObject)}. - */ - @Test - public void testClosePage() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - - // Close page - changeListener.reset(); - pageMngr.closePage(identifiers.get(3)); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - - // Check page still in pages - assertEquals("all pages still in list", 10, pageMngr.allPages().size()); - - // Check if pages are in SashStructure - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); - assertNull("Page removed from sashStructure ", pageRef); - - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}. - */ - @Test - public void testCloseAllOpenedPages() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - - // Close page - changeListener.reset(); - pageMngr.closeAllOpenedPages(); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - - // Check page still in pages - assertEquals("all pages still in list", 10, pageMngr.allPages().size()); - - // Check if pages are in SashStructure - for(int i = 0; i < 10; i++) { - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i)); - assertNull("Page " + i + " removed from sashStructure ", pageRef); - } - - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}. - */ - @Test - public void testCloseOtherOpenedPages() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - - // Close page - changeListener.reset(); - pageMngr.closeOtherPages(identifiers.get(3)); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - - // Check page still in pages - assertEquals("all pages still in list", 10, pageMngr.allPages().size()); - - // Check if pages are in SashStructure - for(int i = 0; i < 10; i++) { - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i)); - if(i != 3) { - assertNull("Page " + i + " removed from sashStructure ", pageRef); - } else { - assertNotNull("Page " + i + " not removed from sashStructure ", pageRef); - } - } - - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#openPage(org.eclipse.emf.ecore.EObject)}. - */ - @Test - public void testOpenPage() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - - // Check if pages are in SashStructure - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); - assertNotNull("Page exist in sashStructure ", pageRef); - assertSame("found the right page", identifiers.get(3), pageRef.getPageIdentifier()); - - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(org.eclipse.emf.ecore.EObject)}. - */ - @Test - public void testRemovePage() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add 10 folders - for(int i = 0; i < 10; i++) { - // reset change count - changeListener.reset(); - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - } - // Check if pages are in PageList - assertEquals("all pages added", 10, pageMngr.allPages().size()); - // Check if page id is in page list - assertTrue("check page id is added to page list", pageMngr.allPages().contains(identifiers.get(3))); - - // Close page - changeListener.reset(); - pageMngr.removePage(identifiers.get(3)); - - // Check fired events - assertEquals("One event fired", 1, changeListener.getChangeCount()); - - // Check page still in pages - assertEquals("page remove from list", 9, pageMngr.allPages().size()); - - // Check removed from page list - assertFalse("check removed from page list", pageMngr.allPages().contains(identifiers.get(3))); - - // Check if pages are in SashStructure - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3)); - assertNull("Page removed from sashStructure ", pageRef); - } - - /** - * Check if closing the last page in a second tabfolder work propoerly. - * Create 3 editors, move one in a new folder, then remove the moved one. - * The new folder should automatically be removed. - * - */ - @Test - public void testCloseLastPageOfTabFolder() { - // A listener on change event. - ContentChangeListener changeListener = new ContentChangeListener(); - - // Set change listener - contentProvider.getContentChangedEventProvider().addListener(changeListener); - - // Create 3 editors, move one in another table - // Then remove the moved one. - - // Add identifiers - // Use Object as identifiers. - List identifiers = new ArrayList(); - // Add pages - int pageCount = 3; - for(int i = 0; i < pageCount; i++) { - // Add Editor - Object id = new Object(); - identifiers.add(id); - pageMngr.openPage(id); - } - // Check if pages are in PageList - assertEquals("all pages added", pageCount, pageMngr.allPages().size()); - - - // Move the last page - int movedPageIndex = 0; - ITabFolderModel tabFolder = lookupFolderModel(); - assertTrue("Moved page index is valid", movedPageIndex < pageCount); - - contentProvider.createFolder(tabFolder, movedPageIndex, tabFolder, SWT.TOP); - // check if the folder is created - // List folders = getAllFolders(contentProvider.getDiSashModel()); - // assertEquals("additional folder is removed", 2, folders.size()); - - // Close page - pageMngr.closePage(identifiers.get(movedPageIndex)); - - // Check the resulting model: we should have one folder with two page. - // folders = getAllFolders(contentProvider.getDiSashModel()); - // assertEquals("additional folder is removed", 1, folders.size()); - - List children = contentProvider.getDiSashModel().getWindows().get(0).getChildren(); - assertEquals("Windows has one child", 1, children.size()); - assertEquals("Windows child is the tabfolder", TabFolderImpl.class, children.get(0).getClass()); - - // Check if pages are in SashStructure - PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(movedPageIndex)); - assertNull("Page removed from sashStructure ", pageRef); - - } - - - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/tests/AllTests.java index 69291cdda0e..efcdccd61b0 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/tests/AllTests.java @@ -16,7 +16,7 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.tests; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngrTest; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.DiContentProvider2Test; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.DiContentProviderTest; -import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImplTest; +import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImplTest; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalDiContentProvider2Test; import org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.SashModelQueryTest; import org.junit.runner.RunWith; @@ -34,7 +34,7 @@ import org.junit.runners.Suite.SuiteClasses; DiContentProviderTest.class, DiContentProvider2Test.class, TransactionalDiContentProvider2Test.class, - PageMngrImplTest.class, + PageManagerImplTest.class, // package org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query SashModelQueryTest.class }) diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF index b525a277913..becb4098f0f 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF @@ -2,8 +2,7 @@ Manifest-Version: 1.0 Require-Bundle: org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" -Export-Package: org.eclipse.papyrus.infra.core.lifecycleevents, - org.eclipse.papyrus.infra.core.resource, +Export-Package: org.eclipse.papyrus.infra.core.resource, org.eclipse.papyrus.infra.core.services, org.eclipse.papyrus.infra.core.tests Bundle-Vendor: %providerName diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePageTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePageTest.java deleted file mode 100644 index a5723f7c468..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/contentoutline/NestedEditorDelegatedOutlinePageTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 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: - * Remi Schnekenburger (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.core.contentoutline; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import java.lang.reflect.Field; - -import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; -import org.eclipse.ui.part.PageSite; -import org.junit.Test; - - -/** - * Test the {@link NestedEditorDelegatedOutlinePage} class - */ -public class NestedEditorDelegatedOutlinePageTest extends AbstractPapyrusTest { - - @Test - public void testExistingMethod() { - // usage of java reflexive API to get a field. check this field is still present. - Field parentSiteField = null; - try { - parentSiteField = PageSite.class.getDeclaredField("parentSite"); - parentSiteField.setAccessible(true); - } catch (SecurityException e) { - fail(e.getLocalizedMessage()); - } catch (NoSuchFieldException e) { - fail(e.getLocalizedMessage()); - } - - assertNotNull("Impossible to find parent site field", parentSiteField); - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEvent.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEvent.java deleted file mode 100644 index 4c687ae23de..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - - - -/** - * @author dumoulin - * - */ -public class FakeSaveEvent extends DoSaveEvent { - - /** - * Constructor. - * - * @param serviceRegistry - * @param multiDiagramEditor - */ - public FakeSaveEvent() { - super(null, null); - // TODO Auto-generated constructor stub - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEventListener.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEventListener.java deleted file mode 100644 index 0117376add0..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/FakeSaveEventListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import java.util.ArrayList; -import java.util.List; - - -/** - * @author dumoulin - * - */ -public class FakeSaveEventListener implements ISaveEventListener { - - List receivedEvents = new ArrayList(); - - /** - * @see org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener#doSave(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent) - * - * @param event - */ - public void doSave(DoSaveEvent event) { - receivedEvents.add(event); - - } - - /** - * @see org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener#doSaveAs(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent) - * - * @param event - */ - public void doSaveAs(DoSaveEvent event) { - receivedEvents.add(event); - - } - - /** - * Return true if the event has been received. - * @param event - * @return - */ - public boolean isEventReceived(DoSaveEvent event) { - return receivedEvents.contains(event); - } - - - /** - * @return the receivedEvents - */ - public List getReceivedEvents() { - return receivedEvents; - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderTest.java deleted file mode 100644 index cc3271eb5fe..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/LifeCycleEventsProviderTest.java +++ /dev/null @@ -1,278 +0,0 @@ -/** - * - */ -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; -import org.junit.Before; -import org.junit.Test; - - -/** - * @author cedric dumoulin - * - */ -public class LifeCycleEventsProviderTest extends AbstractPapyrusTest { - - /** - * Object under test. - */ - protected LifeCycleEventsProvider eventProvider; - - /** - * @see junit.framework.TestCase#setUp() - * - * @throws Exception - */ - @Before - public void setUp() throws Exception { - eventProvider = new LifeCycleEventsProvider(); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#addDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testAddSaveListener() { - - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addDoSaveListener(listener); - } catch (Exception e) { - fail("Add listener"); - } - - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#removeDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testRemoveSaveListener() { - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addDoSaveListener(listener); - eventProvider.removeDoSaveListener(listener); - } catch (Exception e) { - fail("Remove listener"); - } - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#addAboutToDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testAddAboutToSaveListener() { - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addAboutToDoSaveListener(listener); - } catch (Exception e) { - fail("Add listener"); - } - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#removeAboutToDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testRemoveAboutToSaveListener() { - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addAboutToDoSaveListener(listener); - eventProvider.removeAboutToDoSaveListener(listener); - } catch (Exception e) { - fail("Remove listener"); - } - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#addPostDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testAddPostSaveListener() { - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addPostDoSaveListener(listener); - } catch (Exception e) { - fail("Add listener"); - } - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#removePostDoSaveListener(org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener)} - * . - */ - @Test - public void testRemovePostSaveListener() { - ISaveEventListener listener = new FakeSaveEventListener(); - - try { - eventProvider.addPostDoSaveListener(listener); - eventProvider.removePostDoSaveListener(listener); - } catch (Exception e) { - fail("Remove listener"); - } - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireAboutToSaveEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addAboutToDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireAboutToDoSaveEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveAsEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireAboutToSaveAsEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addAboutToDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireAboutToDoSaveAsEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireDoSaveEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireSaveEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireDoSaveEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireDoSaveAsEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireSaveAsEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireDoSaveAsEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFirePostSaveEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addPostDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.firePostDoSaveEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveAsEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFirePostSaveAsEvent() { - FakeSaveEventListener listener = new FakeSaveEventListener(); - - eventProvider.addPostDoSaveListener(listener); - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.firePostDoSaveAsEvent(event); - - assertTrue("event received", listener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireAllSaveEvent() { - FakeSaveEventListener preListener = new FakeSaveEventListener(); - FakeSaveEventListener listener = new FakeSaveEventListener(); - FakeSaveEventListener postListener = new FakeSaveEventListener(); - - eventProvider.addAboutToDoSaveListener(preListener); - eventProvider.addDoSaveListener(listener); - eventProvider.addPostDoSaveListener(postListener); - - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireAllDoSaveEvent(event); - - assertTrue("event received", preListener.isEventReceived(event)); - assertTrue("event received", listener.isEventReceived(event)); - assertTrue("event received", postListener.isEventReceived(event)); - } - - /** - * Test method for - * {@link org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveAsEvent(org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent)} - * . - */ - @Test - public void testFireAllSaveAsEvent() { - FakeSaveEventListener preListener = new FakeSaveEventListener(); - FakeSaveEventListener listener = new FakeSaveEventListener(); - FakeSaveEventListener postListener = new FakeSaveEventListener(); - - eventProvider.addAboutToDoSaveListener(preListener); - eventProvider.addDoSaveListener(listener); - eventProvider.addPostDoSaveListener(postListener); - - DoSaveEvent event = new FakeSaveEvent(); - eventProvider.fireAllDoSaveAsEvent(event); - - assertTrue("event received", preListener.isEventReceived(event)); - assertTrue("event received", listener.isEventReceived(event)); - assertTrue("event received", postListener.isEventReceived(event)); - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyServiceTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyServiceTest.java deleted file mode 100644 index c12701d87e2..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyServiceTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 LIFL & 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: - * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.core.lifecycleevents; - -import static org.junit.Assert.fail; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - - -/** - * @author dumoulin - * - */ -public class SaveAndDirtyServiceTest { - - /** - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#doSave(org.eclipse.core.runtime.IProgressMonitor)}. - */ - @Test - public void testDoSave() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#doSaveAs()}. - */ - @Test - public void testDoSaveAs() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#isDirty()}. - */ - @Test - public void testIsDirty() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#isSaveAsAllowed()}. - */ - @Test - public void testIsSaveAsAllowed() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#isSaveOnCloseNeeded()}. - */ - @Test - public void testIsSaveOnCloseNeeded() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#registerIsaveablePart(org.eclipse.ui.ISaveablePart)}. - */ - @Test - public void testRegisterIsaveablePart() { - fail("Not yet implemented"); - } - - /** - * Test method for {@link org.eclipse.papyrus.infra.core.lifecycleevents.SaveAndDirtyService#removeIsaveablePart(org.eclipse.ui.ISaveablePart)}. - */ - @Test - public void testRemoveIsaveablePart() { - fail("Not yet implemented"); - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java index 13fe1249ad1..ef9f5f0d95a 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2015 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 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 @@ -9,19 +9,13 @@ * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation * Christian W. Damus (CEA LIST) - add test for AdapterUtils - * Christian W. Damus (CEA) - bug 402525 - * Christian W. Damus (CEA) - bug 422257 - * Christian W. Damus (CEA) - bug 399859 - * Christian W. Damus - bug 456934 - * Christian W. Damus - bug 468030 - * Christian W. Damus - bug 482949 + * Christian W. Damus (CEA) - bugs 402525, 422257, 399859 + * Christian W. Damus - bugs 456934, 468030, 482949, 485220 * *****************************************************************************/ package org.eclipse.papyrus.infra.core.tests; -import org.eclipse.papyrus.infra.core.contentoutline.NestedEditorDelegatedOutlinePageTest; import org.eclipse.papyrus.infra.core.language.LanguageServiceTest; -import org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProviderTest; import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResourceTest; import org.eclipse.papyrus.infra.core.resource.ModelSetTest; import org.eclipse.papyrus.infra.core.resource.NestingTransactionalCommandStackTest; @@ -47,9 +41,6 @@ import org.junit.runners.Suite.SuiteClasses; LanguageServiceTest.class, // {oep}.core.services ComposedServiceTest.class, ServicesRegistryTest.class, - // {oep}.core.lifecycleevents - /* SaveAndDirtyServiceTest.class, */LifeCycleEventsProviderTest.class, - NestedEditorDelegatedOutlinePageTest.class, // {oep}.core.utils AdapterUtilsTest.class, JobBasedFutureTest.class, JobExecutorServiceTest.class }) diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/META-INF/MANIFEST.MF index 73af91f2c56..05ce153e610 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/META-INF/MANIFEST.MF @@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.8.0", org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.elementtypesconfigurations.tests Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/src/org/eclipse/papyrus/infra/elementtypesconfigurations/tests/AbstractElementTypeTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/src/org/eclipse/papyrus/infra/elementtypesconfigurations/tests/AbstractElementTypeTests.java index 03af9253f1d..dd4cc766565 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/src/org/eclipse/papyrus/infra/elementtypesconfigurations/tests/AbstractElementTypeTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.elementtypesconfigurations.tests/src/org/eclipse/papyrus/infra/elementtypesconfigurations/tests/AbstractElementTypeTests.java @@ -22,12 +22,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.emf.type.core.IClientContext; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF index 31cd94b6a95..16e908acdcf 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF @@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.8.0", org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.extendedtypes.tests Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AbstractElementTypeTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AbstractElementTypeTests.java index 98b56db0aff..30ca84f77bd 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AbstractElementTypeTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AbstractElementTypeTests.java @@ -22,12 +22,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.emf.type.core.IClientContext; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF index d085854059a..eb7e27a58be 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF @@ -83,7 +83,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.nattable.common.tests;bundle-version="1.2.0", org.eclipse.papyrus.infra.editor.welcome.tests;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.welcome.tests;bundle-version="1.2.0", - org.eclipse.papyrus.uml.validation.tests;bundle-version="1.2.0" + org.eclipse.papyrus.uml.validation.tests;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui.tests;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java index 87f1ea40867..0b9d823fd06 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2015 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 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 @@ -9,12 +9,7 @@ * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993 - * Christian W. Damus - bug 399859 - * Christian W. Damus - bug 451230 - * Christian W. Damus - bug 433206 - * Christian W. Damus - bug 463156 - * Christian W. Damus - bug 474610 - * Christian W. Damus - bug 469188 + * Christian W. Damus - bugs 399859, 451230, 433206, 463156, 474610, 469188, 485220 * *****************************************************************************/ package org.eclipse.papyrus.tests; @@ -55,6 +50,7 @@ public class AllTests { /* infra */ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.tools.tests.AllTests.class)); + suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.ui.tests.AllTests.class)); suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.edit.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.edit.tests.suites.AllTests")); suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class)); suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.tests.AllTests")); diff --git a/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/META-INF/MANIFEST.MF index 88c0442c090..4d832cd5ce4 100644 --- a/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/META-INF/MANIFEST.MF @@ -13,7 +13,11 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.views.properties;bundle-version="1.2.0", org.eclipse.papyrus.views.properties.model;bundle-version="1.2.0", org.eclipse.core.databinding;bundle-version="1.6.0", - org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.8.0" + org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.8.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName Bundle-Version: 1.2.0.qualifier diff --git a/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/src/org/eclipse/papyrus/infra/editor/welcome/tests/WelcomeModelElementTest.java b/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/src/org/eclipse/papyrus/infra/editor/welcome/tests/WelcomeModelElementTest.java index 6a281405a6d..8542083311e 100644 --- a/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/src/org/eclipse/papyrus/infra/editor/welcome/tests/WelcomeModelElementTest.java +++ b/tests/junit/plugins/infra/editor/org.eclipse.papyrus.infra.editor.welcome.tests/src/org/eclipse/papyrus/infra/editor/welcome/tests/WelcomeModelElementTest.java @@ -29,7 +29,6 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.transaction.RollbackException; import org.eclipse.papyrus.infra.core.language.Version; -import org.eclipse.papyrus.infra.core.resource.sasheditor.SashLayoutCommandFactory; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel; import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper; @@ -37,6 +36,7 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; import org.eclipse.papyrus.infra.editor.welcome.internal.modelelements.LanguageObservable; import org.eclipse.papyrus.infra.editor.welcome.internal.modelelements.WelcomeModelElement; import org.eclipse.papyrus.infra.editor.welcome.internal.modelelements.WelcomeModelElementFactory; +import org.eclipse.papyrus.infra.ui.internal.commands.SashLayoutCommandFactory; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.junit.Before; import org.junit.Test; diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java index e98f577d24a..af4c6d57e52 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -28,8 +29,8 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantService; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.assistant.core.IModelingAssistantModelProvider; import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.DefaultModelingAssistantModelProvider; @@ -41,6 +42,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingle import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -52,7 +54,7 @@ import org.osgi.framework.Bundle; * * */ -public class AssistantUsage extends AbstractEditorTest{ +public class AssistantUsage extends AbstractEditorTest { /** * @@ -65,7 +67,7 @@ public class AssistantUsage extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -88,87 +90,87 @@ public class AssistantUsage extends AbstractEditorTest{ @Test public void testAssistantForLabelNode() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddChildLabel.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - Assert.assertNotNull("The class has been redefined",childrenListRepresentation.IDMap.get(CLASS_VISUALID)); - Assert.assertNotNull("The compartment of class has been added",childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); - List the_2008_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); - Assert.assertEquals("2008 can have a new compartment",1, the_2008_Children.size()); - Assert.assertEquals("2008 has to contain "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); - - Assert.assertNotNull("The Nested Interface has to be added",childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL)); - List the_IMPLEMENTED_INTERFACES_Children=childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT); - Assert.assertEquals("Nested Interface can have a new compartment",1, the_IMPLEMENTED_INTERFACES_Children.size()); - Assert.assertEquals("Nested Interface has to contain "+NESTED_INTERFACE_LABEL,NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0)); - // the model is valid - //now launch a class diagram + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); + Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID)); + Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); + List the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); + Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size()); + Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); + + Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL)); + List the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT); + Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size()); + Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0)); + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor)editor.getActiveEditor(); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor(); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - IGraphicalEditPart classEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); + IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); - //verify editpolicy - EditPolicy inducedRepresentationCreator=classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); + // verify editpolicy + EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator); - //test in the notation - View classNotationView=classEditPart.getNotationView(); + // test in the notation + View classNotationView = classEditPart.getNotationView(); Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008"); - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classNotationView.getPersistedChildren().size(), 6); - View compartment=(View)classNotationView.getPersistedChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartment.getType()); + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6); + View compartment = (View) classNotationView.getPersistedChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType()); - //test in the editpart is created for this notation - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPart=(IGraphicalEditPart)classEditPart.getChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartmentEdiPart.getNotationView().getType()); + // test in the editpart is created for this notation + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType()); - //load model assistant + // load model assistant URI assistantURI = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - assistantURI=assistantURI.appendSegment("models"); - assistantURI=assistantURI.appendSegment("MyChildLabelAssistant.assistants"); - //Assert.assertTrue("The assistant file exist", assistantURI.isFile()); + assistantURI = assistantURI.appendSegment("models"); + assistantURI = assistantURI.appendSegment("MyChildLabelAssistant.assistants"); + // Assert.assertTrue("The assistant file exist", assistantURI.isFile()); IModelingAssistantModelProvider result = new DefaultModelingAssistantModelProvider(assistantURI); Assert.assertNotNull("the assistant model must be loaded", result); ModelingAssistantModelRegistry.getInstance().loadModels(result); - //try to create a label inside this compartment. - final IElementType interfaceLabelelementType=ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label"); - List types=ModelingAssistantService.getInstance().getTypesForPopupBar(classEditPart); - boolean founded=false; + // try to create a label inside this compartment. + final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label"); + List types = ModelingAssistantService.getInstance().getTypesForPopupBar(classEditPart); + boolean founded = false; - //test the construction of the popupbar + // test the construction of the popupbar for (Object object : types) { - if(object instanceof ProxyElementType){ - ProxyElementType proxyElementType= (ProxyElementType) object; + if (object instanceof ProxyElementType) { + ProxyElementType proxyElementType = (ProxyElementType) object; System.out.println(proxyElementType); - if( ("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label".equals(proxyElementType.getId())) + if (("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label".equals(proxyElementType.getId())) && interfaceLabelelementType.equals(proxyElementType.resolveSemanticType()) - && interfaceLabelelementType.equals(proxyElementType.resolveVisualType())){ - - //find the good short cut - founded=true; - //now construct the request and command to simulate the display inside popup bar - Request req=CreateViewRequestFactory.getCreateShapeRequest(proxyElementType, + && interfaceLabelelementType.equals(proxyElementType.resolveVisualType())) { + + // find the good short cut + founded = true; + // now construct the request and command to simulate the display inside popup bar + Request req = CreateViewRequestFactory.getCreateShapeRequest(proxyElementType, classEditPart.getDiagramPreferencesHint()); - EditPart targetEditpart= classEditPart.getTargetEditPart(req); - Assert.assertEquals("the request must be redirect to compartment", compartmentEdiPart,targetEditpart); - Command cmd=targetEditpart.getCommand(req); + EditPart targetEditpart = classEditPart.getTargetEditPart(req); + Assert.assertEquals("the request must be redirect to compartment", compartmentEdiPart, targetEditpart); + Command cmd = targetEditpart.getCommand(req); Assert.assertNotNull("The command must not be null", cmd); Assert.assertTrue("The command must be executable", cmd.canExecute()); } @@ -184,18 +186,19 @@ public class AssistantUsage extends AbstractEditorTest{ } protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java index 55056cae27f..115e38f6a47 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -19,13 +20,14 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -37,7 +39,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionAddBorderItem extends AbstractEditorTest{ +public class ExpansionAddBorderItem extends AbstractEditorTest { /** * @@ -54,7 +56,7 @@ public class ExpansionAddBorderItem extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -77,31 +79,31 @@ public class ExpansionAddBorderItem extends AbstractEditorTest{ @Test public void load_DiagramExpansion() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddBorderItem.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddBorderItem.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - Assert.assertNotNull("The class has been redefined",childrenListRepresentation.IDMap.get(CLASS_VISUALID)); - - Assert.assertNotNull("The BorderItem of class has been added",childrenListRepresentation.IDMap.get(INTERFACE_BORDER_ITEM)); - List the_2008_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); - Assert.assertEquals("2008 can have a new compartment",1, the_2008_Children.size()); - Assert.assertEquals("2008 has to contain "+INTERFACE_BORDER_ITEM,INTERFACE_BORDER_ITEM, the_2008_Children.get(0)); - - // the model is valid - //now launch a class diagram + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); + Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID)); + + Assert.assertNotNull("The BorderItem of class has been added", childrenListRepresentation.IDMap.get(INTERFACE_BORDER_ITEM)); + List the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); + Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size()); + Assert.assertEquals("2008 has to contain " + INTERFACE_BORDER_ITEM, INTERFACE_BORDER_ITEM, the_2008_Children.get(0)); + + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - IGraphicalEditPart classEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); + IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); Assert.assertNotNull("A Class edit Part must exist", classEditPart); } catch (Exception e) { @@ -109,19 +111,21 @@ public class ExpansionAddBorderItem extends AbstractEditorTest{ } } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java index 318823a7777..4ac12ca2254 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -28,8 +29,8 @@ import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; @@ -37,6 +38,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingle import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -48,7 +50,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionAddChildLabel extends AbstractEditorTest{ +public class ExpansionAddChildLabel extends AbstractEditorTest { /** * @@ -61,7 +63,7 @@ public class ExpansionAddChildLabel extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -84,84 +86,86 @@ public class ExpansionAddChildLabel extends AbstractEditorTest{ @Test public void load_DiagramExpansion() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddChildLabel.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - Assert.assertNotNull("The class has been redefined",childrenListRepresentation.IDMap.get(CLASS_VISUALID)); - Assert.assertNotNull("The compartment of class has been added",childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); - List the_2008_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); - Assert.assertEquals("2008 can have a new compartment",1, the_2008_Children.size()); - Assert.assertEquals("2008 has to contain "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); - - Assert.assertNotNull("The Nested Interface has to be added",childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL)); - List the_IMPLEMENTED_INTERFACES_Children=childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT); - Assert.assertEquals("Nested Interface can have a new compartment",1, the_IMPLEMENTED_INTERFACES_Children.size()); - Assert.assertEquals("Nested Interface has to contain "+NESTED_INTERFACE_LABEL,NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0)); - // the model is valid - //now launch a class diagram + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); + Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID)); + Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); + List the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); + Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size()); + Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); + + Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL)); + List the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT); + Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size()); + Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0)); + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor)editor.getActiveEditor(); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor(); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - IGraphicalEditPart classEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); + IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); - //verify editpolicy - EditPolicy inducedRepresentationCreator=classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); + // verify editpolicy + EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator); - //test in the notation - View classNotationView=classEditPart.getNotationView(); + // test in the notation + View classNotationView = classEditPart.getNotationView(); Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008"); - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classNotationView.getPersistedChildren().size(), 6); - View compartment=(View)classNotationView.getPersistedChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartment.getType()); - - //test in the editpart is created for this notation - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPart=(IGraphicalEditPart)classEditPart.getChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartmentEdiPart.getNotationView().getType()); - - //try to create a label inside this compartment. - final IElementType interfaceLabelelementType=ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label"); + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6); + View compartment = (View) classNotationView.getPersistedChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType()); + + // test in the editpart is created for this notation + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType()); + + // try to create a label inside this compartment. + final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label"); CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(interfaceLabelelementType, diagramEditPart.getDiagramPreferencesHint()); Command command = compartmentEdiPart.getCommand(requestcreation); Assert.assertNotNull("the command musbe given", command); - Assert.assertNotEquals("The command must be not equls to UnexecutableCommand", command , UnexecutableCommand.INSTANCE); - Assert.assertTrue("The command must be executable" , command.canExecute()); //$NON-NLS-1$ + Assert.assertNotEquals("The command must be not equls to UnexecutableCommand", command, UnexecutableCommand.INSTANCE); + Assert.assertTrue("The command must be executable", command.canExecute()); //$NON-NLS-1$ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command); Assert.assertTrue("The notation compartment must contain a child", compartment.getChildren().size() == 1); - EditPart createdEditPart= (EditPart)compartmentEdiPart.getChildren().get(0); + EditPart createdEditPart = (EditPart) compartmentEdiPart.getChildren().get(0); Assert.assertNotNull("the editPart child must be created", createdEditPart); - + } catch (Exception e) { e.printStackTrace(); } } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java index 383560f8fe6..39bd3da6bd0 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -21,14 +22,15 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -40,7 +42,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionAddCompartment extends AbstractEditorTest{ +public class ExpansionAddCompartment extends AbstractEditorTest { public void openDiagram(IMultiDiagramEditor editor, final String name) { @@ -48,7 +50,7 @@ public class ExpansionAddCompartment extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -71,68 +73,70 @@ public class ExpansionAddCompartment extends AbstractEditorTest{ @Test public void load_DiagramExpansion() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddCompartment.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartment.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - Assert.assertNotNull("The class has been redefined",childrenListRepresentation.IDMap.get(CLASS_VISUALID)); - Assert.assertNotNull("The compartment of class has been added",childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); - List the_2008_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); - Assert.assertEquals("2008 can have a new compartment",1, the_2008_Children.size()); - Assert.assertEquals("2008 has to contain "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); + Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID)); + Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); + List the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); + Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size()); + Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); - // the model is valid - //now launch a class diagram + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - IGraphicalEditPart classEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); + IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); - //verify editpolicy - EditPolicy inducedRepresentationCreator=classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); + // verify editpolicy + EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator); - //test in the notation - View classNotationView=classEditPart.getNotationView(); + // test in the notation + View classNotationView = classEditPart.getNotationView(); Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008"); - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classNotationView.getPersistedChildren().size(), 6); - View compartment=(View)classNotationView.getPersistedChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartment.getType()); - - //test in the editpart is created for this notation - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPart=(IGraphicalEditPart)classEditPart.getChildren().get(5); - if( compartmentEdiPart.getNotationView().equals(compartment)){ - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartmentEdiPart.getNotationView().getType()); + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6); + View compartment = (View) classNotationView.getPersistedChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType()); + + // test in the editpart is created for this notation + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5); + if (compartmentEdiPart.getNotationView().equals(compartment)) { + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType()); } } catch (Exception e) { e.printStackTrace(); } } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java index f88a63cd4c2..b2ab26852ff 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -21,14 +22,15 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -40,7 +42,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionAddCompartmentWithKind extends AbstractEditorTest{ +public class ExpansionAddCompartmentWithKind extends AbstractEditorTest { public void openDiagram(IMultiDiagramEditor editor, final String name) { @@ -48,7 +50,7 @@ public class ExpansionAddCompartmentWithKind extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -71,68 +73,70 @@ public class ExpansionAddCompartmentWithKind extends AbstractEditorTest{ @Test public void load_DiagramExpansion() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddCompartmentWithKind.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartmentWithKind.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - Assert.assertNotNull("The class has been redefined",childrenListRepresentation.IDMap.get(CLASS_VISUALID)); - Assert.assertNotNull("The compartment of class has been added",childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); - List the_2008_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); - Assert.assertEquals("2008 can have a new compartment",1, the_2008_Children.size()); - Assert.assertEquals("2008 has to contain "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); + Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID)); + Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT)); + List the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID); + Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size()); + Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0)); - // the model is valid - //now launch a class diagram + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - IGraphicalEditPart classEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); + IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); - //verify editpolicy - EditPolicy inducedRepresentationCreator=classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); + // verify editpolicy + EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY); Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator); - //test in the notation - View classNotationView=classEditPart.getNotationView(); + // test in the notation + View classNotationView = classEditPart.getNotationView(); Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008"); - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classNotationView.getPersistedChildren().size(), 6); - View compartment=(View)classNotationView.getPersistedChildren().get(5); - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartment.getType()); - - //test in the editpart is created for this notation - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",classEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPart=(IGraphicalEditPart)classEditPart.getChildren().get(5); - if( compartmentEdiPart.getNotationView().equals(compartment)){ - Assert.assertEquals("The last compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT , compartmentEdiPart.getNotationView().getType()); + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6); + View compartment = (View) classNotationView.getPersistedChildren().get(5); + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType()); + + // test in the editpart is created for this notation + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5); + if (compartmentEdiPart.getNotationView().equals(compartment)) { + Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType()); } } catch (Exception e) { e.printStackTrace(); } } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java index cbc75a86b42..800a55f5eed 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -29,8 +30,8 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeConfigurationTypeRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; @@ -38,6 +39,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresenta import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.junit.Assert; import org.junit.Test; @@ -49,7 +51,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionAddLink extends AbstractEditorTest{ +public class ExpansionAddLink extends AbstractEditorTest { public void openDiagram(IMultiDiagramEditor editor, final String name) { @@ -58,7 +60,7 @@ public class ExpansionAddLink extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -72,40 +74,40 @@ public class ExpansionAddLink extends AbstractEditorTest{ @Test public void load_DiagramExpansion() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddLink.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddLink.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); System.out.println(childrenListRepresentation); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); - - Assert.assertNotNull("The Link of NewDependency has been added",childrenListRepresentation.IDMap.get(DEPENDENCY_HINT)); - List the_ClassDiagram_Children=childrenListRepresentation.parentChildrenRelation.get(CLASS_DIAGRAM_TYPE); - Assert.assertEquals("The class Diagram can have a new child",1, the_ClassDiagram_Children.size()); - Assert.assertEquals("class Diagram has to contain "+DEPENDENCY_HINT,DEPENDENCY_HINT, the_ClassDiagram_Children.get(0)); + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); - - // the model is valid - //now launch a class diagram + Assert.assertNotNull("The Link of NewDependency has been added", childrenListRepresentation.IDMap.get(DEPENDENCY_HINT)); + List the_ClassDiagram_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_DIAGRAM_TYPE); + Assert.assertEquals("The class Diagram can have a new child", 1, the_ClassDiagram_Children.size()); + Assert.assertEquals("class Diagram has to contain " + DEPENDENCY_HINT, DEPENDENCY_HINT, the_ClassDiagram_Children.get(0)); + + + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor)editor.getActiveEditor(); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor(); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - Assert.assertEquals("The class diagram has to contain two class representation",2, diagramEditPart.getChildren().size()); - IGraphicalEditPart myclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); - IGraphicalEditPart myOtherclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(1); + Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size()); + IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); + IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1); Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart); Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart); ElementTypeConfigurationTypeRegistry.getInstance(); - final IElementType elementType_Dependency=ElementTypeRegistry.getInstance().getType(NEW_DEPENDENCY_ELEMENTTYPE_ID); - + final IElementType elementType_Dependency = ElementTypeRegistry.getInstance().getType(NEW_DEPENDENCY_ELEMENTTYPE_ID); + Command command = myOtherclassEditPart.getCommand(createConnectionViewRequest(elementType_Dependency, myclassEditPart, myOtherclassEditPart, diagramEditPart)); assertNotNull("The command to create link must be not null", command); assertTrue("The command to create link must be executable", command.canExecute() == true); @@ -113,15 +115,15 @@ public class ExpansionAddLink extends AbstractEditorTest{ assertTrue("The edge must be created", (diagramEditPart.getDiagramView()).getEdges().size() == 1); org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart linkEditPart = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) diagramEditPart.getConnections().get(0); Assert.assertNotNull("linkEditPart edit Part must exist", linkEditPart); - Assert.assertEquals("The link must have the type "+DEPENDENCY_HINT,DEPENDENCY_HINT, linkEditPart.getNotationView().getType()); + Assert.assertEquals("The link must have the type " + DEPENDENCY_HINT, DEPENDENCY_HINT, linkEditPart.getNotationView().getType()); } catch (Exception e) { e.printStackTrace(); } } - - public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart ) { + + public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) { CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint()); connectionRequest.setSourceEditPart(null); connectionRequest.setTargetEditPart(source); @@ -135,19 +137,21 @@ public class ExpansionAddLink extends AbstractEditorTest{ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END); return connectionRequest; } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java index 382f8199e30..02af83eeaec 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.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: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -31,14 +32,15 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Classifier; @@ -53,7 +55,7 @@ import org.osgi.framework.Bundle; * * */ -public class ExpansionDropElements extends AbstractEditorTest{ +public class ExpansionDropElements extends AbstractEditorTest { public void openDiagram(IMultiDiagramEditor editor, final String name) { @@ -62,7 +64,7 @@ public class ExpansionDropElements extends AbstractEditorTest{ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry()); NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID); Diagram diagram = notation.getDiagram(name); - ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()).openPage(diagram); + ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram); flushDisplayEvents(); } catch (Exception e) { throw new IllegalStateException("Cannot initialize test", e); @@ -75,42 +77,42 @@ public class ExpansionDropElements extends AbstractEditorTest{ @Test public void testDropInsidecontainer() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddChildLabel.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); - // the model is valid - //now launch a class diagram + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor)editor.getActiveEditor(); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor(); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - Assert.assertEquals("The class diagram has to contain two class representation",2, diagramEditPart.getChildren().size()); - IGraphicalEditPart myclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); - IGraphicalEditPart myOtherclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(1); + Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size()); + IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); + IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1); Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart); Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart); - //get Child of myclassEditPart - Class myclass= (Class) myclassEditPart.resolveSemanticElement(); - Assert.assertEquals("The class must be called","MyClass", myclass.getName()); - Classifier nestedInterface= myclass.getNestedClassifier("MyNestedInterface"); + // get Child of myclassEditPart + Class myclass = (Class) myclassEditPart.resolveSemanticElement(); + Assert.assertEquals("The class must be called", "MyClass", myclass.getName()); + Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface"); Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface); - - // try to drop on my class - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",myclassEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPartMyClass=(IGraphicalEditPart)myclassEditPart.getChildren().get(5); - Assert.assertEquals("the compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT ,compartmentEdiPartMyClass.getNotationView().getType()); + + // try to drop on my class + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPartMyClass = (IGraphicalEditPart) myclassEditPart.getChildren().get(5); + Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyClass.getNotationView().getType()); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); ArrayList list = new ArrayList(); @@ -122,8 +124,8 @@ public class ExpansionDropElements extends AbstractEditorTest{ assertTrue("The command of drop must be executable", command != UnexecutableCommand.INSTANCE); assertTrue("The command of drop must be executable", command.canExecute()); diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command); - Assert.assertEquals("The representation of the child must be dropped",1, compartmentEdiPartMyClass.getChildren().size() ); - + Assert.assertEquals("The representation of the child must be dropped", 1, compartmentEdiPartMyClass.getChildren().size()); + } catch (Exception e) { e.printStackTrace(); @@ -133,41 +135,41 @@ public class ExpansionDropElements extends AbstractEditorTest{ @Test public void testDropInsideBadcontainer() { - //loading - DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("AddChildLabel.xmi"); - Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 1",1,diagramExpansionsRegistry.mapChildreen.size()); + // loading + DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi"); + Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size()); - //test the data structure that is interpreted by the framework - ChildrenListRepresentation childrenListRepresentation= diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); - Assert.assertNotNull("A usage contex has been defined for "+CLASS_DIAGRAM_TYPE , childrenListRepresentation); + // test the data structure that is interpreted by the framework + ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE); + Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation); - // the model is valid - //now launch a class diagram + // the model is valid + // now launch a class diagram try { initModel("ExpansionModelProject", "ExpansionModelTest", getBundle()); openDiagram(editor, "NewDiagram"); - DiagramEditPart diagramEditPart = (DiagramEditPart)editor.getAdapter(DiagramEditPart.class); + DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class); Assert.assertNotNull("A Class edit Part must exist", diagramEditPart); Assert.assertNotNull("The diagram must be opened", diagramEditPart); - Assert.assertEquals("The class diagram has to contain two class representation",2, diagramEditPart.getChildren().size()); - IGraphicalEditPart myclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(0); - IGraphicalEditPart myOtherclassEditPart =(IGraphicalEditPart)diagramEditPart.getChildren().get(1); + Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size()); + IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0); + IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1); Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart); Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart); - //get Child of myclassEditPart - Class myclass= (Class) myclassEditPart.resolveSemanticElement(); - Assert.assertEquals("The class must be called","MyClass", myclass.getName()); - Classifier nestedInterface= myclass.getNestedClassifier("MyNestedInterface"); + // get Child of myclassEditPart + Class myclass = (Class) myclassEditPart.resolveSemanticElement(); + Assert.assertEquals("The class must be called", "MyClass", myclass.getName()); + Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface"); Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface); - - // try to drop on my class - Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments",myclassEditPart.getChildren().size(), 6); - IGraphicalEditPart compartmentEdiPartMyOtherClass=(IGraphicalEditPart)myOtherclassEditPart.getChildren().get(5); - Assert.assertEquals("the compartment must have the type "+IMPLEMENTED_INTERFACES_HINT,IMPLEMENTED_INTERFACES_HINT ,compartmentEdiPartMyOtherClass.getNotationView().getType()); + + // try to drop on my class + Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6); + IGraphicalEditPart compartmentEdiPartMyOtherClass = (IGraphicalEditPart) myOtherclassEditPart.getChildren().get(5); + Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyOtherClass.getNotationView().getType()); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); ArrayList list = new ArrayList(); @@ -182,7 +184,8 @@ public class ExpansionDropElements extends AbstractEditorTest{ } } - public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart ) { + + public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) { CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint()); connectionRequest.setSourceEditPart(null); connectionRequest.setTargetEditPart(source); @@ -196,19 +199,21 @@ public class ExpansionDropElements extends AbstractEditorTest{ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END); return connectionRequest; } + protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) { - DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); + DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); diagramExpansionsRegistry.clear(); - Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size()); - Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size()); + Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size()); + Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size()); URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true); - badContextExpansion=badContextExpansion.appendSegment("models"); - badContextExpansion=badContextExpansion.appendSegment(filename); + badContextExpansion = badContextExpansion.appendSegment("models"); + badContextExpansion = badContextExpansion.appendSegment(filename); diagramExpansionsRegistry.loadExpansion(badContextExpansion); return diagramExpansionsRegistry; } + /** * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath() * diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF index 4e540186d4c..bcb8a60d6fc 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF @@ -19,7 +19,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.core.databinding;bundle-version="1.4.1", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;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" Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.tests, org.eclipse.papyrus.infra.gmfdiag.css.tests.tests Bundle-Vendor: Eclipse Modeling Project diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu.tests/META-INF/MANIFEST.MF index 59e136a5969..55c8979b632 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu.tests/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.menu;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.2.0" + org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.gmfdiag.menu.tests.tests Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/META-INF/MANIFEST.MF index f71620ee87f..586f0972f2b 100644 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/META-INF/MANIFEST.MF @@ -15,7 +15,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.uml2.uml;bundle-version="5.1.0", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", - org.eclipse.emf.transaction + org.eclipse.emf.transaction, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Bundle-Description: %Bundle-Description diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/src/org/eclipse/papyrus/infra/nattable/common/tests/AbstractTableHelperAPITest.java b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/src/org/eclipse/papyrus/infra/nattable/common/tests/AbstractTableHelperAPITest.java index 78a832dd19f..6be99ebd8c4 100644 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/src/org/eclipse/papyrus/infra/nattable/common/tests/AbstractTableHelperAPITest.java +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common.tests/src/org/eclipse/papyrus/infra/nattable/common/tests/AbstractTableHelperAPITest.java @@ -20,7 +20,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.infra.core.resource.NotFoundException; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.nattable.common.api.ITableEditorStatusCode; import org.eclipse.papyrus.infra.nattable.common.api.TableEditorCreationHelper; diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF index fbafd8a2128..5f91651d71d 100644 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.nattable.tests.tests Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/META-INF/MANIFEST.MF index 13f836743c2..a9b706f8f9d 100755 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/META-INF/MANIFEST.MF @@ -6,8 +6,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.junit, org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", @@ -21,7 +20,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.ui.navigator;bundle-version="3.5.500" + org.eclipse.ui.navigator;bundle-version="3.5.500", + org.eclipse.papyrus.infra.core.sasheditor;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" Export-Package: org.eclipse.papyrus.infra.nattable.views.tests, org.eclipse.papyrus.infra.nattable.views.tests.tests Bundle-Vendor: %Bundle-Vendor diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/OpenTableTest.java b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/OpenTableTest.java index 9428d782cf5..a7ccb80807e 100755 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/OpenTableTest.java +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/OpenTableTest.java @@ -19,7 +19,7 @@ import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.editor.integration.tests.tests.AbstractEditorIntegrationTest; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest.java b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest.java index 6999590bbf8..e4dccf8c6a3 100755 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest.java +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest.java @@ -24,13 +24,13 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.views.tests.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest2.java b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest2.java index 8c080566323..7d42fb00753 100755 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest2.java +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableCreationTest2.java @@ -31,13 +31,12 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; 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.service.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; @@ -48,6 +47,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.views.tests.Activator; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.junit.utils.ModelExplorerUtils; diff --git a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableVerifyContents.java b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableVerifyContents.java index 84e22fd69b0..786a7e189ec 100755 --- a/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableVerifyContents.java +++ b/tests/junit/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.tests/src/org/eclipse/papyrus/infra/nattable/views/tests/tests/TableVerifyContents.java @@ -29,13 +29,12 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.PageList; 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.service.IPageManager; import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; @@ -43,6 +42,7 @@ import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.views.tests.Activator; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.junit.utils.ModelExplorerUtils; diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/META-INF/MANIFEST.MF index d1cc1a07e00..55e768039b8 100644 --- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/META-INF/MANIFEST.MF @@ -10,8 +10,7 @@ Require-Bundle: org.junit;bundle-version="4.10.0", com.google.guava;bundle-version="11.0.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.tools.databinding, - org.eclipse.papyrus.infra.tools.tests, - org.eclipse.papyrus.infra.tools.util + org.eclipse.papyrus.infra.tools.tests Bundle-Vendor: Eclipse Modeling Project Bundle-Version: 1.2.0.qualifier Bundle-Name: Papyrus Infrastructure Tools Tests diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/tests/AllTests.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/tests/AllTests.java index 25ef0698a44..7267d91bafb 100644 --- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/tests/AllTests.java +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/tests/AllTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 CEA and others. + * Copyright (c) 2014, 2016 CEA, 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,14 +8,14 @@ * * Contributors: * Christian W. Damus (CEA) - Initial API and implementation + * Christian W. Damus - bug 485220 * */ package org.eclipse.papyrus.infra.tools.tests; import org.eclipse.papyrus.infra.tools.databinding.AllDataBindingTests; -import org.eclipse.papyrus.infra.tools.util.UIUtilTest; -import org.junit.runner.RunWith; import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.junit.runner.RunWith; import org.junit.runners.Suite.SuiteClasses; @@ -23,7 +23,7 @@ import org.junit.runners.Suite.SuiteClasses; * The master test suite for the plug-in. */ @RunWith(ClassificationSuite.class) -@SuiteClasses({ UIUtilTest.class, AllDataBindingTests.class }) +@SuiteClasses({ AllDataBindingTests.class }) public class AllTests { public AllTests() { diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/util/UIUtilTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/util/UIUtilTest.java deleted file mode 100644 index 0559d645ff7..00000000000 --- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.tools.tests/src/org/eclipse/papyrus/infra/tools/util/UIUtilTest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2014 CEA 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * - */ -package org.eclipse.papyrus.infra.tools.util; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.fail; - -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; -import org.eclipse.swt.widgets.Display; -import org.hamcrest.Matcher; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.runners.Enclosed; -import org.junit.runner.RunWith; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - - -/** - * Test cases for the {@link UIUtil} class. - */ -@RunWith(Enclosed.class) -public class UIUtilTest { - - public UIUtilTest() { - super(); - } - - // - // Test suites - // - - public static class ExecutorServiceTest extends AbstractPapyrusTest { - - private ExecutorService fixture; - - public ExecutorServiceTest() { - super(); - } - - @Test - public void testSubmit() { - Future future = fixture.submit(new Task()); - assertThat(future.isCancelled(), is(false)); - assertThat(future.isDone(), is(false)); - - flushDisplayEvents(); - - assertThat(future.isDone(), is(true)); - assertResult(future, is(true)); - } - - @Test - public void testShutdown() { - Future future = fixture.submit(new Task()); - - fixture.shutdown(); - - assertThat(fixture.isShutdown(), is(true)); - assertThat(fixture.isTerminated(), is(false)); - - flushDisplayEvents(); - - assertThat(fixture.isTerminated(), is(true)); - - // The task did execute - assertResult(future, is(true)); - } - - @Test - public void testShutdownNow() { - Future future = fixture.submit(new Task()); - - List cancelled = fixture.shutdownNow(); - - assertThat(cancelled.size(), is(1)); - - assertThat(fixture.isTerminated(), is(true)); - - assertThat(future.isDone(), is(false)); - } - - @Test - public void testAwaitTermination_finishes() { - Future future = fixture.submit(new Task()); - - fixture.shutdown(); - - ExecutorService executor = Executors.newSingleThreadExecutor(); - Future waiter = executor.submit(new AwaitTermination(10)); - try { - flushDisplayEvents(); - - assertResult(waiter, is(true)); - - // The task did execute - assertResult(future, is(true)); - } finally { - executor.shutdown(); - } - } - - @Test - public void testAwaitTermination_timesOut() { - fixture.submit(new Task()); - - fixture.shutdown(); - - ExecutorService executor = Executors.newSingleThreadExecutor(); - Future waiter = executor.submit(new AwaitTermination(1)); - - try { - assertResult(waiter, is(false)); - } finally { - executor.shutdown(); - } - } - - // - // Test framework - // - - @Before - public void createFixture() { - fixture = UIUtil.createUIExecutor(Display.getCurrent()); - } - - @After - public void disposeFixture() { - fixture.shutdown(); - fixture = null; - - // Ensure that any remaining runnables are processed - flushDisplayEvents(); - } - - void assertResult(Future future, Matcher assertion) { - try { - assertThat(future.get(), assertion); - } catch (Exception e) { - e.printStackTrace(); - fail("Failed to get future result: " + e.getLocalizedMessage()); - } - } - - private static class Task implements Callable { - - @Override - public Boolean call() { - return true; - } - } - - private class AwaitTermination implements Callable { - - private final int timeoutSeconds; - - public AwaitTermination(int timeoutSeconds) { - super(); - - this.timeoutSeconds = timeoutSeconds; - } - - @Override - public Boolean call() throws Exception { - return fixture.awaitTermination(timeoutSeconds, TimeUnit.SECONDS); - } - } - } - - // - // Shared test framework - // - - - static void flushDisplayEvents() { - for (;;) { - try { - if (!Display.getCurrent().readAndDispatch()) { - break; - } - } catch (Exception e) { - Bundle testBundle = FrameworkUtil.getBundle(UIUtilTest.class); - Platform.getLog(testBundle).log(new Status(IStatus.ERROR, testBundle.getSymbolicName(), "Uncaught exception in display runnable.", e)); - } - } - } - -} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.classpath b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.project b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.project new file mode 100644 index 00000000000..40ee1d661bc --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.infra.ui.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..94d61f00da6 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..357128fcc05 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Require-Bundle: org.junit;bundle-version="4.10.0", + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.ui;bundle-version="3.100.0", + org.eclipse.core.runtime;bundle-version="3.10.0", + com.google.guava;bundle-version="11.0.0", + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core;bundle-version="1.2.0" +Export-Package: org.eclipse.papyrus.infra.ui.lifecycleevents, + org.eclipse.papyrus.infra.ui.tests, + org.eclipse.papyrus.infra.ui.util +Bundle-Vendor: Eclipse Modeling Project +Bundle-Version: 1.2.0.qualifier +Bundle-Name: Papyrus Infrastructure UI Tests +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.tests;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/about.html b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/about.html new file mode 100644 index 00000000000..d35d5aed64c --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/build.properties b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/build.properties new file mode 100644 index 00000000000..45e33b593cc --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/build.properties @@ -0,0 +1,17 @@ +# Copyright (c) 2014 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: +# CEA LIST - Initial API and implementation +# + +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html +src.includes = about.html diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/org.eclipse.papyrus.infra.ui.tests.launch b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/org.eclipse.papyrus.infra.ui.tests.launch new file mode 100644 index 00000000000..a773201dc3d --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/org.eclipse.papyrus.infra.ui.tests.launch @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/pom.xml b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/pom.xml new file mode 100644 index 00000000000..f79e3c87f9a --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.eclipse.papyrus + org.eclipse.papyrus.tests.releng + 1.2.0-SNAPSHOT + ../../../../../releng/main-tests + + org.eclipse.papyrus + org.eclipse.papyrus.infra.ui.tests + 1.2.0-SNAPSHOT + eclipse-test-plugin + diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePageTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePageTest.java new file mode 100644 index 00000000000..e7ee69d698b --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/contentoutline/NestedEditorDelegatedOutlinePageTest.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2013 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: + * Remi Schnekenburger (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.contentoutline; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.lang.reflect.Field; + +import org.eclipse.papyrus.infra.ui.contentoutline.NestedEditorDelegatedOutlinePage; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.ui.part.PageSite; +import org.junit.Test; + + +/** + * Test the {@link NestedEditorDelegatedOutlinePage} class + */ +public class NestedEditorDelegatedOutlinePageTest extends AbstractPapyrusTest { + + @Test + public void testExistingMethod() { + // usage of java reflexive API to get a field. check this field is still present. + Field parentSiteField = null; + try { + parentSiteField = PageSite.class.getDeclaredField("parentSite"); + parentSiteField.setAccessible(true); + } catch (SecurityException e) { + fail(e.getLocalizedMessage()); + } catch (NoSuchFieldException e) { + fail(e.getLocalizedMessage()); + } + + assertNotNull("Impossible to find parent site field", parentSiteField); + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEvent.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEvent.java new file mode 100644 index 00000000000..55e8c757e88 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEvent.java @@ -0,0 +1,25 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; + +/** + * @author dumoulin + * + */ +public class FakeSaveEvent extends DoSaveEvent { + + /** + * Constructor. + * + * @param serviceRegistry + * @param multiDiagramEditor + */ + public FakeSaveEvent() { + super(null, null); + // TODO Auto-generated constructor stub + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEventListener.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEventListener.java new file mode 100644 index 00000000000..7c801621502 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/FakeSaveEventListener.java @@ -0,0 +1,58 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; + + +/** + * @author dumoulin + * + */ +public class FakeSaveEventListener implements ISaveEventListener { + + List receivedEvents = new ArrayList(); + + /** + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener#doSave(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent) + * + * @param event + */ + public void doSave(DoSaveEvent event) { + receivedEvents.add(event); + + } + + /** + * @see org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener#doSaveAs(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent) + * + * @param event + */ + public void doSaveAs(DoSaveEvent event) { + receivedEvents.add(event); + + } + + /** + * Return true if the event has been received. + * @param event + * @return + */ + public boolean isEventReceived(DoSaveEvent event) { + return receivedEvents.contains(event); + } + + + /** + * @return the receivedEvents + */ + public List getReceivedEvents() { + return receivedEvents; + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderTest.java new file mode 100644 index 00000000000..5b5c917b957 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/LifeCycleEventsProviderTest.java @@ -0,0 +1,281 @@ +/** + * + */ +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener; +import org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.junit.Before; +import org.junit.Test; + + +/** + * @author cedric dumoulin + * + */ +public class LifeCycleEventsProviderTest extends AbstractPapyrusTest { + + /** + * Object under test. + */ + protected LifeCycleEventsProvider eventProvider; + + /** + * @see junit.framework.TestCase#setUp() + * + * @throws Exception + */ + @Before + public void setUp() throws Exception { + eventProvider = new LifeCycleEventsProvider(); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#addDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testAddSaveListener() { + + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addDoSaveListener(listener); + } catch (Exception e) { + fail("Add listener"); + } + + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#removeDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testRemoveSaveListener() { + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addDoSaveListener(listener); + eventProvider.removeDoSaveListener(listener); + } catch (Exception e) { + fail("Remove listener"); + } + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#addAboutToDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testAddAboutToSaveListener() { + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addAboutToDoSaveListener(listener); + } catch (Exception e) { + fail("Add listener"); + } + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#removeAboutToDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testRemoveAboutToSaveListener() { + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addAboutToDoSaveListener(listener); + eventProvider.removeAboutToDoSaveListener(listener); + } catch (Exception e) { + fail("Remove listener"); + } + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#addPostDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testAddPostSaveListener() { + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addPostDoSaveListener(listener); + } catch (Exception e) { + fail("Add listener"); + } + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#removePostDoSaveListener(org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveEventListener)} + * . + */ + @Test + public void testRemovePostSaveListener() { + ISaveEventListener listener = new FakeSaveEventListener(); + + try { + eventProvider.addPostDoSaveListener(listener); + eventProvider.removePostDoSaveListener(listener); + } catch (Exception e) { + fail("Remove listener"); + } + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireAboutToSaveEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addAboutToDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireAboutToDoSaveEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveAsEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireAboutToSaveAsEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addAboutToDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireAboutToDoSaveAsEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireDoSaveEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireSaveEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireDoSaveEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireDoSaveAsEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireSaveAsEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireDoSaveAsEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFirePostSaveEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addPostDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.firePostDoSaveEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveAsEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFirePostSaveAsEvent() { + FakeSaveEventListener listener = new FakeSaveEventListener(); + + eventProvider.addPostDoSaveListener(listener); + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.firePostDoSaveAsEvent(event); + + assertTrue("event received", listener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireAllSaveEvent() { + FakeSaveEventListener preListener = new FakeSaveEventListener(); + FakeSaveEventListener listener = new FakeSaveEventListener(); + FakeSaveEventListener postListener = new FakeSaveEventListener(); + + eventProvider.addAboutToDoSaveListener(preListener); + eventProvider.addDoSaveListener(listener); + eventProvider.addPostDoSaveListener(postListener); + + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireAllDoSaveEvent(event); + + assertTrue("event received", preListener.isEventReceived(event)); + assertTrue("event received", listener.isEventReceived(event)); + assertTrue("event received", postListener.isEventReceived(event)); + } + + /** + * Test method for + * {@link org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveAsEvent(org.eclipse.papyrus.infra.ui.lifecycleevents.DoSaveEvent)} + * . + */ + @Test + public void testFireAllSaveAsEvent() { + FakeSaveEventListener preListener = new FakeSaveEventListener(); + FakeSaveEventListener listener = new FakeSaveEventListener(); + FakeSaveEventListener postListener = new FakeSaveEventListener(); + + eventProvider.addAboutToDoSaveListener(preListener); + eventProvider.addDoSaveListener(listener); + eventProvider.addPostDoSaveListener(postListener); + + DoSaveEvent event = new FakeSaveEvent(); + eventProvider.fireAllDoSaveAsEvent(event); + + assertTrue("event received", preListener.isEventReceived(event)); + assertTrue("event received", listener.isEventReceived(event)); + assertTrue("event received", postListener.isEventReceived(event)); + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyServiceTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyServiceTest.java new file mode 100644 index 00000000000..9561a655183 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/lifecycleevents/SaveAndDirtyServiceTest.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 LIFL, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.ui.lifecycleevents; + +import static org.junit.Assert.fail; + +import org.eclipse.papyrus.junit.framework.classification.NotImplemented; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * @author dumoulin + * + */ +@NotImplemented("Placeholder for test suite") +public class SaveAndDirtyServiceTest extends AbstractPapyrusTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#doSave(org.eclipse.core.runtime.IProgressMonitor)}. + */ + @Test + public void testDoSave() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#doSaveAs()}. + */ + @Test + public void testDoSaveAs() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#isDirty()}. + */ + @Test + public void testIsDirty() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#isSaveAsAllowed()}. + */ + @Test + public void testIsSaveAsAllowed() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#isSaveOnCloseNeeded()}. + */ + @Test + public void testIsSaveOnCloseNeeded() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#registerIsaveablePart(org.eclipse.ui.ISaveablePart)}. + */ + @Test + public void testRegisterIsaveablePart() { + fail("Not yet implemented"); + } + + /** + * Test method for {@link org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyService#removeIsaveablePart(org.eclipse.ui.ISaveablePart)}. + */ + @Test + public void testRemoveIsaveablePart() { + fail("Not yet implemented"); + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/tests/AllTests.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/tests/AllTests.java new file mode 100644 index 00000000000..e7eeb22c2d9 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/tests/AllTests.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014, 2016 CEA, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * Christian W. Damus - bug 485220 + * + */ +package org.eclipse.papyrus.infra.ui.tests; + +import org.eclipse.papyrus.infra.ui.contentoutline.NestedEditorDelegatedOutlinePageTest; +import org.eclipse.papyrus.infra.ui.lifecycleevents.LifeCycleEventsProviderTest; +import org.eclipse.papyrus.infra.ui.lifecycleevents.SaveAndDirtyServiceTest; +import org.eclipse.papyrus.infra.ui.util.UIUtilTest; +import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite.SuiteClasses; + + +/** + * The master test suite for the plug-in. + */ +@RunWith(ClassificationSuite.class) +@SuiteClasses({ UIUtilTest.class, + SaveAndDirtyServiceTest.class, + LifeCycleEventsProviderTest.class, + NestedEditorDelegatedOutlinePageTest.class, +}) +public class AllTests { + + public AllTests() { + super(); + } + +} diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/util/UIUtilTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/util/UIUtilTest.java new file mode 100644 index 00000000000..ce1c6be0db8 --- /dev/null +++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.tests/src/org/eclipse/papyrus/infra/ui/util/UIUtilTest.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2014 CEA 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.ui.util; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.fail; + +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.papyrus.infra.ui.util.UIUtil; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.swt.widgets.Display; +import org.hamcrest.Matcher; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + + +/** + * Test cases for the {@link UIUtil} class. + */ +@RunWith(Enclosed.class) +public class UIUtilTest { + + public UIUtilTest() { + super(); + } + + // + // Test suites + // + + public static class ExecutorServiceTest extends AbstractPapyrusTest { + + private ExecutorService fixture; + + public ExecutorServiceTest() { + super(); + } + + @Test + public void testSubmit() { + Future future = fixture.submit(new Task()); + assertThat(future.isCancelled(), is(false)); + assertThat(future.isDone(), is(false)); + + flushDisplayEvents(); + + assertThat(future.isDone(), is(true)); + assertResult(future, is(true)); + } + + @Test + public void testShutdown() { + Future future = fixture.submit(new Task()); + + fixture.shutdown(); + + assertThat(fixture.isShutdown(), is(true)); + assertThat(fixture.isTerminated(), is(false)); + + flushDisplayEvents(); + + assertThat(fixture.isTerminated(), is(true)); + + // The task did execute + assertResult(future, is(true)); + } + + @Test + public void testShutdownNow() { + Future future = fixture.submit(new Task()); + + List cancelled = fixture.shutdownNow(); + + assertThat(cancelled.size(), is(1)); + + assertThat(fixture.isTerminated(), is(true)); + + assertThat(future.isDone(), is(false)); + } + + @Test + public void testAwaitTermination_finishes() { + Future future = fixture.submit(new Task()); + + fixture.shutdown(); + + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future waiter = executor.submit(new AwaitTermination(10)); + try { + flushDisplayEvents(); + + assertResult(waiter, is(true)); + + // The task did execute + assertResult(future, is(true)); + } finally { + executor.shutdown(); + } + } + + @Test + public void testAwaitTermination_timesOut() { + fixture.submit(new Task()); + + fixture.shutdown(); + + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future waiter = executor.submit(new AwaitTermination(1)); + + try { + assertResult(waiter, is(false)); + } finally { + executor.shutdown(); + } + } + + // + // Test framework + // + + @Before + public void createFixture() { + fixture = UIUtil.createUIExecutor(Display.getCurrent()); + } + + @After + public void disposeFixture() { + fixture.shutdown(); + fixture = null; + + // Ensure that any remaining runnables are processed + flushDisplayEvents(); + } + + void assertResult(Future future, Matcher assertion) { + try { + assertThat(future.get(), assertion); + } catch (Exception e) { + e.printStackTrace(); + fail("Failed to get future result: " + e.getLocalizedMessage()); + } + } + + private static class Task implements Callable { + + @Override + public Boolean call() { + return true; + } + } + + private class AwaitTermination implements Callable { + + private final int timeoutSeconds; + + public AwaitTermination(int timeoutSeconds) { + super(); + + this.timeoutSeconds = timeoutSeconds; + } + + @Override + public Boolean call() throws Exception { + return fixture.awaitTermination(timeoutSeconds, TimeUnit.SECONDS); + } + } + } + + // + // Shared test framework + // + + + static void flushDisplayEvents() { + for (;;) { + try { + if (!Display.getCurrent().readAndDispatch()) { + break; + } + } catch (Exception e) { + Bundle testBundle = FrameworkUtil.getBundle(UIUtilTest.class); + Platform.getLog(testBundle).log(new Status(IStatus.ERROR, testBundle.getSymbolicName(), "Uncaught exception in display runnable.", e)); + } + } + } + +} diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/META-INF/MANIFEST.MF index 3279d3cf40f..e3a8879a574 100644 --- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/META-INF/MANIFEST.MF @@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.106.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.ui.navigator;bundle-version="3.5.500", - com.google.guava;bundle-version="11.0.0" + com.google.guava;bundle-version="11.0.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.services.controlmode.tests, org.eclipse.papyrus.infra.services.controlmode.tests.control, org.eclipse.papyrus.infra.services.controlmode.tests.uncontrol diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/control/AbstractControlModeTest.java b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/control/AbstractControlModeTest.java index 9c456cf468b..12ec1bc0871 100644 --- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/control/AbstractControlModeTest.java +++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/control/AbstractControlModeTest.java @@ -26,14 +26,14 @@ import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.util.URI; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.services.controlmode.commands.ControlModeCommandParameterValues; import org.eclipse.papyrus.infra.services.controlmode.commands.ResourceLocationParameterValues; import org.eclipse.papyrus.infra.services.controlmode.handler.ControlCommandHandler; import org.eclipse.papyrus.infra.services.controlmode.tests.Messages; import org.eclipse.papyrus.infra.services.controlmode.tests.StrategyChooserFixture; import org.eclipse.papyrus.infra.services.controlmode.util.ControlHelper; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.HandlerUtils; import org.eclipse.papyrus.junit.utils.ModelExplorerUtils; diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/uncontrol/AbstractUncontrolModelTest.java b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/uncontrol/AbstractUncontrolModelTest.java index 90f6a939b8c..1a505ce2816 100644 --- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/uncontrol/AbstractUncontrolModelTest.java +++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.tests/src/org/eclipse/papyrus/infra/services/controlmode/tests/uncontrol/AbstractUncontrolModelTest.java @@ -22,12 +22,12 @@ import java.util.List; import org.eclipse.core.commands.Command; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.util.URI; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.services.controlmode.tests.Messages; import org.eclipse.papyrus.infra.services.controlmode.tests.StrategyChooserFixture; import org.eclipse.papyrus.infra.services.controlmode.util.ControlHelper; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.HandlerUtils; import org.eclipse.papyrus.junit.utils.ModelExplorerUtils; diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.edit.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.edit.tests/META-INF/MANIFEST.MF index efc0f94fcd1..377ed80efc1 100644 --- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.edit.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.edit.tests/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="3.8.0", org.eclipse.uml2.uml;bundle-version="5.0.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.infra.services.edit.tests, org.eclipse.papyrus.infra.services.edit.tests.commands, org.eclipse.papyrus.infra.services.edit.tests.context, diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF index 77f16df247f..9c3bee5815d 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF @@ -24,7 +24,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.e4.core.contexts;bundle-version="1.3.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable.common;bundle-version="1.2.0", - org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0" + org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.junit.matchers, org.eclipse.papyrus.junit.utils, org.eclipse.papyrus.junit.utils.resources, diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java index c50389d043b..a44656558aa 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java @@ -22,11 +22,11 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.View; -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; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.swt.graphics.RGB; import org.eclipse.uml2.uml.NamedElement; import org.junit.Assert; diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/EditorUtils.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/EditorUtils.java index 82737a957e5..576eece4810 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/EditorUtils.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/EditorUtils.java @@ -16,7 +16,7 @@ package org.eclipse.papyrus.junit.utils; import org.eclipse.core.resources.IFile; import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; @@ -81,17 +81,17 @@ public class EditorUtils { E result; boolean posted = false; - org.eclipse.papyrus.infra.core.internal.preferences.YesNo originalPreference = org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); - org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(org.eclipse.papyrus.infra.core.internal.preferences.YesNo.NO); + org.eclipse.papyrus.infra.ui.internal.preferences.YesNo originalPreference = org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().getConvertSharedPageLayoutToPrivate(); + org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(org.eclipse.papyrus.infra.ui.internal.preferences.YesNo.NO); try { result = editorOpener.openEditor(); - result.getSite().getShell().getDisplay().asyncExec(() -> org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(originalPreference)); + result.getSite().getShell().getDisplay().asyncExec(() -> org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(originalPreference)); posted = true; } finally { if (!posted) { // Revert now because the editor failed to open and we won't be reverting asynchronously - org.eclipse.papyrus.infra.core.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(originalPreference); + org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(originalPreference); } } diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java index d9d8bf6a5f7..e52615587ce 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java @@ -29,8 +29,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RunnableWithResult; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPage; import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView; import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView; diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java index 315c4c65a0b..13d90e49f78 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java @@ -44,9 +44,9 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.Duck; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java index f1fc26b563c..8e0113e53ba 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others. + * Copyright (c) 2014, 2016 CEA, 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,11 +8,7 @@ * * Contributors: * Christian W. Damus (CEA) - Initial API and implementation - * Christian W. Damus - bug 433206 - * Christian W. Damus - bug 465416 - * Christian W. Damus - bug 434983 - * Christian W. Damus - bug 483721 - * Christian W. Damus - bug 469188 + * Christian W. Damus - bugs 433206, 465416, 434983, 483721, 469188, 485220 * */ package org.eclipse.papyrus.junit.utils.rules; @@ -73,14 +69,13 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.sasheditor.editor.IComponentPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor; import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -91,6 +86,7 @@ import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.tools.util.PlatformHelper; import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.JUnitUtils; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; @@ -138,7 +134,7 @@ public class PapyrusEditorFixture extends AbstractModelFixture excludedTypeView = Arrays.asList(new String[] { "Note" }); @SuppressWarnings("restriction") - private org.eclipse.papyrus.infra.core.internal.preferences.YesNo initialEditorLayoutStorageMigrationPreference; + private org.eclipse.papyrus.infra.ui.internal.preferences.YesNo initialEditorLayoutStorageMigrationPreference; private IMultiDiagramEditor editor; @@ -185,8 +181,8 @@ public class PapyrusEditorFixture extends AbstractModelFixture it = EditPartUtilities.getAllChildren(getDiagramEditPart()).iterator(); - while(it.hasNext()) { + while (it.hasNext()) { EditPart editPart = it.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -91,9 +93,9 @@ public class EditorUtils { // Test diagram nested connections and look for the view @SuppressWarnings("unchecked") Iterator itLinks = EditPartUtilities.getAllNestedConnectionEditParts(getDiagramEditPart()).iterator(); - while(itLinks.hasNext()) { + while (itLinks.hasNext()) { EditPart editPart = itLinks.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -120,7 +122,7 @@ public class EditorUtils { public static TransactionalEditingDomain getTransactionalEditingDomain() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { return ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry); diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/utils/EditorUtils.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/utils/EditorUtils.java index 9d6187a9bce..72835d18f6d 100644 --- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/utils/EditorUtils.java +++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/utils/EditorUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012 CEA LIST. + * Copyright (c) 2012, 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,7 +8,8 @@ * * Contributors: * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.internalblock.tests.utils; @@ -26,6 +27,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -40,9 +42,9 @@ public class EditorUtils { public static InternalBlockDiagramForMultiEditor getDiagramEditor() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { - return (InternalBlockDiagramForMultiEditor)ServiceUtils.getInstance().getNestedActiveIEditorPart(serviceRegistry); + return (InternalBlockDiagramForMultiEditor) ServiceUtils.getInstance().getService(ISashWindowsContainer.class, serviceRegistry).getActiveEditor(); } catch (ServiceException e) { throw new Exception("Unable to retrieve service.", e); @@ -74,16 +76,16 @@ public class EditorUtils { public static EditPart getEditPart(View view) throws Exception { // Test if the container is the diagram itself first - if(getDiagramEditPart().getModel() == view) { + if (getDiagramEditPart().getModel() == view) { return getDiagramEditPart(); } // Test diagram children and look for the view @SuppressWarnings("unchecked") Iterator it = EditPartUtilities.getAllChildren(getDiagramEditPart()).iterator(); - while(it.hasNext()) { + while (it.hasNext()) { EditPart editPart = it.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -91,9 +93,9 @@ public class EditorUtils { // Test diagram nested connections and look for the view @SuppressWarnings("unchecked") Iterator itLinks = EditPartUtilities.getAllNestedConnectionEditParts(getDiagramEditPart()).iterator(); - while(itLinks.hasNext()) { + while (itLinks.hasNext()) { EditPart editPart = itLinks.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -120,7 +122,7 @@ public class EditorUtils { public static TransactionalEditingDomain getTransactionalEditingDomain() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { return ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry); diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF index e16e07aae6d..ccdef7fc379 100644 --- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF @@ -2,7 +2,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.sysml.diagram.parametric.tests.suites Bundle-Vendor: %providerName Fragment-Host: org.eclipse.papyrus.sysml.diagram.parametric;bundle-version="1.2.0" diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java index 81374de8140..cd38897e75b 100644 --- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java +++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012, 2014 CEA LIST and others. + * Copyright (c) 2012, 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 @@ -10,6 +10,7 @@ * * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 434993 + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.parametric.tests; @@ -20,7 +21,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; @@ -63,15 +64,15 @@ public abstract class AbstractTest4B extends AbstractPapyrusTest { } public static boolean setActiveDiagramViewByName(String diagramName) throws Exception { - if(diagramName == null) { + if (diagramName == null) { return false; } - ServicesRegistry serviceRegistry = (ServicesRegistry)EditorUtils.getEditor().getAdapter(ServicesRegistry.class); - IPageManager iPageManager = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + ServicesRegistry serviceRegistry = EditorUtils.getEditor().getAdapter(ServicesRegistry.class); + IPageManager iPageManager = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry); List allPages = iPageManager.allPages(); - for(Object object : allPages) { - if(object instanceof Diagram) { - if(diagramName.equals(((Diagram)object).getName())) { + for (Object object : allPages) { + if (object instanceof Diagram) { + if (diagramName.equals(((Diagram) object).getName())) { iPageManager.selectPage(object); return true; } diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java index 097a9f9a029..e7c1335fbd6 100644 --- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java +++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * 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 @@ -8,7 +8,8 @@ * * Contributors: * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.parametric.tests.utils; @@ -26,6 +27,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -40,9 +42,9 @@ public class EditorUtils { public static ParametricDiagramForMultiEditor getDiagramEditor() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { - return (ParametricDiagramForMultiEditor)ServiceUtils.getInstance().getNestedActiveIEditorPart(serviceRegistry); + return (ParametricDiagramForMultiEditor) ServiceUtils.getInstance().getService(ISashWindowsContainer.class, serviceRegistry).getActiveEditor(); } catch (ServiceException e) { throw new Exception("Unable to retrieve service.", e); @@ -74,16 +76,16 @@ public class EditorUtils { public static EditPart getEditPart(View view) throws Exception { // Test if the container is the diagram itself first - if(getDiagramEditPart().getModel() == view) { + if (getDiagramEditPart().getModel() == view) { return getDiagramEditPart(); } // Test diagram children and look for the view @SuppressWarnings("unchecked") Iterator it = EditPartUtilities.getAllChildren(getDiagramEditPart()).iterator(); - while(it.hasNext()) { + while (it.hasNext()) { EditPart editPart = it.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -91,9 +93,9 @@ public class EditorUtils { // Test diagram nested connections and look for the view @SuppressWarnings("unchecked") Iterator itLinks = EditPartUtilities.getAllNestedConnectionEditParts(getDiagramEditPart()).iterator(); - while(itLinks.hasNext()) { + while (itLinks.hasNext()) { EditPart editPart = itLinks.next(); - if(editPart.getModel() == view) { + if (editPart.getModel() == view) { return editPart; } } @@ -120,7 +122,7 @@ public class EditorUtils { public static TransactionalEditingDomain getTransactionalEditingDomain() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { return ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry); diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.allocation.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.allocation.tests/META-INF/MANIFEST.MF index 33c35d76452..ddccaa3ed57 100755 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.allocation.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.allocation.tests/META-INF/MANIFEST.MF @@ -7,13 +7,15 @@ Require-Bundle: org.junit;bundle-version="4.11.0", org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", org.eclipse.papyrus.sysml;bundle-version="1.2.0", org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", org.eclipse.emf.transaction;bundle-version="1.8.0", - org.eclipse.papyrus.junit.framework;bundle-version="1.2.0" + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;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" Export-Package: org.eclipse.papyrus.sysml.nattable.allocation.tests, org.eclipse.papyrus.sysml.nattable.allocation.tests.tests Bundle-Vendor: %Bundle-Vendor diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF index 67d62135ca8..0bd8edbce9a 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF @@ -22,14 +22,15 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.tools;bundle-version="1.2.0", org.eclipse.papyrus.uml.nattable;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf.nattable;bundle-version="1.2.0", org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0", - org.eclipse.ui.navigator;bundle-version="3.5.500" + org.eclipse.ui.navigator;bundle-version="3.5.500", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.sysml.nattable.requirement.tests, org.eclipse.papyrus.sysml.nattable.requirement.tests.tests Bundle-Vendor: %providerName diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractAxisChangeIndexTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractAxisChangeIndexTest.java index 84fea1cab63..701168bcdc5 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractAxisChangeIndexTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractAxisChangeIndexTest.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; @@ -32,7 +32,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle; import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.TableUtils; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractInvertedAxisChangeIndexTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractInvertedAxisChangeIndexTest.java index 8418e697072..c0bf770c0fa 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractInvertedAxisChangeIndexTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/bugs/AbstractInvertedAxisChangeIndexTest.java @@ -24,14 +24,14 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle; import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.handlers.RadioState; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/importfile/AbstractImportTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/importfile/AbstractImportTest.java index 42216bb84ad..86cccaf970c 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/importfile/AbstractImportTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/importfile/AbstractImportTest.java @@ -28,8 +28,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.ImportTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.sysml.nattable.requirement.tests.Activator; import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.AbstractPasteInsertTest; import org.eclipse.ui.IEditorPart; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/insert/AbstractInsertTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/insert/AbstractInsertTest.java index 5ea41eb97fe..5a5252bce65 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/insert/AbstractInsertTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/insert/AbstractInsertTest.java @@ -24,8 +24,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.sysml.nattable.requirement.tests.Activator; import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.AbstractPasteInsertTest; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java index 1482caa2b86..3318fab087f 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java @@ -26,8 +26,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.sysml.nattable.requirement.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java index 34b9489c8fe..367ecdcbfd3 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java @@ -24,8 +24,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.sysml.nattable.requirement.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java index cf523b65436..7dfe07989bf 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractOpenTableTest.java @@ -19,7 +19,7 @@ import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.editor.integration.tests.tests.AbstractEditorIntegrationTest; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java index ef67f3ccee0..ecc750ae1d3 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/without/service/edit/AbstractPasteTests.java @@ -40,8 +40,8 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfigurati import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration; import org.eclipse.papyrus.infra.nattable.utils.AxisConfigurationUtils; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.framework.classification.InvalidTest; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/OpenTableTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/OpenTableTest.java index c96980d7fde..0d03a80455a 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/OpenTableTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/OpenTableTest.java @@ -19,7 +19,7 @@ import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.editor.integration.tests.tests.AbstractEditorIntegrationTest; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java index c224787e94c..98bab38e7e3 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java @@ -29,7 +29,6 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; @@ -37,6 +36,7 @@ import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.DisplayUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInUMLModel.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInUMLModel.java index 2184890eccd..e73d62dffec 100644 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInUMLModel.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInUMLModel.java @@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.junit.utils.ModelExplorerUtils; diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF index cd4a098f913..11237b3f639 100644 --- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF @@ -19,7 +19,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", org.eclipse.papyrus.sysml.diagram.common;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.sysml.modelexplorer.tests, org.eclipse.papyrus.sysml.modelexplorer.tests.common, org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste, diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/utils/EditorUtils.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/utils/EditorUtils.java index c026ac2656d..f0111ede5bd 100644 --- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/utils/EditorUtils.java +++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/utils/EditorUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2011 CEA LIST. + * Copyright (c) 2011, 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: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.sysml.modelexplorer.tests.utils; @@ -15,6 +16,7 @@ package org.eclipse.papyrus.sysml.modelexplorer.tests.utils; import org.eclipse.emf.transaction.RunnableWithResult; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; @@ -33,7 +35,7 @@ public class EditorUtils { * * @return current active editor * @throws Exception - * exception thrown in case of issue + * exception thrown in case of issue */ public static IEditorPart getEditor() throws Exception { RunnableWithResult runnable; @@ -51,9 +53,9 @@ public class EditorUtils { public static DiagramEditor getDiagramEditor() throws Exception { - ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class); + ServicesRegistry serviceRegistry = getEditor().getAdapter(ServicesRegistry.class); try { - return (DiagramEditor)ServiceUtils.getInstance().getNestedActiveIEditorPart(serviceRegistry); + return (DiagramEditor) ServiceUtils.getInstance().getService(ISashWindowsContainer.class, serviceRegistry).getActiveEditor(); } catch (ServiceException e) { throw new Exception("Unable to retrieve service.", e); //$NON-NLS-1$ diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/META-INF/MANIFEST.MF index c2c9ebbe954..87c0c962b6a 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/META-INF/MANIFEST.MF @@ -14,13 +14,13 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0", org.eclipse.uml2.uml.editor, org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.tests.framework;bundle-version="1.2.0", - org.eclipse.xtend.lib;bundle-version="2.8.1" + org.eclipse.xtend.lib;bundle-version="2.8.1", + org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.activity.tests, org.eclipse.papyrus.uml.diagram.activity.tests.canonical;x-friends:="org.eclipse.papyrus.uml.diagram.interactionoverview.tests", org.eclipse.papyrus.uml.diagram.activity.tests.generation diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF index bad11df5405..07e2902d905 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF @@ -14,8 +14,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.ui.ide;bundle-version="3.10.0", org.eclipse.emf.common.ui;bundle-version="2.9.0", org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", @@ -28,7 +27,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.xtend.lib;bundle-version="2.8.3", com.google.guava;bundle-version="11.0.0", org.eclipse.xtext.xbase.lib;bundle-version="2.8.3", - org.eclipse.papyrus.tests.framework;bundle-version="1.2.0" + org.eclipse.papyrus.tests.framework;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" Export-Package: org.eclipse.papyrus.uml.diagram.clazz.test, org.eclipse.papyrus.uml.diagram.clazz.test.canonical, org.eclipse.papyrus.uml.diagram.clazz.test.load, diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/legacy/PackageDiagramLegacyTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/legacy/PackageDiagramLegacyTest.java index 656f3a1de4f..99d8012f4a0 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/legacy/PackageDiagramLegacyTest.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/legacy/PackageDiagramLegacyTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014, 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,8 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.test.legacy; @@ -16,9 +18,9 @@ import org.eclipse.core.resources.IProject; import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor; @@ -52,7 +54,7 @@ public class PackageDiagramLegacyTest extends AbstractPapyrusTest { houseKeeper.createFile(project, "package24.notation", "model/legacyPackage/package24.notation"); editor = houseKeeper.openPapyrusEditor(diFile); - pageManager = ServiceUtils.getInstance().getIPageManager(editor.getServicesRegistry()); + pageManager = ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()); } @Test @@ -68,10 +70,10 @@ public class PackageDiagramLegacyTest extends AbstractPapyrusTest { } protected Diagram getDiagram(String name) { - for(Object page : pageManager.allPages()) { - if(page instanceof Diagram) { - if(name.equals(((Diagram)page).getName())) { - return (Diagram)page; + for (Object page : pageManager.allPages()) { + if (page instanceof Diagram) { + if (name.equals(((Diagram) page).getName())) { + return (Diagram) page; } } } @@ -89,9 +91,9 @@ public class PackageDiagramLegacyTest extends AbstractPapyrusTest { pageManager.openPage(closedDiagram); - //Assert.assertEquals("PapyrusUMLClassDiagram", closedDiagram.getType()); + // Assert.assertEquals("PapyrusUMLClassDiagram", closedDiagram.getType()); - pageManager.selectPage(closedDiagram); //Workaround for an unrelated bug: the page is not immediately selected after it has been opened + pageManager.selectPage(closedDiagram); // Workaround for an unrelated bug: the page is not immediately selected after it has been opened IEditorPart closedDiagramEditor = editor.getActiveEditor(); @@ -99,7 +101,7 @@ public class PackageDiagramLegacyTest extends AbstractPapyrusTest { IEditorInput input = closedDiagramEditor.getEditorInput(); Assert.assertTrue(input instanceof URIEditorInput); - URIEditorInput uriInput = (URIEditorInput)input; + URIEditorInput uriInput = (URIEditorInput) input; Assert.assertTrue(uriInput.getURI().equals(EcoreUtil.getURI(closedDiagram))); } diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF index ac864f20661..07c3e5a0bd3 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF @@ -21,7 +21,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.tooling.runtime;bundle-version="3.3.0", org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.css.properties;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.edit + org.eclipse.papyrus.infra.services.edit, + org.eclipse.papyrus.infra.core.sasheditor;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" Export-Package: org.eclipse.papyrus.uml.diagram.common.tests, org.eclipse.papyrus.uml.diagram.common.tests.css, org.eclipse.papyrus.uml.diagram.common.tests.parser, diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite.tests/META-INF/MANIFEST.MF index 1a19b37edb4..954e3c1a106 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite.tests/META-INF/MANIFEST.MF @@ -18,7 +18,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.tests.framework;bundle-version="1.2.0", org.eclipse.xtend.lib;bundle-version="2.8.1", - org.eclipse.core.expressions + org.eclipse.core.expressions, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.composite.test, org.eclipse.papyrus.uml.diagram.composite.test.canonical, org.eclipse.papyrus.uml.diagram.composite.test.generation diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/META-INF/MANIFEST.MF index ba08d7dcc43..e0cb4d03b31 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0" + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.dnd.tests.tests Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java index 29508cf19b8..d8c8f7133f2 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java @@ -33,10 +33,10 @@ import org.eclipse.gef.commands.CommandStack; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.gmfdiag.common.utils.RequestUtils; import org.eclipse.papyrus.infra.gmfdiag.dnd.policy.DropStrategyManager; import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider; import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; import org.eclipse.papyrus.infra.widgets.providers.TreeToFlatContentProvider; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/META-INF/MANIFEST.MF index 913452695f5..77ba2b9e807 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core;bundle-version="1.1.0", org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.1.0", org.eclipse.papyrus.uml.tools;bundle-version="1.1.0", - org.eclipse.papyrus.uml.extensionpoints + org.eclipse.papyrus.uml.extensionpoints, + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/src/org/eclipse/papyrus/uml/diagram/paletteconfiguration/tests/regression/Bug457712PaletteConfigurationRequiredProfile.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/src/org/eclipse/papyrus/uml/diagram/paletteconfiguration/tests/regression/Bug457712PaletteConfigurationRequiredProfile.java index 3e260d2c6cb..bd7b95ee7d2 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/src/org/eclipse/papyrus/uml/diagram/paletteconfiguration/tests/regression/Bug457712PaletteConfigurationRequiredProfile.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.tests/src/org/eclipse/papyrus/uml/diagram/paletteconfiguration/tests/regression/Bug457712PaletteConfigurationRequiredProfile.java @@ -29,11 +29,11 @@ import org.eclipse.gef.ui.palette.PaletteViewer; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.ICreationCommand; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF index e0c5115b1bc..43eca150fff 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF @@ -23,10 +23,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.views.properties;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.tests.framework;bundle-version="1.2.0", - org.eclipse.xtend.lib;bundle-version="2.8.1" + org.eclipse.xtend.lib;bundle-version="2.8.1", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.sequence.tests, org.eclipse.papyrus.uml.diagram.sequence.tests.generation Bundle-Vendor: %Bundle-Vendor diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java index c1cef58f76d..fe0021c5602 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java @@ -44,7 +44,7 @@ import org.eclipse.gmf.runtime.notation.LayoutConstraint; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractPapyrusTestCase; import org.eclipse.swt.widgets.Display; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java index 5dab733f89c..3f91c565d9a 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java @@ -42,7 +42,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractPapyrusTestCase; import org.eclipse.swt.widgets.Display; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/META-INF/MANIFEST.MF index 2bf271bf407..ba21b44abfd 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/META-INF/MANIFEST.MF @@ -21,8 +21,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)" + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.stereotypeproperty Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/AbstractPapyrusTestCase.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/AbstractPapyrusTestCase.java index 741d93a6d83..cba2f68794e 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/AbstractPapyrusTestCase.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/AbstractPapyrusTestCase.java @@ -22,12 +22,12 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.ICreationCommand; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.DiResourceSet; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java index 84f7f8d5c4f..69728beba67 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java @@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.InvalidTest; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java index df37994c98f..4f2005b039c 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java @@ -18,7 +18,7 @@ import static org.junit.Assert.assertTrue; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java index 5d42394b52f..ab0e3e05f19 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java index 1e4be31c365..432fafaccc9 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java @@ -17,7 +17,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/META-INF/MANIFEST.MF index 632441532ee..ad3f3544795 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/META-INF/MANIFEST.MF @@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.css.properties;bundle-version="1.2.0", org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", org.eclipse.core.expressions;bundle-version="3.5.0", - org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0" + org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.tests.appearance, org.eclipse.papyrus.uml.diagram.tests.canonical, org.eclipse.papyrus.uml.diagram.tests.createFromPalette, diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/AbstractPapyrusTestCase.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/AbstractPapyrusTestCase.java index 7165ad23e49..95cb9a395e5 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/AbstractPapyrusTestCase.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/AbstractPapyrusTestCase.java @@ -50,7 +50,6 @@ import org.eclipse.gmf.runtime.notation.StringValueStyle; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.ICreationCommand; import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.NotFoundException; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; @@ -58,6 +57,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.DiResourceSet; import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/SharedTestSuiteState.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/SharedTestSuiteState.java index 0fdc3fbcad2..646bcdc2753 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/SharedTestSuiteState.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/SharedTestSuiteState.java @@ -31,12 +31,12 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.StringValueStyle; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.ICreationCommand; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.JUnitUtils; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/TestLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/TestLink.java index e2cf05d361d..3e5104a7e9d 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/TestLink.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.tests/src/org/eclipse/papyrus/uml/diagram/tests/canonical/TestLink.java @@ -55,7 +55,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater; import org.eclipse.papyrus.junit.utils.DisplayUtils; import org.eclipse.papyrus.junit.utils.rules.AnnotationRule; diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing.tests/META-INF/MANIFEST.MF index e41a8161f83..4ea0d1d2b19 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing.tests/META-INF/MANIFEST.MF @@ -16,11 +16,11 @@ Require-Bundle: org.eclipse.ui, org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.tests.framework;bundle-version="1.2.0", org.eclipse.papyrus.uml.diagram.tests;bundle-version="1.2.0", - org.eclipse.xtend.lib;bundle-version="2.8.1" + org.eclipse.xtend.lib;bundle-version="2.8.1", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.timing.tests, org.eclipse.papyrus.uml.diagram.timing.tests.canonical, org.eclipse.papyrus.uml.diagram.timing.tests.generation, diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/META-INF/MANIFEST.MF index 7d84133650a..0ba663165bd 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/META-INF/MANIFEST.MF @@ -18,10 +18,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", org.junit;bundle-version="4.10.0", org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", - org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0, - 4.0.0)", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", org.eclipse.papyrus.tests.framework;bundle-version="1.2.0", - org.eclipse.xtend.lib;bundle-version="2.8.1" + org.eclipse.xtend.lib;bundle-version="2.8.1", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.diagram.usecase.tests, org.eclipse.papyrus.uml.diagram.usecase.tests.canonical, org.eclipse.papyrus.uml.diagram.usecase.tests.generation diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java index 03cb406b3c4..4983026d6c8 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java @@ -45,8 +45,8 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.infra.gmfdiag.common.commands.CreateEditBasedElementCommand; +import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.uml2.uml.Element; diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF index 411d1218232..03237b10ceb 100644 --- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF @@ -19,7 +19,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.runtime.notation.edit, org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.2.0" + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.modelexplorer.tests, org.eclipse.papyrus.uml.modelexplorer.tests.paste Bundle-Vendor: %providerName diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/META-INF/MANIFEST.MF index 10a40f052ed..7f88b1333d8 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/META-INF/MANIFEST.MF @@ -26,7 +26,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide, org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.validation;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.validation;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" Export-Package: org.eclipse.papyrus.uml.nattable.clazz.config.tests, org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests Bundle-Vendor: %Bundle-Vendor diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/AbstractAxisChangeIndexTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/AbstractAxisChangeIndexTest.java index b76ece7756a..c727e5569f0 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/AbstractAxisChangeIndexTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/AbstractAxisChangeIndexTest.java @@ -32,7 +32,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfigurati import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle; import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum; import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.utils.rules.ActiveTable; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests.AbstractTableTest; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DeleteRequirementsWithNestedClassifier.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DeleteRequirementsWithNestedClassifier.java index 1a7741e3426..41da8dbafd6 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DeleteRequirementsWithNestedClassifier.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DeleteRequirementsWithNestedClassifier.java @@ -18,7 +18,7 @@ import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/EditInvalidPastedText_V1_V3_V1.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/EditInvalidPastedText_V1_V3_V1.java index 198c86b4ae9..5727ed91b99 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/EditInvalidPastedText_V1_V3_V1.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/EditInvalidPastedText_V1_V3_V1.java @@ -20,7 +20,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/MoveElementsTreeTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/MoveElementsTreeTableTest.java index 83621215c96..6908ae6eda6 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/MoveElementsTreeTableTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/MoveElementsTreeTableTest.java @@ -28,7 +28,7 @@ import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ViewerDropAdapter; import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/NoDepth0TreeFillingConfigurationTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/NoDepth0TreeFillingConfigurationTest.java index bf3d81965b9..82cfe217397 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/NoDepth0TreeFillingConfigurationTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/NoDepth0TreeFillingConfigurationTest.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/OpenAndDeleteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/OpenAndDeleteTest.java index e197cf7ec09..39923cfc2d6 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/OpenAndDeleteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/OpenAndDeleteTest.java @@ -22,7 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel; import org.eclipse.papyrus.infra.core.resource.IModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/RequirementsNestedClassifier.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/RequirementsNestedClassifier.java index aaa64822fcd..660e01b016c 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/RequirementsNestedClassifier.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/RequirementsNestedClassifier.java @@ -20,7 +20,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/filter/AbstractReopenFilteredTable.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/filter/AbstractReopenFilteredTable.java index 900dfdb669b..2ac6d7b3472 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/filter/AbstractReopenFilteredTable.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/filter/AbstractReopenFilteredTable.java @@ -17,7 +17,7 @@ import java.util.List; import org.eclipse.emf.common.util.URI; import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/importfile/AbstractImportTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/importfile/AbstractImportTest.java index ecde1622778..3f61810a254 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/importfile/AbstractImportTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/importfile/AbstractImportTest.java @@ -27,8 +27,8 @@ import org.eclipse.papyrus.infra.nattable.handler.ImportTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteInsertTest; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/insert/AbstractInsertTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/insert/AbstractInsertTest.java index 526755baaf5..10a475a3c6f 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/insert/AbstractInsertTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/insert/AbstractInsertTest.java @@ -25,8 +25,8 @@ import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.Activator; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteInsertTest; import org.eclipse.ui.IEditorPart; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java index a5edf4e073e..8a58af6089e 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java @@ -28,8 +28,8 @@ import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteInsertTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteInsertTest.java index ffc06a101c3..9eb66c88835 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteInsertTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteInsertTest.java @@ -32,7 +32,7 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; @@ -47,8 +47,8 @@ import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum; import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils; import org.eclipse.papyrus.infra.nattable.utils.StyleUtils; import org.eclipse.papyrus.infra.nattable.utils.TableClipboardUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.Activator; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteOverwriteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteOverwriteTest.java index 44bf08e25ec..4672d95bf16 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteOverwriteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/AbstractPasteOverwriteTest.java @@ -25,8 +25,8 @@ import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/tests/AbstractPasteWithCategoriesTests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/tests/AbstractPasteWithCategoriesTests.java index 2475609469b..8c40e5a636b 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/tests/AbstractPasteWithCategoriesTests.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/tests/AbstractPasteWithCategoriesTests.java @@ -35,7 +35,7 @@ import org.eclipse.papyrus.commands.CheckedOperationHistory; import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; @@ -58,8 +58,8 @@ import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils; import org.eclipse.papyrus.infra.nattable.utils.PasteSeverityCode; import org.eclipse.papyrus.infra.nattable.utils.StyleUtils; import org.eclipse.papyrus.infra.nattable.utils.TableClipboardUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.utils.EditorUtils; import org.eclipse.papyrus.junit.utils.GenericUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.Activator; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/styles/AbstractResizeHeaderTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/styles/AbstractResizeHeaderTest.java index c52af6f9c3a..f78e277c5db 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/styles/AbstractResizeHeaderTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/styles/AbstractResizeHeaderTest.java @@ -17,7 +17,7 @@ import java.util.List; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AbstractOpenTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AbstractOpenTableTest.java index 503ac7849ac..cb28d3bb70d 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AbstractOpenTableTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AbstractOpenTableTest.java @@ -19,7 +19,7 @@ import org.eclipse.papyrus.commands.OpenDiagramCommand; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.editor.integration.tests.tests.AbstractEditorIntegrationTest; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/ContentsAndExpandWithoutCategories_H0_H1_H2_Tests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/ContentsAndExpandWithoutCategories_H0_H1_H2_Tests.java index 7b47c71fc76..09de614baff 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/ContentsAndExpandWithoutCategories_H0_H1_H2_Tests.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/ContentsAndExpandWithoutCategories_H0_H1_H2_Tests.java @@ -15,8 +15,7 @@ package org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests; import java.util.List; -//import org.eclipse.core.runtime.Assert; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/AbstractUnsetCellValueTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/AbstractUnsetCellValueTest.java index be20ff5cfb1..1d8d599be45 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/AbstractUnsetCellValueTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/AbstractUnsetCellValueTest.java @@ -18,7 +18,7 @@ import java.util.Collections; import org.eclipse.core.commands.Command; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests.AbstractTableTest; import org.junit.Assert; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValueWithProfile_V1_V3_V1_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValueWithProfile_V1_V3_V1_Test.java index f5ccab2f5b5..90b3c71bdcc 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValueWithProfile_V1_V3_V1_Test.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValueWithProfile_V1_V3_V1_Test.java @@ -25,7 +25,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemA import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; -import org.eclipse.papyrus.infra.tools.util.SelectionHelper; +import org.eclipse.papyrus.infra.ui.util.SelectionHelper; import org.eclipse.papyrus.junit.utils.rules.ActiveTable; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.uml2.uml.Class; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValue_H1_H3_H1_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValue_H1_H3_H1_Test.java index 7ee6ab19f2e..65faa3e8524 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValue_H1_H3_H1_Test.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/unset/UnsetCellValue_H1_H3_H1_Test.java @@ -21,7 +21,7 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; -import org.eclipse.papyrus.infra.tools.util.SelectionHelper; +import org.eclipse.papyrus.infra.ui.util.SelectionHelper; import org.eclipse.papyrus.junit.utils.rules.ActiveTable; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.uml2.uml.Class; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/META-INF/MANIFEST.MF index dafc6e5864a..d77cafc9c7e 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/META-INF/MANIFEST.MF @@ -8,8 +8,7 @@ Require-Bundle: org.junit;bundle-version="4.11.0", org.eclipse.uml2.uml, org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", org.eclipse.gmf.runtime.diagram.ui, - org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0, - 2.0.0)", + org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.infra.nattable;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", org.eclipse.emf.common, @@ -22,7 +21,10 @@ Require-Bundle: org.junit;bundle-version="4.11.0", org.eclipse.papyrus.infra.nattable.common;bundle-version="1.2.0", org.eclipse.papyrus.uml.nattable.generic.config;bundle-version="1.2.0", org.eclipse.papyrus.uml.nattable;bundle-version="1.2.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0" + org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", + org.eclipse.papyrus.infra.ui;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0" Export-Package: org.eclipse.papyrus.uml.nattable.generic.tests.tests Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractAxisChangeIndexTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractAxisChangeIndexTest.java index 2a9b4b22561..dc31a79c7ce 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractAxisChangeIndexTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractAxisChangeIndexTest.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; @@ -32,7 +32,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle; import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.TableUtils; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractInvertedAxisChangeIndexTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractInvertedAxisChangeIndexTest.java index 8d6f94d8c6f..9210a4acd41 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractInvertedAxisChangeIndexTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AbstractInvertedAxisChangeIndexTest.java @@ -24,14 +24,14 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle; import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.handlers.RadioState; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AddElementsOnConnectedTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AddElementsOnConnectedTableTest.java index 009ccd0c3c0..0c7d68d4b60 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AddElementsOnConnectedTableTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/AddElementsOnConnectedTableTest.java @@ -24,7 +24,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.TableUtils; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/CellEditorsConfigurationTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/CellEditorsConfigurationTest.java index ba97e96eda6..0a71fc5c269 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/CellEditorsConfigurationTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/CellEditorsConfigurationTest.java @@ -16,7 +16,7 @@ package org.eclipse.papyrus.uml.nattable.generic.tests.bugs; import java.util.List; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; @@ -156,7 +156,7 @@ public class CellEditorsConfigurationTest extends AbstractPapyrusTest { Assert.assertNotEquals("The tenth cell must have at least one cell editor configuration", 0, cell9.getConfigLabels().getLabels().size()); Assert.assertEquals("The tenth cell editor must be an UMLStereotypeMultiUnlimitedNaturalCellEditorConfiguration", "org.eclipse.papyrus.uml.nattable.celleditor.configuration.UMLStereotypeMultiUnlimitedNaturalCellEditorConfiguration.MultiEditor9", //$NON-NLS-1$ //$NON-NLS-2$ cell9.getConfigLabels().getLabels().get(0)); - + // The eleventh cell must be an UMLStereotypeSingleUMLReferenceCellEditorConfiguration ILayerCell cell10 = currentManager.getBodyLayerStack().getCellByPosition(10, 0); Assert.assertNotEquals("The eleventh cell must have config labels", null, cell10.getConfigLabels()); diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/OpenAndDeleteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/OpenAndDeleteTest.java index e2960c80b74..c517934ab63 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/OpenAndDeleteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/bugs/OpenAndDeleteTest.java @@ -22,7 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel; import org.eclipse.papyrus.infra.core.resource.IModel; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/importfile/AbstractImportTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/importfile/AbstractImportTest.java index 0a49c140f60..6dc078fc3f4 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/importfile/AbstractImportTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/importfile/AbstractImportTest.java @@ -26,8 +26,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.ImportTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.AbstractPasteInsertTest; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/insert/AbstractInsertTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/insert/AbstractInsertTest.java index d735eaf344a..8779e83a5a7 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/insert/AbstractInsertTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/insert/AbstractInsertTest.java @@ -24,8 +24,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.generic.tests.Activator; import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.AbstractPasteInsertTest; import org.eclipse.ui.IEditorPart; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java index ae2ca858a8e..cc15369d0f9 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteEmptyOverwriteTest.java @@ -26,8 +26,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.generic.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java index 46b6da4b72e..c95821ed365 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java @@ -24,8 +24,8 @@ import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; -import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; import org.eclipse.papyrus.uml.nattable.generic.tests.Activator; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.commands.ICommandService; diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF index 17eb6108d31..3715265e7dd 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF @@ -22,7 +22,10 @@ Require-Bundle: org.junit;bundle-version="4.11.0", org.eclipse.core.expressions, org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0", org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", - org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0" + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.sasheditor;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" Export-Package: org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java index 5e04ca5e24e..62c24f9d867 100644 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST. - * + * 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 @@ -9,6 +8,7 @@ * * Contributors: * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests; @@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; @@ -61,7 +61,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { * The class diagram name. */ private static final String CLASS_DIAGRAM_NAME = "ClassDiagram"; - + /** * The component diagram name. */ @@ -81,7 +81,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { * The component name. */ private static final String COMPONENT1_NAME = "Component1"; - + /** * The port name. */ @@ -181,7 +181,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { error = new StringBuilder(COMPONENT1_NAME); error.append(" doesn't exist"); Assert.assertNotNull(error.toString(), component1); - port1 = (org.eclipse.uml2.uml.Port) component1.getOwnedPort(PORT1_NAME, null); + port1 = component1.getOwnedPort(PORT1_NAME, null); error = new StringBuilder(PORT1_NAME); error.append(" doesn't exist"); Assert.assertNotNull(error.toString(), port1); @@ -367,7 +367,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), COMPONENT_DIAGRAM_NAME); editorFixture.getPageManager().openPage(mainDiagram); Assert.assertEquals("Current opened diagram is not the expected one", COMPONENT_DIAGRAM_NAME, mainDiagram.getName()); - + // Get the interface view final View component1View = DiagramUtils.findShape(mainDiagram, COMPONENT1_NAME); Assert.assertNotNull("Component view not present", component1View); @@ -408,7 +408,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { editorFixture.deselect(portEP); editorFixture.flushDisplayEvents(); } - + /** * This allow to test the stereotype display for the association object. * @@ -421,7 +421,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); editorFixture.getPageManager().openPage(mainDiagram); Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); - + // Get the interface view final View associationView = DiagramUtils.findEdge(mainDiagram, ASSOCIATION1_NAME); Assert.assertNotNull("Association view not present", associationView); @@ -460,7 +460,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { editorFixture.deselect(associationEP); editorFixture.flushDisplayEvents(); } - + /** * This allow to test the stereotype display for the time observation object. * @@ -473,7 +473,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); editorFixture.getPageManager().openPage(mainDiagram); Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); - + // Get the interface view final View timeObservationView = DiagramUtils.findShape(mainDiagram, TIME_OBSERVATION1_NAME); Assert.assertNotNull("Time Observation view not present", timeObservationView); @@ -487,7 +487,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { final StringBuilder error = new StringBuilder("The object selected is not the "); error.append(TIME_OBSERVATION1_NAME); Assert.assertEquals(error.toString(), timeObservationEP, editorSelection); - + // Create the table final ITreeNattableModelManager manager = createTable(timeObservationView); @@ -512,15 +512,17 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { editorFixture.deselect(timeObservationEP); editorFixture.flushDisplayEvents(); } - + /** * This allow to create the table and the nattable manager. * - * @param context The context of the table. + * @param context + * The context of the table. * @return The created nattable manager. - * @throws Exception The exception. + * @throws Exception + * The exception. */ - public ITreeNattableModelManager createTable(final View context) throws Exception{ + public ITreeNattableModelManager createTable(final View context) throws Exception { ITreeNattableModelManager manager = null; // Create the table from the selected class in the diagram @@ -531,11 +533,11 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { final IEditorPart timeObservationTableEditor = editorFixture.getEditor().getActiveEditor(); Assert.assertTrue(timeObservationTableEditor instanceof NatTableEditor); manager = (ITreeNattableModelManager) timeObservationTableEditor.getAdapter(INattableModelManager.class); - + // expand the table manager.doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); editorFixture.flushDisplayEvents(); - + return manager; } @@ -565,7 +567,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest { model.addPapyrusTable(editorModel); // Get the manager allowing to add/open new editor. - final IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + final IPageManager pageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry); pageMngr.openPage(editorModel); } catch (Exception e) { Activator.log.error(e); diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/AbstractCreateRelationshipTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/AbstractCreateRelationshipTest.java index d3a53256e12..9cba68e67ac 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/AbstractCreateRelationshipTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/AbstractCreateRelationshipTest.java @@ -29,12 +29,12 @@ import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.newchild.SetTargetAndRelationshipCommand; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.widgets.editors.ITreeSelectorDialog; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.uml.service.types.tests.creation.auxtests.IAuxTest; diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java index e68937c0407..4eb88c1a001 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java @@ -33,7 +33,6 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; @@ -41,6 +40,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/MoveElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/MoveElementTest.java index 8c8aed1748b..ee8435ca035 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/MoveElementTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/MoveElementTest.java @@ -32,7 +32,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; @@ -40,6 +39,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/SetFeatureTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/SetFeatureTest.java index 5e4341d40b5..6b5274e0b05 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/SetFeatureTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/SetFeatureTest.java @@ -33,7 +33,6 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.ModelUtils; import org.eclipse.papyrus.infra.core.resource.NotFoundException; @@ -41,6 +40,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteAssociationTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteAssociationTest.java index 6053039698c..b3ea061e300 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteAssociationTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteAssociationTest.java @@ -22,11 +22,11 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.uml2.uml.Association; diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF index 3b0be2bfd6a..052609b9063 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF @@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", org.eclipse.papyrus.infra.nattable.model;bundle-version="1.2.0", - org.eclipse.papyrus.infra.tools;bundle-version="1.2.0" + org.eclipse.papyrus.infra.tools;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" Export-Package: org.eclipse.papyrus.views.modelexplorer.tests Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java index 9a08a9fbf52..cb4a8124b86 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java @@ -1,6 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * + * Copyright (c) 2012, 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 @@ -9,6 +8,7 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.tests; @@ -33,12 +33,12 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization; import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.ui.editor.CoreMultiDiagramEditor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView; @@ -194,12 +194,12 @@ public abstract class AbstractHandlerTest extends AbstractPapyrusTest { /** * * @return - * the diagrams owned by the IPageMngr + * the diagrams owned by the IPageMngr * @throws ServiceException */ protected List getDiagrams() throws ServiceException { - IPageManager pageManager = ServiceUtilsForResourceSet.getInstance().getIPageManager(editorFixture.getResourceSet()); + IPageManager pageManager = ServiceUtilsForResourceSet.getInstance().getService(IPageManager.class, editorFixture.getResourceSet()); List pages = pageManager.allPages(); List diagrams = new ArrayList(); for (Object current : pages) { @@ -213,12 +213,12 @@ public abstract class AbstractHandlerTest extends AbstractPapyrusTest { /** * * @return - * the diagrams owned by the IPageMngr + * the diagrams owned by the IPageMngr * @throws ServiceException */ protected List getTables() throws ServiceException { - IPageManager pageManager = ServiceUtilsForResourceSet.getInstance().getIPageManager(editorFixture.getResourceSet()); + IPageManager pageManager = ServiceUtilsForResourceSet.getInstance().getService(IPageManager.class, editorFixture.getResourceSet()); List pages = pageManager.allPages(); List
diagrams = new ArrayList
(); for (Object current : pages) { diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java index 1c0c14c424c..c2e7cddf801 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java @@ -30,7 +30,7 @@ import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy. import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; -import org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper; +import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView; import org.eclipse.swt.widgets.Display; -- cgit v1.2.3