Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-07 16:45:19 +0000
committerCamille Letavernier2014-03-07 16:45:19 +0000
commit2029d305ac0457f9de0c79eeadf5865bc90d1e89 (patch)
tree332e2dc303c507d6a50c7537483c89c5e36a3ee2 /plugins/infra
parent2e78449cd38c9307bd45e114fcb8bd28b98f8dd2 (diff)
parent8812639e3fcf949d67e43f9a53182ff241c329a5 (diff)
downloadorg.eclipse.papyrus-2029d305ac0457f9de0c79eeadf5865bc90d1e89.tar.gz
org.eclipse.papyrus-2029d305ac0457f9de0c79eeadf5865bc90d1e89.tar.xz
org.eclipse.papyrus-2029d305ac0457f9de0c79eeadf5865bc90d1e89.zip
Merge remote-tracking branch 'eclipse/master' into 386118-emf-facet
Conflicts: plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.querySet plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/resources/SysMLDefaultExplorerCustomization.uiCustom plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/resources/SysMLDefaultExplorerQueries.querySet plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/resource/PapyrusBrowserQuery.querySet plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/resource/PapyrusUMLFacet.facetSet plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/resource/SimpleUML.uiCustom plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/resource/UMLPapyrusDefaultBrowserCustomization.uiCustom
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF8
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/Activator.java69
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelManager.java73
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngr.java25
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/TransactionalDiSashModelMngr.java133
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseAllDiagramsCommand.java62
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java33
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java25
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImpl.java59
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImpl.java56
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider.java211
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java138
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageMngrImpl.java204
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java63
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/model/di.ecore2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/plugin.xml7
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiFactory.java1
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/DiPackage.java8
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/PageList.java1
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/SashWindowsMngr.java24
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiFactoryImpl.java2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/DiPackageImpl.java6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/PageRefImpl.java61
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/impl/SashModelImpl.java81
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/util/DiUtils.java34
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageManager.java51
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java11
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml15
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/schema/model.exsd373
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/schema/sashModelProvider.exsd110
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java92
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelManagerServiceFactory.java22
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/DiSashModelMngrServiceFactory.java15
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java70
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModel.java20
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java78
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java103
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IEMFModel.java25
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IModel.java42
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java32
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java80
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/AbstractSashModelProvider.java50
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java97
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/ISashModelProvider.java32
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java177
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelProviderManager.java219
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java24
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java25
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml3
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/SashModelReadOnlyHandler.java75
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/xtend-gen/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.java14
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java58
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java70
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.facetSet4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.querySet6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java16
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/adapter/NattableAdapterFactory.java39
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java103
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java26
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java58
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes/plugin.xml2
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java90
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java79
-rw-r--r--plugins/infra/queries/org.eclipse.papyrus.infra.queries.core.configuration/model/Configuration.genmodel12
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.history/src/org/eclipse/papyrus/infra/services/controlmode/history/HistoryModel.java26
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/InitializeSashCommand.java14
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.openelement/src/org/eclipse/papyrus/infra/services/openelement/service/impl/OpenElementServiceImpl.java56
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java20
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/EcoreDiagnostician.java11
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java8
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java9
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AsyncValidateSubtreeCommand.java56
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/Messages.java21
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateModelCommand.java7
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateSubtreeCommand.java7
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromModelCommand.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromSubtreeCommand.java3
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateModelCommand.java3
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateSubtreeCommand.java3
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/messages.properties7
83 files changed, 2610 insertions, 1469 deletions
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 f4820a98d27..6501e5b761d 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
@@ -1,11 +1,12 @@
Manifest-Version: 1.0
Require-Bundle: org.eclipse.swt;bundle-version="3.5.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0";visibility:=reexport,
+ org.eclipse.papyrus.infra.core.sasheditor;visibility:=reexport;bundle-version="1.0.0",
org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0"
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.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.utils,
@@ -20,7 +21,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.di;sing
- leton:=true
+Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.di;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/Activator.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/Activator.java
new file mode 100644
index 00000000000..35294f623b2
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/Activator.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.core.sasheditor.di"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * 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);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
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 cf9a51fe027..28493de46e8 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,7 +1,7 @@
/*****************************************************************************
* 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
@@ -27,6 +27,8 @@ import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.DiC
import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.ICurrentFolderAndPageMngr;
import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl;
import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalDiContentProvider;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalPageManagerImpl;
+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.util.DiUtils;
@@ -35,9 +37,9 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
/**
* Class used as main entry point to access a sash model build on EMF / di
* This class allows to get facade objects on the diSashModel.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class DiSashModelManager {
@@ -67,9 +69,9 @@ public class DiSashModelManager {
/**
- *
+ *
* Constructor.
- *
+ *
* @param pageModelFactory
* @param diResource
* @param currentFolderAndPageMngr
@@ -100,13 +102,13 @@ public class DiSashModelManager {
transDiContentProvider = new TransactionalDiContentProvider(getDiContentProvider(), editingDomain);
// Create the TransactionalPageMngrImpl
- pageMngr = new PageManagerImpl(sashWindowMngr, contentChangedEventProvider, currentFolderAndPageMngr);
+ pageMngr = new TransactionalPageManagerImpl(sashWindowMngr, contentChangedEventProvider, currentFolderAndPageMngr);
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param pageModelFactory
* @param diResource
* @param currentFolderAndPageMngr
@@ -120,17 +122,18 @@ public class DiSashModelManager {
// Create a default model and attach it to resource.
sashWindowMngr = createDefaultSashModel();
- // Create a command
- RecordingCommand cmd = new RecordingCommand(editingDomain) {
+ try {
+ TransactionHelper.run(editingDomain, new Runnable() {
- @Override
- protected void doExecute() {
- diResource.getContents().add(sashWindowMngr);
- }
- };
- // Execute command
- editingDomain.getCommandStack().execute(cmd);
+ @Override
+ public void run() {
+ diResource.getContents().add(sashWindowMngr);
+ };
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
contentProvider = new DiContentProvider(sashWindowMngr.getSashModel(), pageModelFactory, getContentChangedEventProvider());
@@ -138,12 +141,12 @@ public class DiSashModelManager {
transDiContentProvider = new TransactionalDiContentProvider(getDiContentProvider(), editingDomain);
// Create the TransactionalPageMngrImpl
- pageMngr = new PageManagerImpl(sashWindowMngr, getContentChangedEventProvider());
+ pageMngr = new TransactionalPageManagerImpl(sashWindowMngr, getContentChangedEventProvider());
}
/**
- *
+ *
* @param currentFolderAndPageMngr
*/
public void setCurrentFolderAndPageMngr(ICurrentFolderAndPageMngr currentFolderAndPageMngr) {
@@ -152,7 +155,7 @@ public class DiSashModelManager {
/**
* Set the CurrentFolderAndPageManager as an instance of {@link CurrentFolderAndPageManager}
- *
+ *
* @param currentFolderAndPageMngr
*/
public void setCurrentFolderAndPageMngr(ISashWindowsContainer sashWindowsContainer) {
@@ -160,24 +163,24 @@ public class DiSashModelManager {
}
/**
- *
+ *
* Constructor.
* Only create a {@link IPageMngr} impl. Do not create the DiContentProvider as there is no factory provided.
* Internal use.
- *
+ *
* @param pageModelFactory
* @param diResource
*/
// private DiSashModelManager(final Resource diResource, TransactionalEditingDomain editingDomain, ICurrentFolderAndPageMngr currentFolderAndPageMngr) {
// this(null, diResource, editingDomain, currentFolderAndPageMngr);
- //
+ //
// }
/**
* Get the internal EMF implementation.
* Intended to be used by tests.
- *
+ *
* @return the sashWindowMngr
*/
protected SashWindowsMngr getDiSashWindowsMngr() {
@@ -189,7 +192,7 @@ public class DiSashModelManager {
* Return the internal implementation of ContentProvider.
* Create if if needed.
* This method should not be subclassed
- *
+ *
* @return the contentProvider
*/
protected DiContentProvider getDiContentProvider() {
@@ -200,7 +203,7 @@ public class DiSashModelManager {
* Return the internal implementation of ContentProvider.
* Create if if needed.
* This method should not be subclassed
- *
+ *
* @return the contentProvider
*/
protected TransactionalDiContentProvider getTransactionalDiContentProvider() {
@@ -211,7 +214,7 @@ public class DiSashModelManager {
* Return the internal implementation of PageMngr.
* Create if if needed.
* This method should not be subclassed
- *
+ *
* @return the PageMngrImpl
*/
protected final PageManagerImpl getPageManagerImpl() {
@@ -222,7 +225,7 @@ public class DiSashModelManager {
* Return the internal implementation of ContentChangedEventProvider.
* Create if if needed.
* This method should not be subclassed
- *
+ *
* @return the PageMngrImpl
*/
protected final ContentChangedEventProvider getContentChangedEventProvider() {
@@ -235,7 +238,7 @@ public class DiSashModelManager {
/**
* Get the IPageMngr providing basic methods to manage Pages in the sash model.
- *
+ *
* @return
*/
public IPageMngr getIPageMngr() {
@@ -244,7 +247,7 @@ public class DiSashModelManager {
/**
* Get the IPageManager providing basic methods to manage Pages in the sash model.
- *
+ *
* @return
*/
public IPageManager getIPageManager() {
@@ -254,7 +257,7 @@ public class DiSashModelManager {
/**
* Get the ContentProvider used by the SashWindows system.
* This class can also be used to accurately manage the sash model.
- *
+ *
* @return
*/
public ISashWindowsContentProvider getISashWindowsContentProvider() {
@@ -265,7 +268,7 @@ public class DiSashModelManager {
/**
* Get the ContentChangedProvider for the SashModel
- *
+ *
* @return
*/
public IContentChangedProvider getSashModelContentChangedProvider() {
@@ -274,7 +277,7 @@ public class DiSashModelManager {
/**
* Create a default model with one window and one folder.
- *
+ *
* @param diResource
* @return
*/
@@ -284,7 +287,7 @@ public class DiSashModelManager {
/**
* Lookup for the SashModel object in the resource
- *
+ *
* @param diResource
* @return
*/
@@ -296,7 +299,7 @@ public class DiSashModelManager {
/**
* 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 version of the IPageMngr
*/
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 bc5b11d2c3f..7044b711ed3 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
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
+ * 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
@@ -16,11 +16,12 @@ 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.IPageMngr;
+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.PageMngrImpl;
+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.util.DiUtils;
@@ -38,13 +39,13 @@ public class DiSashModelMngr {
/**
* Instance of the pageMngr.
*/
- private PageMngrImpl pageMngr = null;
+ private PageManagerImpl pageMngr = null;
/**
* Instance of the DiContentProvider used to manipulate SashModel.
*/
private DiContentProvider contentProvider;
-
+
/**
* Object used externally listen to model changes.
* The object is also used internally to control how events are fired (limit multiple events).
@@ -59,6 +60,7 @@ public class DiSashModelMngr {
* Constructor.
* Create a DiSashModelMngr with the specified factory. A SashModel is created but not attached to a resource.
* This constructor is for subclasses. The subclasses should initialize the sashWindowMngr
+ *
* @param pageModelFactory
* @param createDefaultSashModel
* If true, create the default SashModel by calling {@link #createDefaultSashModel()}
@@ -66,8 +68,7 @@ public class DiSashModelMngr {
protected DiSashModelMngr(IPageModelFactory pageModelFactory, boolean createDefaultSashModel) {
this.pageModelFactory = pageModelFactory;
// Create a SashModel
- if(createDefaultSashModel)
- {
+ if(createDefaultSashModel) {
sashWindowMngr = createDefaultSashModel();
}
}
@@ -148,9 +149,9 @@ public class DiSashModelMngr {
*
* @return the PageMngrImpl
*/
- protected final PageMngrImpl getPageMngrImpl() {
+ protected final PageManagerImpl getPageMngrImpl() {
if(pageMngr == null) {
- pageMngr = new PageMngrImpl(sashWindowMngr, getContentChangedEventProvider());
+ pageMngr = new TransactionalPageManagerImpl(sashWindowMngr, getContentChangedEventProvider());
}
return pageMngr;
@@ -176,7 +177,7 @@ public class DiSashModelMngr {
*
* @return
*/
- public IPageMngr getIPageMngr() {
+ public IPageManager getIPageMngr() {
return getPageMngrImpl();
}
@@ -229,7 +230,7 @@ public class DiSashModelMngr {
* @param diResource
* @return The non transactional version of the IPageMngr
*/
- public static IPageMngr createIPageMngr(Resource diResource) {
+ public static IPageManager createIPageMngr(Resource diResource) {
// Create an instance of the DiSashModelMngr with no factory.
// The factory is not needed since we don't get the ISashWindowsContentProvider.
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/TransactionalDiSashModelMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/TransactionalDiSashModelMngr.java
deleted file mode 100644
index 7c970315986..00000000000
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/TransactionalDiSashModelMngr.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider;
-
-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.IPageMngr;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalDiContentProvider;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.TransactionalPageMngrImpl;
-
-
-/**
- * DiSashModelMngr providing transactional commands to modify SashModel.
- *
- * @author cedric dumoulin
- *
- */
-public class TransactionalDiSashModelMngr extends DiSashModelMngr {
-
- private TransactionalDiContentProvider transDiContentProvider;
-
- private TransactionalPageMngrImpl transPageMngrImpl;
-
- /**
- *
- * Constructor.
- *
- * @param pageModelFactory
- * @param diResource
- */
- public TransactionalDiSashModelMngr(IPageModelFactory pageModelFactory, final Resource diResource, TransactionalEditingDomain editingDomain) {
- super(pageModelFactory, false);
-
-
-
- // lookup the SashModel
- sashWindowMngr = lookupSashWindowMngr(diResource);
- // If no SashWindow structure is found, create a new one using a transaction.
- if(sashWindowMngr == null) {
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- // Create a default model and attach it to resource.
- sashWindowMngr = createDefaultSashModel();
- diResource.getContents().add(sashWindowMngr);
- }
- };
- editingDomain.getCommandStack().execute(command);
- }
-
- // Create the TransactionalDiContentProvider
- transDiContentProvider = new TransactionalDiContentProvider(getDiContentProvider(), editingDomain);
-
- // Create the TransactionalPageMngrImpl
- transPageMngrImpl = new TransactionalPageMngrImpl(getPageMngrImpl(), editingDomain);
- }
-
- /**
- *
- * Constructor.
- * Only create a {@link IPageMngr} impl. Do not create the DiContentProvider as there is no factory provided.
- * Internal use.
- *
- * @param pageModelFactory
- * @param diResource
- */
- private TransactionalDiSashModelMngr(final Resource diResource, TransactionalEditingDomain editingDomain) {
- super(null, false);
-
- // lookup the SashModel
- sashWindowMngr = lookupSashWindowMngr(diResource);
- // If no SashWindow structure is found, create a new one using a transaction.
- if(sashWindowMngr == null) {
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- // Create a default model and attach it to resource.
- sashWindowMngr = createDefaultSashModel();
- diResource.getContents().add(sashWindowMngr);
- }
- };
- editingDomain.getCommandStack().execute(command);
- }
-
- // Create the TransactionalPageMngrImpl
- transPageMngrImpl = new TransactionalPageMngrImpl(getPageMngrImpl(), editingDomain);
- }
-
- /**
- * Return the transactional version
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getISashWindowsContentProvider()
- * @return
- *
- */
- @Override
- public ISashWindowsContentProvider getISashWindowsContentProvider() {
- return transDiContentProvider;
- }
-
- /**
- * Return the transactional version
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getIPageMngr()
- *
- * @return
- */
- @Override
- public IPageMngr getIPageMngr() {
- return transPageMngrImpl;
- }
-
- /**
- * 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 version of the IPageMngr
- */
- public static IPageMngr createIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
-
- // Create an instance of the DiSashModelMngr with no factory.
- // The factory is not needed since we don't get the ISashWindowsContentProvider.
- return new TransactionalDiSashModelMngr(diResource, editingDomain).getIPageMngr();
-
- }
-
-}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseAllDiagramsCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseAllDiagramsCommand.java
index 8a70361e794..c060de92be1 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseAllDiagramsCommand.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseAllDiagramsCommand.java
@@ -3,8 +3,6 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -13,9 +11,9 @@ import org.eclipse.ui.handlers.HandlerUtil;
* A command to be used with the Eclipse Commands Framework.
* This command allows to close all diagrams openened in the current SashContainer implemented
* on di.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class CloseAllDiagramsCommand extends AbstractHandler {
@@ -29,68 +27,47 @@ public class CloseAllDiagramsCommand extends AbstractHandler {
/**
* Execute the command. This method is called when the action is triggered.
- *
+ *
*/
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IPageManager pageMngr;
- TransactionalEditingDomain editingDomain;
+ IPageManager pageManager;
try {
- pageMngr = getPageManager(event);
- editingDomain = getTransactionalEditingDomain(event);
+ pageManager = getPageManager(event);
} catch (NullPointerException e) {
// PageMngr or Editing Domain can't be found
return null;
}
- execute(pageMngr, editingDomain);
+ execute(pageManager);
return null;
}
/**
* Get the PageMngr used to interact with the content provider.
- *
+ *
* @param event
* @return
* @throws NullPointerException
* if the PageMngr can't be found.
*/
private IPageManager getPageManager(ExecutionEvent event) {
-
IEditorPart part = HandlerUtil.getActiveEditor(event);
- IPageManager pageMngr = (IPageManager)part.getAdapter(IPageManager.class);
-
- return pageMngr;
+ IPageManager pageManager = (IPageManager)part.getAdapter(IPageManager.class);
- }
-
- /**
- * Get the TransactionalEditingDomain used to execute commands.
- *
- * @param event
- * @return
- * @throws NullPointerException
- * if the TransactionalEditingDomain can't be found.
- */
- private TransactionalEditingDomain getTransactionalEditingDomain(ExecutionEvent event) {
- IEditorPart activePart = HandlerUtil.getActiveEditor(event);
- TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)activePart.getAdapter(TransactionalEditingDomain.class);
- return editingDomain;
+ return pageManager;
}
/**
* Close all the diagrams.
- *
- * @param pageMngr
+ *
+ * @param pageManager
*/
- public void execute(final IPageManager pageMngr, TransactionalEditingDomain editingDomain) throws ExecutionException {
- if(editingDomain == null) {
- throw new ExecutionException("Editing domain not found");
- }
-
+ public void execute(final IPageManager pageManager) throws ExecutionException {
boolean atLeastOneOpenPage = false;
- for(Object pageIdentifier : pageMngr.allPages()) {
- if(pageMngr.isOpen(pageIdentifier)) {
+ for(Object pageIdentifier : pageManager.allPages()) {
+ if(pageManager.isOpen(pageIdentifier)) {
atLeastOneOpenPage = true;
break;
}
@@ -100,14 +77,7 @@ public class CloseAllDiagramsCommand extends AbstractHandler {
return;
}
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Close all pages") {
-
- @Override
- protected void doExecute() {
-
- pageMngr.closeAllOpenedPages();
- }
- });
+ pageManager.closeAllOpenedPages();
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java
index bf21cc25878..9f22f39b19f 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java
@@ -3,8 +3,6 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-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.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
@@ -15,9 +13,9 @@ import org.eclipse.ui.handlers.HandlerUtil;
* A command to be used with the Eclipse Commands Framework.
* This command is to be used with {@link SashWindowsContainer} implemented with the Di model.
* This command allows to close the currently openened diagram.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class CloseDiagramCommand extends AbstractHandler {
@@ -31,14 +29,14 @@ public class CloseDiagramCommand extends AbstractHandler {
/**
* Execute the command. This method is called when the action is triggered.
- *
+ *
*/
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IEditorPart part = HandlerUtil.getActiveEditor(event);
- IPageManager pageMngr = (IPageManager)part.getAdapter(IPageManager.class);
- TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)part.getAdapter(TransactionalEditingDomain.class);
+ IPageManager pageManager = (IPageManager)part.getAdapter(IPageManager.class);
ISashWindowsContainer container = (ISashWindowsContainer)part.getAdapter(ISashWindowsContainer.class);
Object pageIdentifier = container.getActiveSashWindowsPage().getRawModel();
//FIXME Bug from sash Di to be corrected
@@ -46,33 +44,14 @@ public class CloseDiagramCommand extends AbstractHandler {
pageIdentifier = ((PageRef)pageIdentifier).getPageIdentifier();
}
- execute(pageMngr, editingDomain, pageIdentifier);
+ pageManager.closePage(pageIdentifier);
} catch (NullPointerException e) {
// PageMngr can't be found
return null;
}
-
-
return null;
}
- /**
- * Close selected page.
- *
- * @param pageMngr
- */
- public void execute(final IPageManager pageMngr, TransactionalEditingDomain editingDomain, final Object pageIdentifier) {
- if(pageMngr.isOpen(pageIdentifier)) {
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Close page") {
-
- @Override
- protected void doExecute() {
- pageMngr.closePage(pageIdentifier);
- }
- });
- }
- }
-
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java
index d7e2990b76e..826f69ff0d5 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java
@@ -3,8 +3,6 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-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.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
@@ -33,19 +31,19 @@ public class CloseOtherDiagramsCommand extends AbstractHandler {
* Execute the command. This method is called when the action is triggered.
*
*/
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IEditorPart part = HandlerUtil.getActiveEditor(event);
- IPageManager pageMngr = (IPageManager)part.getAdapter(IPageManager.class);
- TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)part.getAdapter(TransactionalEditingDomain.class);
+ IPageManager pageManager = (IPageManager)part.getAdapter(IPageManager.class);
ISashWindowsContainer container = (ISashWindowsContainer)part.getAdapter(ISashWindowsContainer.class);
Object pageIdentifier = container.getActiveSashWindowsPage().getRawModel();
//FIXME Bug from sash Di to be corrected
if(pageIdentifier instanceof PageRef) {
pageIdentifier = ((PageRef)pageIdentifier).getPageIdentifier();
}
- execute(pageMngr, editingDomain, pageIdentifier);
+ execute(pageManager, pageIdentifier);
} catch (NullPointerException e) {
// PageMngr can't be found
@@ -60,12 +58,12 @@ public class CloseOtherDiagramsCommand extends AbstractHandler {
/**
* Close selected page.
*
- * @param pageMngr
+ * @param pageManager
*/
- public void execute(final IPageManager pageMngr, TransactionalEditingDomain editingDomain, final Object pageIdentifier) {
+ public void execute(final IPageManager pageManager, final Object pageIdentifier) {
boolean atLeastOneDifferentPageOpen = false;
- for(Object page : pageMngr.allPages()) {
- if(page != pageIdentifier && pageMngr.isOpen(page)) {
+ for(Object page : pageManager.allPages()) {
+ if(page != pageIdentifier && pageManager.isOpen(page)) {
atLeastOneDifferentPageOpen = true;
break;
}
@@ -75,14 +73,7 @@ public class CloseOtherDiagramsCommand extends AbstractHandler {
return; //Nothing to do
}
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Close other pages") {
-
- @Override
- protected void doExecute() {
- pageMngr.closeOtherPages(pageIdentifier);
- }
- });
-
+ pageManager.closeOtherPages(pageIdentifier);
}
}
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 17f1470bae5..121b4f67369 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
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -14,7 +14,14 @@
package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
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.SashWindowsMngr;
import org.eclipse.swt.widgets.Display;
@@ -22,9 +29,9 @@ import org.eclipse.swt.widgets.Display;
/**
* This class provide high level method to manage the Sash pages through its DI
* implementation.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class PageManagerImpl extends PageMngrImpl implements IPageManager {
@@ -34,44 +41,80 @@ public class PageManagerImpl extends PageMngrImpl implements IPageManager {
* folder as the current folder. Futhermore, the default implementation doesn't
* allow to set the active folder. <br>
* Suitable for tests
- *
+ *
* @param diSashModel
* The model onto which operation of this class act.
* @param contentChangedEventProvider
* A class listening on changes on the internal model and delivering events to registered listeners. This implementation
* need the class in order to deactivate event triggering during the operations.
- *
+ *
*/
- public PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) {
+ protected PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) {
super(diSashModel, contentChangedEventProvider);
}
/**
* Constructor.
- *
+ *
* @param diSashModel
* @param contentChangedEventProvider
* @param folderAndPageMngr
*/
- public PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) {
+ protected PageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) {
super(diSashModel, contentChangedEventProvider, folderAndPageMngr);
}
+ @Override
public void closeAllOpenedPages(Object pageIdentifier) {
while(isOpen(pageIdentifier)) {
closePage(pageIdentifier);
}
}
+ @Override
+ public void addPage(Object pageIdentifier) {
+ //Nothing
+ }
+
+ @Override
+ public List<Object> allPages() {
+ //FIXME: Temporary, naive code. Need to implement a mechanism to contribute page providers
+ List<Object> result = new LinkedList<Object>();
+ for(Resource resource : diSashModel.eResource().getResourceSet().getResources()) {
+ if(resource != null && resource.isLoaded()) {
+ if("notation".equals(resource.getURI().fileExtension())) {
+ for(EObject content : resource.getContents()) {
+ if(Platform.getAdapterManager().getAdapter(content, IOpenable.class) != null) {
+ result.add(content);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void openPage(Object pageIdentifier) {
+ diSashModel.getSashModel().addPage(getCurrentFolder(), pageIdentifier);
+ }
+
+ @Override
public void selectPage(final Object pageIdentifier) {
Display.getDefault().syncExec(new Runnable() {
+ @Override
public void run() {
folderAndPageMngr.setActivePage(pageIdentifier);
}
});
}
+ @Override
+ public void removePage(Object pageIdentifier) {
+ closeAllOpenedPages(pageIdentifier);
+ }
+
public void setCurrentFolderAndPageMngr(ICurrentFolderAndPageMngr currentFolderAndPageMngr) {
this.folderAndPageMngr = currentFolderAndPageMngr;
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
index 073f2371ec9..007d58a7055 100644
--- 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
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
+ * 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
@@ -28,13 +28,13 @@ 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 */
- private SashWindowsMngr diSashModel;
+ protected SashWindowsMngr diSashModel;
/**
* An object used to get the current folder, or to ask to set the
@@ -45,13 +45,13 @@ public class PageMngrImpl implements IPageMngr {
private ContentChangedEventProvider contentChangedEventProvider;
- public PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) {
+ protected PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) {
this.diSashModel = diSashModel;
this.contentChangedEventProvider = contentChangedEventProvider;
folderAndPageMngr = new DefaultCurrentFolderAndPageMngr(diSashModel);
}
- public PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) {
+ protected PageMngrImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) {
this.diSashModel = diSashModel;
this.contentChangedEventProvider = contentChangedEventProvider;
this.folderAndPageMngr = folderAndPageMngr;
@@ -60,14 +60,16 @@ public class PageMngrImpl implements IPageMngr {
/**
* 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,
+ // We do not need to disable event delivering,
// as addition to pageList doesn't fire events.
diSashModel.getPageList().addPage(pageIdentifier);
@@ -75,37 +77,37 @@ public class PageMngrImpl implements IPageMngr {
/**
* Get the folder model {@link TabFolder} of the current folder.
- *
+ *
* @return
*/
- private TabFolder getCurrentFolder() {
+ protected TabFolder getCurrentFolder() {
return folderAndPageMngr.getCurrentFolder();
}
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#allPages()
- *
+ *
* @return
*/
+ @Override
public List<Object> allPages() {
-
// TODO : use and return a shadow list ?
List<Object> list = new ArrayList<Object>();
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);
@@ -115,11 +117,12 @@ public class PageMngrImpl implements IPageMngr {
/**
* 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);
@@ -130,11 +133,12 @@ public class PageMngrImpl implements IPageMngr {
/**
* 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);
@@ -143,9 +147,10 @@ public class PageMngrImpl implements IPageMngr {
/**
* @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
@@ -168,9 +173,11 @@ public class PageMngrImpl implements IPageMngr {
/**
* @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);
@@ -181,12 +188,13 @@ public class PageMngrImpl implements IPageMngr {
}
/**
- *
+ *
* @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;
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider.java
index 61582477a31..7ce9d2392da 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
@@ -8,6 +8,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
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.Activator;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper;
/**
@@ -52,19 +54,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param page
*
*/
+ @Override
public void addPage(final Object page) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Open page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.addPage(page);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.addPage(page);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -73,19 +75,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param index
*
*/
+ @Override
public void addPage(final Object page, final int index) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Open page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.addPage(page, index);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.addPage(page, index);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -94,6 +96,7 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @return
*
*/
+ @Override
public IAbstractPanelModel createChildSashModel(final Object root) {
return diContentProvider.createChildSashModel(root);
}
@@ -107,19 +110,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param side
*
*/
+ @Override
public void createFolder(final ITabFolderModel tabFolder, final int tabIndex, final ITabFolderModel targetFolder, final int side) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Create folder") {
-
- @Override
- protected void doExecute() {
- diContentProvider.createFolder(tabFolder, tabIndex, targetFolder, side);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.createFolder(tabFolder, tabIndex, targetFolder, side);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -129,19 +132,8 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
*
* @param rawModel
*/
+ @Override
public void setCurrentFolder(final Object rawModel) {
- // TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- // RecordingCommand command = new RecordingCommand(editingDomain) {
- //
- // @Override
- // protected void doExecute() {
- // diContentProvider.setCurrentFolder(rawModel);
- //
- // }
- // };
-
- // editingDomain.getCommandStack().execute(command);
diContentProvider.setCurrentFolder(rawModel);
}
@@ -150,6 +142,7 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @return
*
*/
+ @Override
public Object getRootModel() {
return diContentProvider.getRootModel();
}
@@ -162,19 +155,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param newIndex
*
*/
+ @Override
public void movePage(final ITabFolderModel folderModel, final int oldIndex, final int newIndex) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Move page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.movePage(folderModel, oldIndex, newIndex);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.movePage(folderModel, oldIndex, newIndex);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -186,19 +179,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param targetIndex
*
*/
+ @Override
public void movePage(final ITabFolderModel srcFolderModel, final int sourceIndex, final ITabFolderModel targetFolderModel, final int targetIndex) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Move page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.movePage(srcFolderModel, sourceIndex, targetFolderModel, targetIndex);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.movePage(srcFolderModel, sourceIndex, targetFolderModel, targetIndex);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -206,19 +199,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param index
*
*/
+ @Override
public void removePage(final int index) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Close page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.removePage(index);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.removePage(index);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -226,19 +219,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param page
*
*/
+ @Override
public void removePage(final Object page) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Close page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.removePage(page);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.removePage(page);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -248,19 +241,19 @@ public class TransactionalDiContentProvider implements ISashWindowsContentProvid
* @param tabIndex
*
*/
+ @Override
public void removePage(final ITabFolderModel parentFolder, final int tabIndex) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Close page") {
-
- @Override
- protected void doExecute() {
- diContentProvider.removePage(parentFolder, tabIndex);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
+ try {
+ TransactionHelper.run(getTransactionalEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ diContentProvider.removePage(parentFolder, tabIndex);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
}
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
new file mode 100644
index 00000000000..cf5d4d5a0f7
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.Activator;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
+
+/**
+ * Transactional implementation of the PageManager.
+ *
+ * It runs all commands in write transactions on the editing domain, without using the CommandStack
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class TransactionalPageManagerImpl extends PageManagerImpl {
+
+ protected EditingDomain editingDomain;
+
+ public TransactionalPageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider) {
+ super(diSashModel, contentChangedEventProvider);
+ }
+
+ public TransactionalPageManagerImpl(SashWindowsMngr diSashModel, ContentChangedEventProvider contentChangedEventProvider, ICurrentFolderAndPageMngr folderAndPageMngr) {
+ super(diSashModel, contentChangedEventProvider, folderAndPageMngr);
+ }
+
+ protected EditingDomain getEditingDomain() {
+ if(editingDomain == null) {
+ editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(diSashModel);
+ }
+
+ return editingDomain;
+ }
+
+ @Override
+ public void removePage(final Object pageIdentifier) {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.removePage(pageIdentifier);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void closePage(final Object pageIdentifier) {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.closePage(pageIdentifier);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void closeAllOpenedPages() {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.closeAllOpenedPages();
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void closeOtherPages(final Object pageIdentifier) {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.closeOtherPages(pageIdentifier);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void openPage(final Object pageIdentifier) {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.openPage(pageIdentifier);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void closeAllOpenedPages(final Object pageIdentifier) {
+ try {
+ TransactionHelper.run(getEditingDomain(), new Runnable() {
+
+ @Override
+ public void run() {
+ TransactionalPageManagerImpl.super.closeAllOpenedPages(pageIdentifier);
+ }
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageMngrImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageMngrImpl.java
deleted file mode 100644
index 97686a980f4..00000000000
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageMngrImpl.java
+++ /dev/null
@@ -1,204 +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 java.util.List;
-
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-
-
-/**
- * A PageMngr based on EMF di and using Transactions.
- * This implementation is a wrapper on {@link PageMngrImpl}.
- * Each method is wrapped in a {@link RecordingCommand}.
- *
- * @author cedric dumoulin
- */
-@Deprecated
-public class TransactionalPageMngrImpl implements IPageMngr {
-
- /**
- * wrapped ContentProvider. All commands will use this provider.
- */
- private PageMngrImpl pageMngr;
-
- private TransactionalEditingDomain editingDomain;
-
- /**
- *
- * Constructor.
- *
- * @param diContentProvider
- */
- public TransactionalPageMngrImpl(PageMngrImpl pageMngr, TransactionalEditingDomain editingDomain) {
- this.pageMngr = pageMngr;
- this.editingDomain = editingDomain;
- }
-
- /**
- * Get the editing domain used to perform transactions.
- *
- * @return
- */
- private TransactionalEditingDomain getTransactionalEditingDomain() {
- return editingDomain;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#addPage(java.lang.Object)
- *
- * @param pageIdentifier
- */
- public void addPage(final Object pageIdentifier) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.addPage(pageIdentifier);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#allPages()
- *
- * @return
- */
- public List<Object> allPages() {
- return pageMngr.allPages();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#closePage(java.lang.Object)
- *
- * @param pageIdentifier
- */
- public void closePage(final Object pageIdentifier) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.closePage(pageIdentifier);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- * 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
- */
- public void closeAllOpenedPages() {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.closeAllOpenedPages();
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#closePage(org.eclipse.emf.ecore.EObject)
- *
- * @param pageIdentifier
- */
- public void closeOtherPages(final Object pageIdentifier) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.closeOtherPages(pageIdentifier);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#openPage(java.lang.Object)
- *
- * @param pageIdentifier
- */
- public void openPage(final Object pageIdentifier) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.openPage(pageIdentifier);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#removePage(java.lang.Object)
- *
- * @param pageIdentifier
- */
- public void removePage(final Object pageIdentifier) {
- TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
-
- RecordingCommand command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- pageMngr.removePage(pageIdentifier);
-
- }
- };
-
- editingDomain.getCommandStack().execute(command);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr#isOpen(java.lang.Object)
- * @param pageIdentifier
- * @return
- *
- */
- public boolean isOpen(Object pageIdentifier) {
- return pageMngr.isOpen(pageIdentifier);
- }
-
-}
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
new file mode 100644
index 00000000000..abc07fc1135
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/TransactionHelper.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils;
+
+import java.util.Collections;
+
+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;
+
+/**
+ * This helper can be used to run (safe) transactions outside the CommandStack
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class TransactionHelper {
+
+ 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();
+ }
+ }
+
+}
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
index 58387547e11..bf8d06eb5e8 100644
--- 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
@@ -184,7 +184,7 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SashWindowsMngr">
<eStructuralFeatures xsi:type="ecore:EReference" name="pageList" ordered="false"
- unique="false" lowerBound="1" eType="#//PageList" containment="true"/>
+ unique="false" eType="#//PageList" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sashModel" ordered="false"
unique="false" lowerBound="1" eType="#//SashModel" containment="true"/>
</eClassifiers>
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
index 392840484d8..bf5e305d70c 100644
--- 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
@@ -17,4 +17,11 @@
genModel="model/sashwindowsdi.genmodel"/>
</extension>
+ <extension point="org.eclipse.emf.ecore.extension_parser">
+ <!-- @generated sashwindowsdi -->
+ <parser
+ type="di"
+ class="org.eclipse.papyrus.infra.core.sashwindows.di.util.DiResourceFactoryImpl"/>
+ </extension>
+
</plugin>
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
index 002acd1521d..13e91a30041 100644
--- 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
@@ -105,6 +105,7 @@ public interface DiFactory extends EFactory {
* @return a new object of class '<em>Page List</em>'.
* @generated
*/
+ @Deprecated
PageList createPageList();
/**
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
index 8b4363125ef..191ca2041f4 100644
--- 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
@@ -466,6 +466,7 @@ public interface DiPackage extends EPackage {
* @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList()
* @generated
*/
+ @Deprecated
int PAGE_LIST = 10;
/**
@@ -475,6 +476,7 @@ public interface DiPackage extends EPackage {
* @generated
* @ordered
*/
+ @Deprecated
int PAGE_LIST__AVAILABLE_PAGE = 0;
/**
@@ -878,6 +880,7 @@ public interface DiPackage extends EPackage {
* @see org.eclipse.papyrus.infra.core.sashwindows.di.PageList
* @generated
*/
+ @Deprecated
EClass getPageList();
/**
@@ -889,6 +892,7 @@ public interface DiPackage extends EPackage {
* @see #getPageList()
* @generated
*/
+ @Deprecated
EReference getPageList_AvailablePage();
/**
@@ -910,6 +914,7 @@ public interface DiPackage extends EPackage {
* @see #getSashWindowsMngr()
* @generated
*/
+ @Deprecated
EReference getSashWindowsMngr_PageList();
/**
@@ -1247,6 +1252,7 @@ public interface DiPackage extends EPackage {
* @see org.eclipse.papyrus.infra.core.sashwindows.di.impl.DiPackageImpl#getPageList()
* @generated
*/
+ @Deprecated
EClass PAGE_LIST = eINSTANCE.getPageList();
/**
@@ -1255,6 +1261,7 @@ public interface DiPackage extends EPackage {
* <!-- end-user-doc -->
* @generated
*/
+ @Deprecated
EReference PAGE_LIST__AVAILABLE_PAGE = eINSTANCE.getPageList_AvailablePage();
/**
@@ -1273,6 +1280,7 @@ public interface DiPackage extends EPackage {
* <!-- end-user-doc -->
* @generated
*/
+ @Deprecated
EReference SASH_WINDOWS_MNGR__PAGE_LIST = eINSTANCE.getSashWindowsMngr_PageList();
/**
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
index e0badfc16f4..7181b5abc16 100644
--- 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
@@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EObject;
* @model
* @generated
*/
+@Deprecated
public interface PageList extends EObject {
/**
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
index 6ae1be2b259..717976c0b5c 100644
--- 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
@@ -16,8 +16,8 @@ import org.eclipse.emf.ecore.EObject;
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList <em>Page List</em>}</li>
- * <li>{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel <em>Sash Model</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList <em>Page List</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel <em>Sash Model</em>}</li>
* </ul>
* </p>
*
@@ -34,22 +34,28 @@ public interface SashWindowsMngr extends EObject {
* If the meaning of the '<em>Page List</em>' containment reference isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
+ *
* @return the value of the '<em>Page List</em>' containment reference.
* @see #setPageList(PageList)
* @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_PageList()
- * @model containment="true" required="true" ordered="false"
+ * @model containment="true" ordered="false"
* @generated
*/
+ @Deprecated
PageList getPageList();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList <em>Page List</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getPageList <em>Page List</em>}' containment
+ * reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Page List</em>' containment reference.
+ *
+ * @param value
+ * the new value of the '<em>Page List</em>' containment reference.
* @see #getPageList()
* @generated
*/
+ @Deprecated
void setPageList(PageList value);
/**
@@ -59,6 +65,7 @@ public interface SashWindowsMngr extends EObject {
* If the meaning of the '<em>Sash Model</em>' containment reference isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
+ *
* @return the value of the '<em>Sash Model</em>' containment reference.
* @see #setSashModel(SashModel)
* @see org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage#getSashWindowsMngr_SashModel()
@@ -68,10 +75,13 @@ public interface SashWindowsMngr extends EObject {
SashModel getSashModel();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel <em>Sash Model</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr#getSashModel <em>Sash Model</em>}' containment
+ * reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Sash Model</em>' containment reference.
+ *
+ * @param value
+ * the new value of the '<em>Sash Model</em>' containment reference.
* @see #getSashModel()
* @generated
*/
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
index 722a16dabd8..2499d2b7291 100644
--- 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
@@ -42,7 +42,7 @@ public class DiFactoryImpl extends EFactoryImpl implements DiFactory {
*/
public static DiFactory init() {
try {
- DiFactory theDiFactory = (DiFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/0.7.0/sashdi");
+ DiFactory theDiFactory = (DiFactory)EPackage.Registry.INSTANCE.getEFactory(DiPackage.eNS_URI);
if (theDiFactory != null) {
return theDiFactory;
}
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
index aa324aa7bc8..359f2a89292 100644
--- 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
@@ -788,7 +788,7 @@ public class DiPackageImpl extends EPackageImpl implements DiPackage {
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_PageList(), this.getPageList(), null, "pageList", null, 0, 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
@@ -812,12 +812,12 @@ public class DiPackageImpl extends EPackageImpl implements DiPackage {
* @generated
*/
protected void createResourceXMIAnnotations() {
- String source = "resource=XMI";
+ String source = "resource=XMI";
addAnnotation
(this,
source,
new String[] {
- });
+ });
}
} //DiPackageImpl
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
index b7b9ea3f30a..c8cdc379a20 100644
--- 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
@@ -31,7 +31,7 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
* <li>{@link org.eclipse.papyrus.infra.core.sashwindows.di.impl.PageRefImpl#getParent <em>Parent</em>}</li>
* </ul>
* </p>
- *
+ *
* @generated
*/
public class PageRefImpl extends EObjectImpl implements PageRef {
@@ -40,7 +40,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
* The cached value of the '{@link #getEmfPageIdentifier() <em>Emf Page Identifier</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @see #getEmfPageIdentifier()
* @generated
* @ordered
@@ -51,7 +51,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
* The default value of the '{@link #getPageIdentifier() <em>Page Identifier</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @see #getPageIdentifier()
* @generated
* @ordered
@@ -62,7 +62,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
* The default value of the '{@link #getObjectPageIdentifier() <em>Object Page Identifier</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @see #getObjectPageIdentifier()
* @generated
* @ordered
@@ -73,7 +73,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
* The cached value of the '{@link #getObjectPageIdentifier() <em>Object Page Identifier</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @see #getObjectPageIdentifier()
* @generated
* @ordered
@@ -83,7 +83,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
protected PageRefImpl() {
@@ -93,7 +93,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -104,9 +104,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public EObject getEmfPageIdentifier() {
if(emfPageIdentifier != null && emfPageIdentifier.eIsProxy()) {
InternalEObject oldEmfPageIdentifier = (InternalEObject)emfPageIdentifier;
@@ -123,7 +124,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
public EObject basicGetEmfPageIdentifier() {
@@ -133,9 +134,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public void setEmfPageIdentifier(EObject newEmfPageIdentifier) {
EObject oldEmfPageIdentifier = emfPageIdentifier;
emfPageIdentifier = newEmfPageIdentifier;
@@ -147,9 +149,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public Object getPageIdentifier() {
Object res = getEmfPageIdentifier();
@@ -163,9 +166,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @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) {
@@ -177,7 +181,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -195,7 +199,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -210,7 +214,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -225,7 +229,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -249,7 +253,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -274,7 +278,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -299,7 +303,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -320,7 +324,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
@Override
@@ -339,9 +343,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void setPageIdentifier(Object newPageIdentifier) {
if(newPageIdentifier instanceof EObject) {
@@ -362,9 +367,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public Object getObjectPageIdentifier() {
return objectPageIdentifier;
}
@@ -372,9 +378,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public void setObjectPageIdentifier(Object newObjectPageIdentifier) {
Object oldObjectPageIdentifier = objectPageIdentifier;
objectPageIdentifier = newObjectPageIdentifier;
@@ -386,9 +393,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public TabFolder getParent() {
if(eContainerFeatureID() != DiPackage.PAGE_REF__PARENT) {
return null;
@@ -399,7 +407,7 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
public NotificationChain basicSetParent(TabFolder newParent, NotificationChain msgs) {
@@ -410,9 +418,10 @@ public class PageRefImpl extends EObjectImpl implements PageRef {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated
*/
+ @Override
public void setParent(TabFolder newParent) {
if(newParent != eInternalContainer() || (eContainerFeatureID() != DiPackage.PAGE_REF__PARENT && newParent != null)) {
if(EcoreUtil.isAncestor(this, newParent)) {
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
index 56c4f4f25d0..06db7cf5740 100644
--- 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
@@ -95,6 +95,7 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
*
* @generated
*/
+ @Override
public EList<Window> getWindows() {
if(windows == null) {
windows = new EObjectContainmentEList<Window>(Window.class, this, DiPackage.SASH_MODEL__WINDOWS);
@@ -108,6 +109,7 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
*
* @generated
*/
+ @Override
public TabFolder getCurrentSelection() {
if(currentSelection != null && currentSelection.eIsProxy()) {
InternalEObject oldCurrentSelection = (InternalEObject)currentSelection;
@@ -137,6 +139,7 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
*
* @generated
*/
+ @Override
public void setCurrentSelection(TabFolder newCurrentSelection) {
TabFolder oldCurrentSelection = currentSelection;
currentSelection = newCurrentSelection;
@@ -148,9 +151,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void addPage(Object pageIdentifier) {
getCurrentSelection().addPage(pageIdentifier);
}
@@ -158,9 +162,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void addPage(TabFolder folder, Object pageIdentifier) {
// if(folder==null) {
// // Use first folder
@@ -172,19 +177,20 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* Get the first folder in the model.
* Return null if no folder exist.
- *
+ *
* @return
*/
// public TabFolder getFirstFolder() {
- //
+ //
// }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void removePage(Object pageIdentifier) {
PageRef pageRef = lookupPage(pageIdentifier);
if(pageRef == null) {
@@ -200,9 +206,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void removePageAndEmptyFolder(Object pageIdentifier) {
PageRef pageRef;
@@ -220,9 +227,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void setCurrentSelectionSilently(TabFolder selection) {
currentSelection = selection;
}
@@ -230,9 +238,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public PageRef lookupPage(final Object pageIdentifier) {
// Create appropriate visitor.
@@ -240,9 +249,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -260,9 +269,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window)
- *
+ *
* @param object
* @return
*/
@@ -285,9 +294,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -306,9 +315,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -336,9 +345,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* TODO Add method to metamodel
- *
+ *
* @generated NOT
*/
+ @Override
public TabFolder lookupFirstFolder() {
// Create appropriate visitor.
@@ -346,9 +356,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -366,9 +376,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch#caseWindow(org.eclipse.papyrus.infra.core.sashwindows.di.Window)
- *
+ *
* @param object
* @return
*/
@@ -391,9 +401,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -412,9 +422,9 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* 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
*/
@@ -435,9 +445,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* TODO Add method to metamodel
- *
+ *
* @generated NOT
*/
+ @Override
public Window lookupFirstWindow() {
List<Window> list = getWindows();
@@ -451,9 +462,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder, int targetIndex) {
@@ -492,9 +504,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void insertFolder(TabFolder folderToInsert, TabFolder refFolder, int side) {
// Get the parent under which the sash will be inserted
@@ -526,9 +539,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void movePage(TabFolder srcParentFolder, int srcIndex, TabFolder targetParentFolder) {
// Check if we move all pages of srcFolder
@@ -553,9 +567,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void removeEmptyFolder(TabFolder folder) {
EList<PageRef> children = folder.getChildren();
@@ -582,9 +597,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void removeAllPages() {
// Get a the first window and a folder.
@@ -600,9 +616,10 @@ public class SashModelImpl extends EObjectImpl implements SashModel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
+ *
* @generated NOT
*/
+ @Override
public void removeOtherPages(Object pageIdentifier) {
// Get a the first window and a folder.
// Clear the folder and set it as the root folder.
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
index 36236ee6103..816db00fe3a 100644
--- 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
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
+ * 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
@@ -18,7 +18,6 @@ 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.PageList;
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;
@@ -72,10 +71,6 @@ public class DiUtils {
SashModel layout = createDefaultSashModel();
model.setSashModel(layout);
-
- // PageList
- PageList pageList = DiFactory.eINSTANCE.createPageList();
- model.setPageList(pageList);
return model;
}
@@ -88,8 +83,9 @@ public class DiUtils {
static public SashWindowsMngr lookupSashWindowsMngr(Resource diResource) {
for(Object node : diResource.getContents()) {
- if(node instanceof SashWindowsMngr)
+ if(node instanceof SashWindowsMngr) {
return (SashWindowsMngr)node;
+ }
}
return null;
}
@@ -104,9 +100,10 @@ public class DiUtils {
* 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) {
@@ -133,9 +130,9 @@ public class DiUtils {
* instead ?
* @deprecated Should use IPageMngr instead.
*/
+ @Deprecated
static public void addPageToPageList(Resource diResource, PageRef pageRef) throws SashEditorException {
- SashWindowsMngr windowsMngr = lookupSashWindowsMngr(diResource);
- addPageToPageList(windowsMngr, pageRef);
+ //Do nothing. The page list is not used anymore
}
/**
@@ -147,15 +144,12 @@ public class DiUtils {
* 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 {
- if(windowsMngr != null && windowsMngr.getPageList() != null) {
- windowsMngr.getPageList().addPage(pageRef.getPageIdentifier());
- } else {
- throw new SashEditorException("Unable to add the page to the windows manager");
- }
+ //Do nothing. The page list is not used anymore
}
/**
@@ -167,14 +161,16 @@ public class DiUtils {
* 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)
+ 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) {
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
index 70634c2be42..800c2cc5bd4 100644
--- 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
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -14,6 +14,8 @@ 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.
@@ -22,42 +24,23 @@ import java.util.List;
* 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 {
/**
- * 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.
- */
- 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
- */
- 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.
- *
+ *
* 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);
@@ -65,13 +48,13 @@ public interface IPageManager extends IPageMngr {
/**
* Close all opened pages.
- *
+ *
*/
public void closeAllOpenedPages();
/**
* Close all opened pages except the one provided as parameter.
- *
+ *
* @param pageIdentifier
*/
public void closeOtherPages(Object pageIdentifier);
@@ -82,7 +65,7 @@ public interface IPageManager extends IPageMngr {
* 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.
@@ -92,14 +75,14 @@ public interface IPageManager extends IPageMngr {
/**
* Return all available page identifiers (open and closed pages).
- *
+ *
* @return List of registered page identifiers.
*/
public List<Object> allPages();
/**
* Return true if a page is open for the specified pageIdentifier.
- *
+ *
* @param diagram
* @return
*/
@@ -109,7 +92,7 @@ public interface IPageManager extends IPageMngr {
* 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);
@@ -117,14 +100,14 @@ public interface IPageManager extends IPageMngr {
/**
* 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);
/**
* Returns the active page identifier
- *
+ *
* @return
*/
// public Object getActivePage();
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
index 9c3d9fdfb5f..11d0bba514b 100644
--- 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
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
+ * 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
@@ -16,6 +16,8 @@ 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.
@@ -40,7 +42,9 @@ public interface IPageMngr {
* 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);
/**
@@ -49,7 +53,10 @@ public interface IPageMngr {
*
* @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);
/**
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 5ea051c054f..f1f1f5491f0 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml
@@ -7,6 +7,8 @@
<extension-point id="service" name="Service" schema="schema/service.exsd"/>
<extension-point id="model" name="plugin.xml.ModelName" schema="schema/model.exsd"/>
<extension-point id="transactionalEditingDomainProvider" name="transactionalEditingDomainProvider" schema="schema/transactionalEditingDomainProvider.exsd"/>
+ <extension-point id="sashModelProvider" name="Sash Model Providers" schema="schema/sashModelProvider.exsd"/>
+
<extension
point="org.eclipse.ui.menus">
<menuContribution
@@ -181,12 +183,18 @@
point="org.eclipse.papyrus.infra.core.model">
<model
classname="org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel"
- description="Model for sash system">
+ description="Model for sash system"
+ fileExtension="sash">
</model>
<modelSetSnippet
classname="org.eclipse.papyrus.infra.core.modelsetquery.impl.ModelSetQueryInitializer"
description="Adapter attached to the ModelSet (aka ResourceSet)">
</modelSetSnippet>
+ <model
+ classname="org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel"
+ description="Main Papyrus IModel"
+ fileExtension="di">
+ </model>
</extension>
<extension
point="org.eclipse.papyrus.infra.core.service">
@@ -317,8 +325,13 @@
</serviceFactory>
<service
classname="org.eclipse.papyrus.infra.core.services.ResourceUpdateService"
+ id="org.eclipse.papyrus.infra.core.services.ResourceUpdateService"
priority="1"
startKind="startup">
+ <dependsOn
+ description="This service is used to reopen the IMultiDiagramEditor when changes are detected"
+ serviceKeyRef="org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor">
+ </dependsOn>
</service>
</extension>
<extension
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/model.exsd b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/model.exsd
index 4d1277ff396..3e924caa53e 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/model.exsd
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/model.exsd
@@ -1,183 +1,190 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.papyrus.infra.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.papyrus.infra.core" id="org.eclipse.papyrus.infra.core.model" name="model"/>
- </appInfo>
- <documentation>
- A model represent a unit containing model elements.
-A model can be registered and retrieved from the ModelSet.
-This extension allows to register models to the ModelSet.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="model" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="modelSetSnippet" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="model">
- <annotation>
- <documentation>
- A model to be registered to the ModelSet.
-Registered model can be retrieved from the ModelSet.
- </documentation>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="modelSnippet"/>
- </sequence>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Human readable description for the model.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="classname" type="string" use="required">
- <annotation>
- <documentation>
- The class implementing the model.
-This is the class that wil be registered in the ModelSet.
-The class will be registered using the key set in the Model.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModel"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modelSnippet">
- <annotation>
- <documentation>
- A model snippet is a piece of code that is executed after the model is loaded.
-A snippet allows to manipulate the model right after it is loaded.
-&lt;br&gt;
-For example, it is possible to add listeners to the model.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Human readable description for the model snippet.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="classname" type="string" use="required">
- <annotation>
- <documentation>
- The class implementing the model snippet.
-The code is executed right after the model is loaded.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModelSnippet"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modelSetSnippet">
- <annotation>
- <documentation>
- A modelSet snippet is a piece of code that is executed after the modelSet is loaded.
-A snippet allows to do post operations after ModelSet is loaded.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Human readable description for the modelSet snippet.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="classname" type="string" use="required">
- <annotation>
- <documentation>
- The class implementing the modelSet snippet.
-The code is executed right after the modelSet is loaded.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModelSetSnippet"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 0.7.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.core" id="org.eclipse.papyrus.infra.core.model" name="model"/>
+ </appInfo>
+ <documentation>
+ A model represent a unit containing model elements.
+A model can be registered and retrieved from the ModelSet.
+This extension allows to register models to the ModelSet.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="model" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="modelSetSnippet" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="model">
+ <annotation>
+ <documentation>
+ A model to be registered to the ModelSet.
+Registered model can be retrieved from the ModelSet.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="modelSnippet"/>
+ </sequence>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Human readable description for the model.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="classname" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the model.
+This is the class that wil be registered in the ModelSet.
+The class will be registered using the key set in the Model.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModel"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="fileExtension" type="string">
+ <annotation>
+ <documentation>
+ Indicates the resource URI file extension that the model keys on to correlate to resources in the model set. Although this is optional, it is recommended to support the determination of whether a resource is one that may be loaded into the Papyrus editor.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modelSnippet">
+ <annotation>
+ <documentation>
+ A model snippet is a piece of code that is executed after the model is loaded.
+A snippet allows to manipulate the model right after it is loaded.
+&lt;br&gt;
+For example, it is possible to add listeners to the model.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Human readable description for the model snippet.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="classname" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the model snippet.
+The code is executed right after the model is loaded.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModelSnippet"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modelSetSnippet">
+ <annotation>
+ <documentation>
+ A modelSet snippet is a piece of code that is executed after the modelSet is loaded.
+A snippet allows to do post operations after ModelSet is loaded.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Human readable description for the modelSet snippet.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="classname" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the modelSet snippet.
+The code is executed right after the modelSet is loaded.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.IModelSetSnippet"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.7.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/sashModelProvider.exsd b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/sashModelProvider.exsd
new file mode 100644
index 00000000000..f5e5021bc30
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/schema/sashModelProvider.exsd
@@ -0,0 +1,110 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.core" id="sashModelProvider" name="Sash Model Providers"/>
+ </appInfo>
+ <documentation>
+ Registry of providers of Sash Model storage schemes for different persistence domains, as correlated to URI schemes.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="sashModelProvider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="sashModelProvider">
+ <annotation>
+ <documentation>
+ Registration of a sash model provider. At least one of the &lt;tt&gt;scheme&lt;/tt&gt; and &lt;tt&gt;pattern&lt;/tt&gt; attributes is required; both may be specified (the scheme filter is tested first).
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="scheme" type="string">
+ <annotation>
+ <documentation>
+ The URI scheme of model resource URIs for which the extension provides Sash Model storage.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="pattern" type="string">
+ <annotation>
+ <documentation>
+ A regular expression pattern matching model resource URIs for which the extension provides Sash Model storage.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the Sash Model provider.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.core.resource.sasheditor.ISashModelProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ 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
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
index 15b64868042..55082ca12d6 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
@@ -35,7 +35,6 @@ 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.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalCommandStack;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.ui.actions.ActionRegistry;
@@ -97,15 +96,15 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* 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 <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
* @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
* Refactoring.
- *
+ *
* TODO : remove GMF dependency !
*/
public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IGotoMarker {
@@ -149,9 +148,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* 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
@@ -163,9 +162,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* The isDirty flag has changed, reflect its new value
- *
+ *
* @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged()
- *
+ *
*/
@Override
public void isDirtyChanged() {
@@ -268,7 +267,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the contentOutlineRegistry. Create it if needed.
- *
+ *
* @return the contentOutlineRegistry
*/
protected ContentOutlineRegistry getContentOutlineRegistry() {
@@ -288,7 +287,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Returns the service registry associated to the editor.
- *
+ *
* @return the servicesRegistry The registry.
*/
@Override
@@ -301,7 +300,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ServicesRegistry.
- *
+ *
* @return
*/
private ServicesRegistry createServicesRegistry() {
@@ -320,7 +319,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* 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
@@ -330,14 +329,14 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* 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) {
//
@@ -352,7 +351,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
* 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 {
@@ -365,7 +364,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the ActionBarContributorRegistry. Creates it if necessary.
- *
+ *
* @return
*/
protected ActionBarContributorRegistry getActionBarContributorRegistry() {
@@ -389,7 +388,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ActionBarContributorRegistry.
- *
+ *
* @return
*/
private ActionBarContributorRegistry createActionBarContributorRegistry() {
@@ -397,10 +396,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
/**
- *
- *
+ *
+ *
* @param adapter
- *
+ *
* @return
*/
@SuppressWarnings("rawtypes")
@@ -683,14 +682,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
if(pageManager.isOpen(pageIdentifier)) {
pageManager.selectPage(pageIdentifier);
} else {
- transactionalEditingDomain.getCommandStack().execute(new RecordingCommand(transactionalEditingDomain, "Open page") {
-
- @Override
- protected void doExecute() {
- pageManager.openPage(pageIdentifier);
- }
- });
-
+ pageManager.openPage(pageIdentifier);
}
}
}
@@ -748,9 +740,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getPropertySheetPage.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getPropertySheetPage()
*/
public IPropertySheetPage getPropertySheetPage() {
@@ -761,7 +753,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#dispose()
- *
+ *
*/
@Override
public void dispose() {
@@ -828,9 +820,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSave.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
@@ -854,9 +846,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSaveAs.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
@Override
@@ -867,9 +859,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides isSaveAsAllowed.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
*/
@Override
@@ -879,9 +871,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getContributorId.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
*/
@Override
@@ -896,9 +888,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagram.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagram()
*/
// public org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
@@ -935,9 +927,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagramGraphicalViewer.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagramGraphicalViewer()
*/
// public IDiagramGraphicalViewer getDiagramGraphicalViewer() {
@@ -951,9 +943,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getEditingDomain.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain()
*/
public EditingDomain getEditingDomain() {
@@ -962,7 +954,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Throws an UnsupportedOperationException.
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getDiagramEditDomain()
*/
// public DiagramEditDomain getDiagramEditDomain() {
@@ -973,9 +965,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Change the editor input.<BR>
* <U>Note</U>: 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
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
index d037928db5a..2137518a885 100644
--- 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
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -14,7 +14,6 @@
package org.eclipse.papyrus.infra.core.editor;
-import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.editorsfactory.PageModelFactoryRegistry;
@@ -28,9 +27,9 @@ import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
/**
* Service Factory to create the {@link DiSashModelManager} service.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class DiSashModelManagerServiceFactory implements IServiceFactory {
@@ -44,10 +43,11 @@ public class DiSashModelManagerServiceFactory implements IServiceFactory {
/**
* @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;
@@ -61,9 +61,10 @@ public class DiSashModelManagerServiceFactory implements IServiceFactory {
/**
* @see org.eclipse.papyrus.infra.core.services.IService#startService()
- *
+ *
* @throws ServiceException
*/
+ @Override
public void startService() throws ServiceException {
// Read declared editors
@@ -71,8 +72,9 @@ public class DiSashModelManagerServiceFactory implements IServiceFactory {
PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID);
editorReader.populate(pageModelRegistry, servicesRegistry);
- if(sashModel.getResource() == null)
+ if(sashModel.getResource() == null) {
throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service.");
+ }
// create the service
sashModelMngr = new DiSashModelManager(pageModelRegistry, sashModel.getResource(), transactionalEditingDomain);
@@ -81,18 +83,20 @@ public class DiSashModelManagerServiceFactory implements IServiceFactory {
/**
* @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.
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
index 6707e5534c6..4f2e1f4cb5b 100644
--- 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
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.editor;
@@ -9,7 +9,7 @@ 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.TransactionalDiSashModelMngr;
+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;
@@ -26,7 +26,7 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
private SashModel sashModel;
- private TransactionalDiSashModelMngr sashModelMngr;
+ private DiSashModelMngr sashModelMngr;
private ServicesRegistry servicesRegistry;
@@ -36,6 +36,7 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
* @param servicesRegistry
* @throws ServiceException
*/
+ @Override
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
this.servicesRegistry = servicesRegistry;
@@ -52,6 +53,7 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
*
* @throws ServiceException
*/
+ @Override
public void startService() throws ServiceException {
// Read declared editors
@@ -59,11 +61,12 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID);
editorReader.populate(pageModelRegistry, servicesRegistry);
- if(sashModel.getResource() == null)
+ if(sashModel.getResource() == null) {
throw new ServiceException("Can't start " + this.getClass().getSimpleName() + "'. Required model (SashModel) should be loaded prior starting the service.");
+ }
// create the service
- sashModelMngr = new TransactionalDiSashModelMngr(pageModelRegistry, sashModel.getResource(), transactionalEditingDomain);
+ sashModelMngr = new DiSashModelMngr(pageModelRegistry, sashModel.getResource());
}
@@ -72,6 +75,7 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
*
* @throws ServiceException
*/
+ @Override
public void disposeService() throws ServiceException {
}
@@ -81,6 +85,7 @@ public class DiSashModelMngrServiceFactory implements IServiceFactory {
* @return
* @throws ServiceException
*/
+ @Override
public Object createServiceInstance() throws ServiceException {
// Start locally the service if needed.
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
index e682ced360b..af63fc6987a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
@@ -24,6 +24,7 @@ import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
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.emf.ecore.xmi.XMIResource;
@@ -37,7 +38,7 @@ import org.eclipse.papyrus.infra.core.Activator;
* @author cedric dumoulin
*
*/
-public abstract class AbstractBaseModel extends AbstractModel implements IVersionableModel {
+public abstract class AbstractBaseModel extends AbstractModel implements IVersionableModel, IEMFModel {
/**
* The associated resource.
@@ -52,6 +53,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
/**
* @return the resource
*/
+ @Override
public Resource getResource() {
return resource;
}
@@ -85,12 +87,14 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
*
* @param fullPath
*/
+ @Override
@Deprecated
public void createModel(IPath fullPath) {
createModel(getPlatformURI(fullPath));
}
+ @Override
public void createModel(URI uri) {
// Compute model URI
resourceURI = uri.appendFileExtension(getModelFileExtension());
@@ -156,6 +160,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
*
* @param fullPathWithoutExtension
*/
+ @Override
@Deprecated
public void loadModel(IPath fullPathWithoutExtension) {
loadModel(getPlatformURI(fullPathWithoutExtension));
@@ -167,6 +172,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
*
* @param fullPathWithoutExtension
*/
+ @Override
public void loadModel(URI uriWithoutExtension) {
// Compute model URI
resourceURI = uriWithoutExtension.appendFileExtension(getModelFileExtension());
@@ -181,17 +187,31 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
}
/**
+ * Queries whether my resource (based on the given URI) exists in the current model set.
+ *
+ * @param uriWithoutExtension
+ * the base resource URI to check
+ *
+ * @return whether my resource based on this URI exists
+ */
+ protected boolean exists(URI uriWithoutExtension) {
+ return modelSet.getURIConverter().exists(uriWithoutExtension.appendFileExtension(getModelFileExtension()), null);
+ }
+
+ /**
* Import the model by using the provided fullpath as a hint for the
* resource URI. In this implementation, simply call {@link #loadModel(IPath)}
*
* @param fullPathWithoutExtension
*/
+ @Override
@Deprecated
public void importModel(IPath fullPathWithoutExtension) {
loadModel(fullPathWithoutExtension);
}
+ @Override
public void importModel(URI uriWithoutExtension) {
loadModel(uriWithoutExtension);
}
@@ -201,6 +221,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
* @see org.eclipse.papyrus.infra.core.resource.IModel#saveModel()
*
*/
+ @Override
public void saveModel() throws IOException {
if(!getModelManager().getTransactionalEditingDomain().isReadOnly(resource) && !ModelUtils.resourceFailedOnLoad(resource)) {
resource.save(null);
@@ -212,11 +233,13 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
*
* @param nameWithoutExt
*/
+ @Override
@Deprecated
public void changeModelPath(IPath fullPath) {
setModelURI(getPlatformURI(fullPath));
}
+ @Override
public void setModelURI(URI uriWithoutExtension) {
// Compute model URI
resourceURI = uriWithoutExtension.appendFileExtension(getModelFileExtension());
@@ -228,6 +251,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
* @see org.eclipse.papyrus.infra.core.resource.IModel#dispose()
*
*/
+ @Override
public void unload() {
// call registered snippets
snippets.performDispose(this);
@@ -237,6 +261,8 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
resource.unload();
resource = null;
}
+
+ super.unload();
}
@@ -259,6 +285,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
}
+ @Override
public void saveCopy(IPath targetPathWithoutExtension, Map<Object, Object> targetMap) {
// OutputStream targetStream = getOutputStream(targetPath);
Map<Object, Object> saveOptions = new HashMap<Object, Object>();
@@ -275,6 +302,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
// resource.save(targetStream, options);
}
+ @Override
public void fillTargetMap(IPath targetPathWithoutExtension, Map<Object, Object> targetMap) {
targetMap.put(getResourceURI(), getTargetURI(targetPathWithoutExtension));
}
@@ -342,6 +370,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
}
+ @Override
public Set<URI> getModifiedURIs() {
if(getResource() != null) {
if(!getResource().isTrackingModification() || getResource().isModified()) {
@@ -351,4 +380,43 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
return Collections.emptySet();
}
+ @Override
+ public void handle(Resource resource) {
+ //Default: do nothing
+ }
+
+ @Override
+ public boolean isModelFor(Object element) {
+ return element != null && element == resource;
+ }
+
+ /**
+ * For standard controlled resources, resources have a single root with a non-null eContainer
+ *
+ *
+ * @param resource
+ * @return
+ */
+ @Override
+ public boolean isControlled(Resource resource) {
+ if(resource == this.resource || resource == null) {
+ return false;
+ }
+
+ if(resource.getContents().isEmpty()) {
+ return false;
+ }
+
+ EObject rootElement = resource.getContents().get(0);
+
+ boolean isControlled = rootElement.eContainer() != null;
+ if(isControlled) {
+ Resource parentResource = rootElement.eContainer().eResource();
+ boolean isChildOfMainResource = parentResource == this.resource || isControlled(parentResource);
+ return isChildOfMainResource;
+ }
+
+ return false;
+ }
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModel.java
index 0f9d4b9b500..06693ef5daf 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModel.java
@@ -39,6 +39,7 @@ public abstract class AbstractModel implements IModel {
/**
* {@inheritDoc}
*/
+ @Override
public void init(ModelSet modelSet) {
this.modelSet = modelSet;
}
@@ -64,18 +65,21 @@ public abstract class AbstractModel implements IModel {
/**
* {@inheritDoc}
*/
+ @Override
public abstract String getIdentifier();
/**
* {@inheritDoc}
*/
+ @Override
public void addModelSnippet(IModelSnippet snippet) {
snippets.add(snippet);
}
-
+
/**
* {@inheritDoc}
*/
+ @Override
public void setAfterLoadModelDependencies(List<String> afterLoadModelIdentifiers) {
this.afterLoadModelIdentifiers = afterLoadModelIdentifiers;
}
@@ -83,6 +87,7 @@ public abstract class AbstractModel implements IModel {
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getAfterLoadModelIdentifiers() {
return afterLoadModelIdentifiers;
}
@@ -90,6 +95,7 @@ public abstract class AbstractModel implements IModel {
/**
* {@inheritDoc}
*/
+ @Override
public void setBeforeUnloadDependencies(List<String> unloadBeforeModelIdentifiers) {
this.unloadBeforeModelIdentifiers = unloadBeforeModelIdentifiers;
}
@@ -97,7 +103,19 @@ public abstract class AbstractModel implements IModel {
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getUnloadBeforeModelIdentifiers() {
return unloadBeforeModelIdentifiers;
}
+
+ @Override
+ public void unload() {
+ this.modelSet = null;
+ snippets.clear();
+ }
+
+ @Override
+ public boolean isModelFor(Object element) {
+ return false;
+ }
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
index 23cc84c2507..a7f330c19f1 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.resource;
@@ -12,18 +12,20 @@ import java.util.Map;
import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.Activator;
/**
* Base class for models sharing a common {@link Resource}. To share a common {@link Resource}, one of the model should be Master, while the other are
* slaves. The Master is the one performing the save operation. All the model
* should use the same file extension. So, {@link #getModelFileExtension()} should return the same value for all models.
- *
+ *
* @author cedric dumoulin
- *
+ *
* @param T
* Type of the roots of the model.
*/
-public abstract class AbstractModelWithSharedResource<T extends EObject> extends AbstractBaseModel {
+public abstract class AbstractModelWithSharedResource<T extends EObject> extends EMFLogicalModel {
/**
* Possible type for this model: master or slave
@@ -38,9 +40,9 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
private ModelKind modelKind;
/**
- *
+ *
* Constructor.
- *
+ *
* @param modelKind
*/
public AbstractModelWithSharedResource(ModelKind modelKind) {
@@ -49,7 +51,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* By default, we are a slave. Constructor.
- *
+ *
* @param modelKind
*/
public AbstractModelWithSharedResource() {
@@ -61,17 +63,22 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
*/
@Override
public void loadModel(URI uriWithoutExtension) {
-
- // Look for the resource
- lookupResource(uriWithoutExtension);
-
- // Check if model is loaded.
- if(resourceIsSet()) {
- configureResource(resource);
- return;
+ try {
+ // Look for the resource
+ lookupResource(uriWithoutExtension);
+
+ // Check if model is loaded.
+ if(resourceIsSet()) {
+ configureResource(resource);
+ return;
+ }
+ // model is not loaded, do it.
+ super.loadModel(uriWithoutExtension);
+ } catch (Exception ex) {
+ if(modelKind == ModelKind.master) {
+ Activator.log.error(ex);
+ }
}
- // model is not loaded, do it.
- super.loadModel(uriWithoutExtension);
}
/**
@@ -79,21 +86,26 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
*/
@Override
public void createModel(URI uri) {
-
- // Look for the resource
- lookupResource(uri);
-
- // Check if model is loaded.
- if(resourceIsSet()) {
- configureResource(resource);
- return;
+ try {
+ // Look for the resource
+ lookupResource(uri);
+
+ // Check if model is loaded.
+ if(resourceIsSet()) {
+ configureResource(resource);
+ return;
+ }
+ super.createModel(uri);
+ } catch (Exception ex) {
+ if(modelKind == ModelKind.master) {
+ Activator.log.error(ex);
+ }
}
- super.createModel(uri);
}
/**
* Lookup for the resource in the resourceSet.
- *
+ *
* @param uri
* the URI (without extension) of the resource to look for
*/
@@ -108,9 +120,9 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* Do nothing as we are slave. The Resource is save by the master model.
- *
+ *
* @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#saveModel()
- *
+ *
* @throws IOException
*/
@Override
@@ -140,7 +152,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* Get the root of this model. Lookup in the associated {@link Resource} for
* the root.
- *
+ *
* @return The root of the model, or null if no root exist.
*/
@SuppressWarnings("unchecked")
@@ -159,7 +171,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* Get the roots of this model. Lookup in the associated {@link Resource} for the roots.
- *
+ *
* @return A list containing the roots of the model. The list is empty if
* there is no root.
*/
@@ -180,7 +192,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* Return true if the provided object is a root of the model, false
* otherwise. This method should be implemented by subclasses.
- *
+ *
* @param object
* @return
*/
@@ -188,7 +200,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
/**
* Add a root to this model.
- *
+ *
* @param root
*/
public void addModelRoot(T root) {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
new file mode 100644
index 00000000000..749da273e49
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * 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.resource;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * An IModel which is an abstraction for a set of consistent EMF Resources
+ *
+ * @author Camille Letavernier
+ *
+ */
+public abstract class EMFLogicalModel extends AbstractBaseModel implements IEMFModel {
+
+ protected final Set<Resource> resources = new HashSet<Resource>();
+
+ public Set<Resource> getResources() {
+ return resources;
+ }
+
+ @Override
+ protected void configureResource(Resource resourceToConfigure) {
+ super.configureResource(resourceToConfigure);
+ if(resourceToConfigure != null) {
+ resources.add(resourceToConfigure);
+ }
+ }
+
+ protected boolean isRelatedResource(Resource resource) {
+ if(resource == null) {
+ return false;
+ }
+
+ return resource.getURI().fileExtension().equals(getModelFileExtension());
+ }
+
+ @Override
+ public void saveModel() throws IOException {
+ for(Resource resource : getResources()) {
+ if(!getModelManager().getTransactionalEditingDomain().isReadOnly(resource) && !ModelUtils.resourceFailedOnLoad(resource)) {
+ resource.save(null);
+ }
+ }
+ }
+
+ @Override
+ public void handle(Resource resource) {
+ if(isRelatedResource(resource)) {
+ configureResource(resource);
+ }
+ }
+
+ @Override
+ public void unload() {
+ super.unload();
+ getResources().clear();
+ }
+
+ @Override
+ public void setModelURI(URI uriWithoutExtension) {
+ for(Resource resource : getResources()) {
+ if(isControlled(resource)) {
+ updateURI(resource, uriWithoutExtension);
+ }
+ }
+ super.setModelURI(uriWithoutExtension);
+ }
+
+ protected void updateURI(Resource resource, URI uriWithoutExtension) {
+ URI oldBaseURI = this.resource.getURI();
+ URI newBaseURI = uriWithoutExtension.appendFileExtension(getModelFileExtension());
+
+ URI currentFullURI = resource.getURI();
+ URI currentRelativeURI = currentFullURI.deresolve(oldBaseURI);
+ URI newFullURI = currentRelativeURI.resolve(newBaseURI);
+
+ resource.setURI(newFullURI);
+ }
+
+ @Override
+ public boolean isModelFor(Object element) {
+ if(element instanceof EObject) {
+ return resources.contains(((EObject)element).eResource());
+ }
+ return resources.contains(element);
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IEMFModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IEMFModel.java
new file mode 100644
index 00000000000..28edae26b04
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IEMFModel.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * 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.resource;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+
+public interface IEMFModel extends IModel {
+
+ public Resource getResource();
+
+ public void handle(Resource resource);
+
+ public boolean isControlled(Resource resource);
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IModel.java
index 075660a24e8..89db73a7bbd 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IModel.java
@@ -63,7 +63,8 @@ public interface IModel {
/**
* Create the model resource(s).
*
- * @param uri the URI, without file extension, where the model should be saved.
+ * @param uri
+ * the URI, without file extension, where the model should be saved.
*/
public void createModel(URI uri);
@@ -81,7 +82,8 @@ public interface IModel {
/**
* Load the model from the specified path..
*
- * @param uri the URI, without file extension, where the model should be saved.
+ * @param uri
+ * the URI, without file extension, where the model should be saved.
* Should be used as a basis to guess the model URI.
*/
public void loadModel(URI uri);
@@ -99,7 +101,8 @@ public interface IModel {
/**
* Import the model from the specified URI.
*
- * @param uri the URI, without file extension, where the model is.
+ * @param uri
+ * the URI, without file extension, where the model is.
*/
public void importModel(URI uri);
@@ -123,7 +126,8 @@ public interface IModel {
/**
* Sets the path under which the model should be saved. Does not save it.
*
- * @param uri the new base model URI, without file extension
+ * @param uri
+ * the new base model URI, without file extension
*/
public void setModelURI(URI uri);
@@ -151,25 +155,43 @@ public interface IModel {
/**
* Sets the list of Model (referenced by identifiers) that should be loaded before this one is loaded.
- * @param afterLoadModelIdentifiers the list of Model (referenced by identifiers) that should be loaded before this one can be loaded, or <code>null</code> if there are no dependencies
+ *
+ * @param afterLoadModelIdentifiers
+ * the list of Model (referenced by identifiers) that should be loaded before this one can be loaded, or <code>null</code> if there are no
+ * dependencies
*/
public void setAfterLoadModelDependencies(List<String> afterLoadModelIdentifiers);
/**
* Returns the Models (referenced by identifiers) that should be loaded before this one is loaded.
- * @return the Models (referenced by identifiers) that should be loaded before this one can be loaded, or <code>null</code> if there are no dependencies
+ *
+ * @return the Models (referenced by identifiers) that should be loaded before this one can be loaded, or <code>null</code> if there are no
+ * dependencies
*/
public List<String> getAfterLoadModelIdentifiers();
-
+
/**
* Sets the list of Model (referenced by identifiers) that should not be unloaded before this one is unloaded.
- * @param unloadBeforeModelIdentifiers the Models (referenced by identifiers) that should not be unloaded before this one is unloaded, or <code>null</code> if there are no dependencies
+ *
+ * @param unloadBeforeModelIdentifiers
+ * the Models (referenced by identifiers) that should not be unloaded before this one is unloaded, or <code>null</code> if there are no
+ * dependencies
*/
public void setBeforeUnloadDependencies(List<String> unloadBeforeModelIdentifiers);
-
+
/**
* Returns the Models (referenced by identifiers) that should not be unloaded before this one is unloaded.
- * @return the Models (referenced by identifiers) that should not be unloaded before this one is loaded, or <code>null</code> if there are no dependencies
+ *
+ * @return the Models (referenced by identifiers) that should not be unloaded before this one is loaded, or <code>null</code> if there are no
+ * dependencies
*/
public List<String> getUnloadBeforeModelIdentifiers();
+
+ /**
+ * Tests whether this model provides the specified element
+ *
+ * @param element
+ * @return
+ */
+ public boolean isModelFor(Object element);
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
index fcfbae771dd..48475d9458e 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
@@ -48,6 +48,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -136,6 +137,7 @@ public class ModelSet extends ResourceSetImpl {
getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
getLoadOptions().put(XMIResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE);
getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ getLoadOptions().put(XMLResource.OPTION_USE_PACKAGE_NS_URI_AS_LOCATION, Boolean.FALSE);
this.eAdapters.add(new ResourceAddRemoveTracker());
}
@@ -312,6 +314,13 @@ public class ModelSet extends ResourceSetImpl {
* @return the same resource for convenience
*/
protected Resource setResourceOptions(Resource r) {
+
+ for(IModel model : models.values()) {
+ if(model instanceof IEMFModel) {
+ ((IEMFModel)model).handle(r);
+ }
+ }
+
if(r != null && isTrackingModification() && !r.isTrackingModification()) {
r.setTrackingModification(true);
}
@@ -864,14 +873,18 @@ public class ModelSet extends ResourceSetImpl {
*/
public void saveAs(URI uri) throws IOException {
+ EcoreUtil.resolveAll(this); //Save will not be consistent if we don't load all related resources first
+
// Get the file name, without extension.
- uriWithoutExtension = uri.trimFileExtension();
+ URI newUriWithoutExtension = uri.trimFileExtension();
// Walk all registered models
for(IModel model : models.values()) {
- model.setModelURI(uriWithoutExtension);
+ model.setModelURI(newUriWithoutExtension);
}
+ this.uriWithoutExtension = newUriWithoutExtension;
+
// Save with new paths
save(new NullProgressMonitor());
}
@@ -1137,4 +1150,19 @@ public class ModelSet extends ResourceSetImpl {
}
}
+
+ /**
+ * Returns the IModel which handles the specified element, if any
+ *
+ * @param container
+ * @return
+ */
+ public IModel getModelFor(Object element) {
+ for(IModel model : models.values()) {
+ if(model.isModelFor(element)) {
+ return model;
+ }
+ }
+ return null;
+ }
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
index 87b9d28383a..d0513ce4d06 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
@@ -1,19 +1,35 @@
-/**
- *
- */
+/*****************************************************************************
+ * Copyright (c) 2011, 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
+ * Christian W. Damus (CEA) - bug 429242
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
import static org.eclipse.papyrus.infra.core.Activator.log;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
+import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.extension.ExtensionException;
import org.eclipse.papyrus.infra.core.extension.ExtensionUtils;
+import com.google.common.collect.Sets;
+
/**
* A reader to read model from Eclipse extension and register them to the
* specified ModelManager.
@@ -54,6 +70,9 @@ public class ModelsReader extends ExtensionUtils {
/** name of the attribute "identifier"*/
public static final String IDENTIFIER_ATTRIBUTE_NAME = "identifier";
+
+ /** Name of the extension indicating the model's canonical file extension. */
+ private static final String EXTENSION_ATTRIBUTE = "fileExtension"; //$NON-NLS-1$
/** Namespace where to look for the extension points. */
protected String extensionPointNamespace;
@@ -96,11 +115,64 @@ public class ModelsReader extends ExtensionUtils {
// // global snippets
// modelSet.addModelSetSnippet(new TypeCacheInitializer());
// Reading data from plugins
- IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EXTENSION_POINT_NAME);
+ IConfigurationElement[] configElements = getExtensions();
addDeclaredModels(configElements, modelSet);
addDeclaredModelSetSnippets(configElements, modelSet);
}
+ private IConfigurationElement[] getExtensions() {
+ return Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointNamespace, EXTENSION_POINT_NAME);
+ }
+
+ /**
+ * Queries whether there is a registered model correlating to the specified URI.
+ *
+ * @param uri
+ * a resource URI (including the file extension, if there is one)
+ *
+ * @return {@code true} if the URI has a file extension and that extension is associated with any registered {@link IModel}; {@code false},
+ * otherwise
+ */
+ public boolean hasAssociatedModel(URI uri) {
+ boolean result = false;
+
+ String extension = uri.fileExtension();
+ if(extension != null) {
+ IConfigurationElement[] configs = getExtensions();
+ for(int i = 0; !result && (i < configs.length); i++) {
+ String modelExtension = configs[i].getAttribute(EXTENSION_ATTRIBUTE);
+ result = (modelExtension != null) && modelExtension.equals(extension);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Queries the collection of distinct resource URIs that are recognized by Papyrus as model resources, based on the specified prototype.
+ *
+ * @param prototypeURI
+ * an example of a URI of a component resource of a Papyrus model; it may be but is not required to be a *.di URI, but it must have a file
+ * extension
+ *
+ * @return the collection of known model resource URIs that are related to the given prototype
+ */
+ public Collection<URI> getKnownModelURIs(URI prototypeURI) {
+ Set<URI> result = Sets.newHashSet();
+
+ final URI uriWithoutExtension = prototypeURI.trimFileExtension();
+
+ IConfigurationElement[] configs = getExtensions();
+ for(int i = 0; i < configs.length; i++) {
+ String modelExtension = configs[i].getAttribute(EXTENSION_ATTRIBUTE);
+ if(modelExtension != null) {
+ result.add(uriWithoutExtension.appendFileExtension(modelExtension));
+ }
+ }
+
+ return result;
+ }
+
/**
* Read and instanciate declared models
*
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/AbstractSashModelProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/AbstractSashModelProvider.java
new file mode 100644
index 00000000000..ebd9b363908
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/AbstractSashModelProvider.java
@@ -0,0 +1,50 @@
+/*
+ * 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.resource.sasheditor;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+
+
+/**
+ * A partial implementation of the {@link ISashModelProvider} protocol.
+ */
+public abstract class AbstractSashModelProvider implements ISashModelProvider {
+
+ private ModelSet modelSet;
+
+ public AbstractSashModelProvider() {
+ super();
+ }
+
+ @Override
+ public void initialize(ModelSet modelSet) {
+ this.modelSet = modelSet;
+ }
+
+ @Override
+ public void dispose() {
+ modelSet = null;
+ }
+
+ protected ModelSet getModelSet() {
+ return modelSet;
+ }
+
+ @Override
+ public Resource loadSashModel(URI sashModelURI) {
+ return modelSet.getResource(sashModelURI, true);
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
index ebfd4abe0f2..9276ac4aff6 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
@@ -1,16 +1,32 @@
-/**
+/*****************************************************************************
+ * Copyright (c) 2011, 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:
+ * LIFL - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.resource.IModel;
/**
* @author dumoulin
*
- * @deprecated Use {@link SashModel} instead
*/
-@Deprecated
-public class DiModel {
+public class DiModel extends AbstractModelWithSharedResource<EObject> implements IModel {
/**
* File extension used for notation.
@@ -23,8 +39,77 @@ public class DiModel {
public static final String DI_FILE_EXTENSION = MODEL_FILE_EXTENSION;
/**
- * Model ID.
+ * Sash Model ID.
+ *
+ * @deprecated Use {@link SashModel#MODEL_ID} instead
*/
+ @Deprecated
public static final String MODEL_ID = "org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel"; //$NON-NLS-1$
+ /**
+ * The ID of the DI Model
+ */
+ public static final String DI_MODEL_ID = "org.eclipse.papyrus.infra.core.resource.DiModel"; //$NON-NLS-1$
+
+
+ public DiModel() {
+ super(ModelKind.master);
+ }
+
+ /**
+ * Get the file extension used for this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return DI_FILE_EXTENSION;
+ }
+
+ /**
+ * Get the identifier used to register this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return DI_MODEL_ID;
+ }
+
+ @Override
+ public void loadModel(URI uriWithoutExtension) {
+ // It is a common use case that this resource does not (and will not) exist
+ if(exists(uriWithoutExtension)) {
+ try {
+ super.loadModel(uriWithoutExtension);
+ } catch (Exception ex) {
+ createModel(uriWithoutExtension);
+ }
+ }
+
+ if(resource == null) {
+ createModel(uriWithoutExtension);
+ }
+ }
+
+
+ @Override
+ protected Map<Object, Object> getSaveOptions() {
+ Map<Object, Object> saveOptions = super.getSaveOptions();
+
+ saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.FALSE);
+ saveOptions.put(XMIResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.FALSE);
+
+ return saveOptions;
+ }
+
+ @Override
+ protected boolean isModelRoot(EObject object) {
+ return false; //DiModel is currently an empty model
+ }
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/ISashModelProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/ISashModelProvider.java
new file mode 100644
index 00000000000..782a887ee60
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/ISashModelProvider.java
@@ -0,0 +1,32 @@
+/*
+ * 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.resource.sasheditor;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+
+
+/**
+ * This is the ISashModelProvider type. Enjoy.
+ */
+public interface ISashModelProvider {
+
+ URI getSashModelURI(URI userModelURI);
+
+ void initialize(ModelSet modelSet);
+
+ Resource loadSashModel(URI sashModelURI);
+
+ void dispose();
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
index c7edfb1ed43..e9298718eb4 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
@@ -1,34 +1,62 @@
-/**
- *
- */
+/*****************************************************************************
+ * Copyright (c) 2009-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:
+ * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Rewrite the sash model - store in the plugin's PreferenceStore (Bug 429239)
+ * Christian W. Damus (CEA) - bug 429242
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
+import java.util.Collections;
import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.resource.EMFLogicalModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
+
+import com.google.common.base.Objects;
/**
- * Model for the sash system. <br>
- * This model can share its resource with other model. This model is declared as {@link ModelKind#master}. Other model whishing to share the resource
- * should
- * subclass {@link AbstractModelWithSharedResource}, be declared as {@link ModelKind#slave} (which is the default.), and set
- * {@link #getModelFileExtension()} to return the same file extension as this
- * model ({@link #MODEL_FILE_EXTENSION}).
+ * Model for the sash system.
+ *
+ * It may be stored in the *.di file (Legacy mode) or in a *.sash file in the user
+ * preference space (~workspace/.metadata/.plugins/org.eclipse.papyrus.infra.core/)
*
- * @author cedric dumoulin
+ * @author Cedric Dumoulin
+ * @author Camille Letavernier
*
*/
-public class SashModel extends AbstractModelWithSharedResource<org.eclipse.papyrus.infra.core.sashwindows.di.SashModel> implements IModel {
+public class SashModel extends EMFLogicalModel implements IModel {
+
+ private SashModelProviderManager providerManager;
/**
- * File extension used for notation.
+ * File extension.
+ *
+ * @deprecated Use {@link DiModel#MODEL_FILE_EXTENSION} instead. The SashModel has been moved to a separate file
*/
+ @Deprecated
public static final String MODEL_FILE_EXTENSION = "di"; //$NON-NLS-1$
/**
+ * File extension for the Sash model
+ */
+ public static final String SASH_MODEL_FILE_EXTENSION = "sash"; //$NON-NLS-1$
+
+ /**
* Model ID.
*/
public static final String MODEL_ID = "org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel"; //$NON-NLS-1$
@@ -39,7 +67,7 @@ public class SashModel extends AbstractModelWithSharedResource<org.eclipse.papyr
*
*/
public SashModel() {
- super(ModelKind.master);
+
}
/**
@@ -51,7 +79,37 @@ public class SashModel extends AbstractModelWithSharedResource<org.eclipse.papyr
*/
@Override
protected String getModelFileExtension() {
- return MODEL_FILE_EXTENSION;
+ if(isLegacy((resourceURI == null) ? resourceURI : resourceURI.trimFileExtension())) {
+ return MODEL_FILE_EXTENSION;
+ } else {
+ return SASH_MODEL_FILE_EXTENSION;
+ }
+ }
+
+ @Override
+ public void init(ModelSet modelSet) {
+ super.init(modelSet);
+
+ this.providerManager = new SashModelProviderManager(modelSet);
+ }
+
+ @Override
+ public void unload() {
+ if(providerManager != null) {
+ providerManager.dispose();
+ providerManager = null;
+ }
+
+ super.unload();
+ }
+
+ @Override
+ protected boolean isRelatedResource(Resource resource) {
+ if(resource == null) {
+ return false;
+ }
+ String fileExtension = resource.getURI().fileExtension();
+ return MODEL_FILE_EXTENSION.equals(fileExtension) || SASH_MODEL_FILE_EXTENSION.equals(fileExtension);
}
/**
@@ -67,8 +125,91 @@ public class SashModel extends AbstractModelWithSharedResource<org.eclipse.papyr
}
@Override
- protected boolean isModelRoot(EObject object) {
- return object instanceof org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
+ public void loadModel(URI uriWithoutExtension) {
+
+ URI sashModelURI = getSashModelURI(uriWithoutExtension);
+
+ this.resourceURI = sashModelURI;
+
+ try {
+ super.loadModel(sashModelURI.trimFileExtension());
+ } catch (Exception ex) {
+ createModel(sashModelURI.trimFileExtension());
+ }
+
+ if(resource == null) {
+ createModel(sashModelURI.trimFileExtension());
+ }
+ }
+
+ @Override
+ public void createModel(URI uriWithoutExtension) {
+ if(isLegacy(uriWithoutExtension)) {
+ super.createModel(getSashModelStoreURI(uriWithoutExtension).trimFileExtension());
+ } else {
+ super.createModel(uriWithoutExtension);
+ }
+ }
+
+ @Override
+ public void setModelURI(URI uriWithoutExtension) {
+ URI newURI;
+ if((resourceURI != null) && isLegacy(resourceURI.trimFileExtension())) {
+ newURI = getLegacyURI(uriWithoutExtension);
+ } else {
+ newURI = getSashModelStoreURI(uriWithoutExtension);
+ }
+
+ super.setModelURI(newURI.trimFileExtension());
+ }
+
+ protected boolean isLegacy(URI uriWithoutExtension) {
+ if(uriWithoutExtension == null) {
+ return false;
+ }
+ return Objects.equal(uriWithoutExtension, getModelManager().getURIWithoutExtension());
+ }
+
+ /**
+ * Returns the sash model URI (With file extension)
+ *
+ * It may be either the Legacy URI (platform:/resource/model/model.di)
+ * or the 1.0.0 URI (file:/~workspace/.metadata/.plugins/org.eclipse.papyrus.infra.core/model/model.sash)
+ *
+ * @param uriWithoutExtension
+ * @return
+ *
+ */
+ protected URI getSashModelURI(URI uriWithoutExtension) {
+ URIConverter converter = getModelManager().getURIConverter();
+ URI legacyURI = getLegacyURI(uriWithoutExtension);
+
+ //If the DI file exists and contains a SashWindowsMngr, this is a legacy model
+ if(converter.exists(legacyURI, Collections.emptyMap())) {
+ try {
+ Resource diResource = getModelManager().getResource(legacyURI, true);
+ if(DiUtils.lookupSashWindowsMngr(diResource) != null) {
+ return legacyURI;
+ }
+ } catch (Exception ex) {
+ //Temporary workaround: the DI file may exist and be empty
+ //(DiModel is currently disabled and doesn't properly init the di file)
+ //Log the error and continue
+ Activator.log.error(ex);
+ }
+ }
+
+ URI preferenceStoreURI = getSashModelStoreURI(uriWithoutExtension);
+
+ return preferenceStoreURI;
+ }
+
+ protected URI getLegacyURI(URI uriWithoutExtension) {
+ return uriWithoutExtension.appendFileExtension(MODEL_FILE_EXTENSION);
+ }
+
+ protected URI getSashModelStoreURI(URI uriWithoutExtension) {
+ return providerManager.getSashModelProvider(uriWithoutExtension).getSashModelURI(uriWithoutExtension);
}
@Override
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelProviderManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelProviderManager.java
new file mode 100644
index 00000000000..d904a48ed20
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelProviderManager.java
@@ -0,0 +1,219 @@
+/*
+ * 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.resource.sasheditor;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Strings;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+
+/**
+ * This is the SashModelProviderManager type. Enjoy.
+ */
+class SashModelProviderManager {
+
+ private static final String E_PROVIDER = "sashModelProvider"; //$NON-NLS-1$
+
+ private static final String EXT_PT = Activator.PLUGIN_ID + "." + E_PROVIDER; //$NON-NLS-1$
+
+ private final ModelSet modelSet;
+
+ private final ISashModelProvider defaultSashModelProvider;
+
+ private final List<ProviderDescriptor> descriptors;
+
+ SashModelProviderManager(ModelSet modelSet) {
+ super();
+
+ this.modelSet = modelSet;
+ this.defaultSashModelProvider = createDefaultSashModelProvider();
+ this.descriptors = new CopyOnWriteArrayList<SashModelProviderManager.ProviderDescriptor>(createDescriptors());
+ }
+
+ void dispose() {
+ for(ProviderDescriptor next : descriptors) {
+ next.dispose();
+ }
+ }
+
+ /**
+ * Obtains the most appropriate sash model provider for the specified URI.
+ *
+ * @param userModelURI
+ *
+ * @return the sash model provider, never {@code null} (there is always a default available)
+ */
+ ISashModelProvider getSashModelProvider(final URI userModelURI) {
+ ISashModelProvider result = null;
+
+ // We know at least the back-stop descriptor will match
+ ProviderDescriptor descriptor = Iterables.find(descriptors, new Predicate<Predicate<URI>>() {
+
+ @Override
+ public boolean apply(Predicate<URI> input) {
+ return input.apply(userModelURI);
+ }
+ });
+
+ try {
+ result = descriptor.getProvider();
+ } catch (CoreException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ result = defaultSashModelProvider;
+
+ // Remove the offending descriptor
+ descriptors.remove(descriptor);
+ }
+
+ return result;
+ }
+
+ private List<ProviderDescriptor> createDescriptors() {
+ List<ProviderDescriptor> result = Lists.newArrayListWithExpectedSize(1);
+
+ for(IConfigurationElement next : Platform.getExtensionRegistry().getConfigurationElementsFor(EXT_PT)) {
+ if(E_PROVIDER.equals(next.getName())) {
+ try {
+ result.add(new ProviderDescriptor(next));
+ } catch (CoreException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ }
+
+ // The back-stop that will match any URI not previously matched
+ result.add(new ProviderDescriptor(defaultSashModelProvider));
+
+ return result;
+ }
+
+ private ISashModelProvider createDefaultSashModelProvider() {
+ return new AbstractSashModelProvider() {
+
+ @Override
+ public URI getSashModelURI(URI userModelURI) {
+ final URI uriWithoutExtension = userModelURI.trimFileExtension();
+
+ IPath stateLocation = Activator.getDefault().getStateLocation();
+
+ if(uriWithoutExtension.isPlatform()) {
+ stateLocation = stateLocation.append(uriWithoutExtension.toPlatformString(true));
+ } else {
+ //TODO properly support and test non-platform URIs that are not already handled by extensions
+ stateLocation = stateLocation.append(URI.decode(uriWithoutExtension.toString()));
+ }
+
+ URI workspaceFileURI = URI.createFileURI(stateLocation.toString()).appendFileExtension(SashModel.SASH_MODEL_FILE_EXTENSION);
+
+ return workspaceFileURI;
+ }
+ };
+ }
+
+ //
+ // Nested types
+ //
+
+ private class ProviderDescriptor implements Predicate<URI> {
+
+ private static final String A_SCHEME = "scheme"; //$NON-NLS-1$
+
+ private static final String A_PATTERN = "pattern"; //$NON-NLS-1$
+
+ private static final String A_CLASS = "class"; //$NON-NLS-1$
+
+ private final IConfigurationElement config;
+
+ private final String scheme;
+
+ private final Pattern pattern;
+
+ private ISashModelProvider provider;
+
+ ProviderDescriptor(ISashModelProvider provider) {
+ this.provider = provider;
+
+ this.config = null;
+ this.scheme = null;
+ this.pattern = null;
+ }
+
+ ProviderDescriptor(IConfigurationElement config) throws CoreException {
+ this.config = config;
+
+ this.scheme = config.getAttribute(A_SCHEME);
+ String pattern = config.getAttribute(A_PATTERN);
+
+ if(Strings.isNullOrEmpty(scheme) && Strings.isNullOrEmpty(pattern)) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Sash model provider missing both scheme and pattern filter.")); //$NON-NLS-1$
+ }
+
+ try {
+ this.pattern = (pattern == null) ? null : Pattern.compile(pattern);
+ } catch (PatternSyntaxException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid sash model provider URI pattern filter.", e)); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public boolean apply(URI input) {
+ return ((scheme == null) || scheme.equals(input.scheme())) // Scheme filter
+ && ((pattern == null) || pattern.matcher(input.toString()).find()); // Pattern filter
+ }
+
+ ISashModelProvider getProvider() throws CoreException {
+ if(provider == null) {
+ try {
+ provider = (ISashModelProvider)config.createExecutableExtension(A_CLASS);
+ provider.initialize(modelSet);
+ } catch (CoreException e) {
+ throw e;
+ } catch (ClassCastException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid sash model provider implementation.", e)); //$NON-NLS-1$
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to initialize sash model provider implementation.", e)); //$NON-NLS-1$
+ }
+ }
+
+ return provider;
+ }
+
+ void dispose() {
+ if(provider != null) {
+ try {
+ provider.dispose();
+ } catch (Exception e) {
+ Activator.log.error("Failed to initialize sash model provider implementation.", e); //$NON-NLS-1$
+ }
+
+ provider = null;
+ }
+ }
+ }
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
index d7b4ff60f42..09aebef450c 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -29,13 +29,14 @@ 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.di.contentprovider.TransactionalDiSashModelMngr;
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;
@@ -124,27 +125,10 @@ public class EditorUtils {
* @param diResource
* @return The non transactional implementation of IPageMngr
*/
- public static IPageMngr getIPageMngr(Resource diResource) {
+ public static IPageManager getIPageMngr(Resource diResource) {
return DiSashModelMngr.createIPageMngr(diResource);
}
- /**
- * Create an instance of IPageMngr acting on the provided resource. This
- * instance is suitable to add, remove, close or open diagrams.
- *
- * @param diResource
- * @param editingDomain
- *
- * @return The transactional implementation of IPageMngr
- *
- * @deprecated The TransactionalIPageMngr is deprecated. You should use IPageManager instead.
- * Transactions should be started by the IPageManager user when necessary.
- */
- @Deprecated
- public static IPageMngr getTransactionalIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
- return TransactionalDiSashModelMngr.createIPageMngr(diResource, editingDomain);
- }
-
////////////////////////////////////////////
// The following methods are deprecated. They have been replaced by specific
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
new file mode 100644
index 00000000000..060c29865d2
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/TransactionHelper.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.utils;
+
+
+/**
+ * This helper can be used to run (safe) transactions outside the CommandStack
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class TransactionHelper extends org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper {
+
+ //Refactoring needed. The sasheditor contentprovider should have dependencies to infra.EMF...
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
index 9fe993c7ac9..ea9f90089b1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
@@ -19,6 +19,9 @@
id="org.eclipse.papyrus.infra.emf.readonly.EMFReadOnlyHandler"
priority="5">
</readOnlyHandler>
+ <readOnlyHandler
+ class="org.eclipse.papyrus.infra.emf.readonly.SashModelReadOnlyHandler"
+ priority="20"></readOnlyHandler>
</extension>
<extension
point="org.eclipse.ui.handlers">
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/SashModelReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/SashModelReadOnlyHandler.java
new file mode 100644
index 00000000000..bf0a1a1a086
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/SashModelReadOnlyHandler.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
+
+import com.google.common.base.Optional;
+
+/**
+ * A ReadOnlyHandler for the Sash Model (*.sash or *.di).
+ *
+ * If the model is located in the user preferences space, it may be considered
+ * read-only by other read-only handlers, whereas it shouldn't.
+ *
+ * Its priority should be greater than EMFReadOnlyHandler, FSReadOnlyHandler and
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class SashModelReadOnlyHandler extends AbstractReadOnlyHandler {
+
+ private ModelSet modelSet;
+
+ public SashModelReadOnlyHandler(EditingDomain editingDomain) {
+ super(editingDomain);
+
+ if(getEditingDomain().getResourceSet() instanceof ModelSet) {
+ modelSet = (ModelSet)getEditingDomain().getResourceSet();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Optional<Boolean> anyReadOnly(URI[] uris) {
+ if(modelSet == null) {
+ return Optional.absent();
+ }
+
+ for(URI uri : uris) {
+ if(SashModel.SASH_MODEL_FILE_EXTENSION.equals(uri.fileExtension())) {
+ return Optional.of(false);
+ }
+
+ if(DiModel.DI_FILE_EXTENSION.equals(uri.fileExtension())) {
+ return Optional.of(false);
+ }
+ }
+
+ return Optional.absent();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Optional<Boolean> makeWritable(URI[] uris) {
+ return Optional.absent(); //If the file is read-only, it can probably made writable by other read-only handlers (e.g. FSReadOnlyHandler).
+ }
+
+
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/xtend-gen/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/xtend-gen/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.java
index 45d28e177fc..4fe96783a9d 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/xtend-gen/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/xtend-gen/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.java
@@ -1,14 +1,6 @@
-/*****************************************************************************
- * Copyright (c) 2012-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
- *****************************************************************************/
+/**
+ * generated by Xtext
+ */
package org.eclipse.papyrus.infra.gmfdiag.generator;
import org.eclipse.emf.ecore.resource.Resource;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
index fa4ead24b23..bc57fa0ca1a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
@@ -131,7 +131,7 @@ public class DirectEditorsContributionItem extends ContributionItem implements I
buffer.append(configuration.getLanguage());
buffer.append(" Editor");
if(configuration.equals(defaultConfig)) {
- buffer.append(" (Default)");
+ buffer.append(" (Default via F2)");
}
item.setText(buffer.toString());
item.addSelectionListener(new SelectionListener() {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
index ff058440c5b..3a55da7a740 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
@@ -14,11 +14,14 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
@@ -92,19 +95,24 @@ public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObj
* {@inheritDoc}
*/
public void run(IAction action) {
- // retrieves graphical context (in which shell it should open for
- // exemple)
+ // retrieves graphical context (in which shell it should open for example
final IDirectEditorConfiguration configuration = directEditorExtensionPoint.getDirectEditorConfiguration();
configuration.preEditAction(getEditedObject());
Dialog dialog = null;
- if (configuration instanceof IPopupEditorConfiguration) {
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ GraphicalEditPart selectedElement = getSelectedElement();
+ if (selectedElement != null) {
+ Request request = new Request(RequestConstants.REQ_DIRECT_EDIT);
+ selectedElement.performRequest(request);
+ }
+ return;
+ } else if (configuration instanceof IPopupEditorConfiguration) {
IPopupEditorConfiguration popupEditor = (IPopupEditorConfiguration)configuration ;
popupEditor.createPopupEditorHelper(getSelectedElement()).showEditor() ;
return ;
- }
- if(configuration instanceof IAdvancedEditorConfiguration) {
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), configuration.getTextToEdit(getEditedObject()));
} else if(configuration instanceof IDirectEditorConfiguration) {
dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), ((IDirectEditorConfiguration)configuration).getTextToEdit(getEditedObject()), (IDirectEditorConfiguration)configuration);
@@ -115,7 +123,7 @@ public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObj
if(Window.OK == dialog.open()) {
TransactionalEditingDomain domain = ((DiagramEditor)part).getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$
@Override
protected void doExecute() {
@@ -127,6 +135,44 @@ public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObj
}
}
+ /*
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request
+ .getExtendedData()
+ .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request
+ .getExtendedData()
+ .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((request instanceof DirectEditRequest)
+ && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ */
+
/**
* Sets the configuration for the editor
*
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index fff597c93c0..2d220dd6389 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -66,7 +66,8 @@
point="org.eclipse.papyrus.infra.core.model">
<model
classname="org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel"
- description="Model for notation">
+ description="Model for notation"
+ fileExtension="notation">
</model>
</extension>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
index bf4c1426cf2..dc40a7c659b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
@@ -1,17 +1,27 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.gmfdiag.common.model;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
+import org.eclipse.papyrus.infra.core.resource.EMFLogicalModel;
+import org.eclipse.papyrus.infra.core.resource.IEMFModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenableWithContainer;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
/**
* @author dumoulin
- *
+ *
*/
-public class NotationModel extends AbstractBaseModel implements IModel {
+public class NotationModel extends EMFLogicalModel implements IModel {
/**
* File extension used for notation.
@@ -24,9 +34,9 @@ public class NotationModel extends AbstractBaseModel implements IModel {
public static final String MODEL_ID = "org.eclipse.papyrus.infra.core.resource.notation.NotationModel"; //$NON-NLS-1$
/**
- *
+ *
* Constructor.
- *
+ *
*/
public NotationModel() {
@@ -34,9 +44,9 @@ public class NotationModel extends AbstractBaseModel implements IModel {
/**
* Get the file extension used for this model.
- *
+ *
* @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
+ *
* @return
*/
@Override
@@ -46,9 +56,9 @@ public class NotationModel extends AbstractBaseModel implements IModel {
/**
* Get the identifier used to register this model.
- *
+ *
* @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
- *
+ *
* @return
*/
@Override
@@ -58,11 +68,49 @@ public class NotationModel extends AbstractBaseModel implements IModel {
/**
* Add a new initialized {@link Diagram} to the model.
- *
+ *
* @param newDiagram
* The diagram to add.
*/
public void addDiagram(Diagram newDiagram) {
getResource().getContents().add(newDiagram);
}
+
+ /**
+ * Notation resources are controlled if their base element is controlled
+ */
+ @Override
+ public boolean isControlled(Resource resource) {
+ for(EObject rootElement : resource.getContents()) {
+ IOpenable openable = (IOpenableWithContainer)Platform.getAdapterManager().getAdapter(rootElement, IOpenable.class);
+ if(openable instanceof IOpenableWithContainer) {
+ EObject container = EMFHelper.getEObject(((IOpenableWithContainer)openable).getContainer());
+ if(container != null) {
+ IModel iModel = modelSet.getModelFor(container);
+ if(iModel instanceof IEMFModel) {
+ if(((IEMFModel)iModel).isControlled(container.eResource())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void handle(Resource resource) {
+ super.handle(resource);
+ if(resource == null) {
+ return;
+ }
+
+ if(!isRelatedResource(resource)) {
+ URI notationURI = resource.getURI().trimFileExtension().appendFileExtension(NOTATION_FILE_EXTENSION);
+ if(getResourceSet().getURIConverter().exists(notationURI, Collections.emptyMap())) {
+ getResourceSet().getResource(notationURI, true);
+ }
+ }
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.facetSet b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.facetSet
index e9d84debf6c..071c642b488 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.facetSet
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.facetSet
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="ASCII"?>
<facet:FacetSet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:facet="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="StyleSheets" nsURI="http://www.eclipse.org/papyrus/infra/gmfdiag/css/facets" nsPrefix="cssFacets">
<eClassifiers xsi:type="facet:Facet" name="StyleSheetsContainer" abstract="true">
- <eSuperTypes href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <eSuperTypes href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/>
<eStructuralFeatures xsi:type="facet:FacetReference" name="styleSheets" lowerBound="1" upperBound="-1" volatile="true" unsettable="true">
<eType xsi:type="ecore:EClass" href="http://www.eclipse.org/papyrus/infra/gmfdiag/css#//StyleSheet"/>
<valueQuery xsi:type="query:JavaModelQuery" href="StyleSheets.querySet#GetStyleSheets"/>
</eStructuralFeatures>
<conditionQuery xsi:type="query:JavaModelQuery" href="StyleSheets.querySet#IsStyleSheetContainer"/>
</eClassifiers>
- <extendedPackage href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+ <extendedPackage href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
</facet:FacetSet>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.querySet b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.querySet
index c3d0df826b3..b9a111badbb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.querySet
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.querySet
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="ASCII"?>
<query:ModelQuerySet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="StyleSheets" description="">
- <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
<associatedMetamodels href="http://www.eclipse.org/papyrus/infra/gmfdiag/css#/"/>
<queries xsi:type="query:JavaModelQuery" name="IsStyleSheetContainer" description="Tests whether the context is a StyleSheet container or not" lowerBound="1" implementationClassName="org.eclipse.papyrus.infra.gmfdiag.css.model.queries.IsStyleSheetContainer">
<returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <scope href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/>
</queries>
<queries xsi:type="query:JavaModelQuery" name="GetStyleSheets" description="Returns all the stylesheets contained in the given stylesheet container" upperBound="-1" lowerBound="1" implementationClassName="org.eclipse.papyrus.infra.gmfdiag.css.model.queries.GetStyleSheets">
<returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/papyrus/infra/gmfdiag/css#//StyleSheet"/>
- <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <scope href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/>
</queries>
</query:ModelQuerySet>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
index daa8c5734ac..4e08786f7d5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -11,8 +11,6 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.hyperlink.navigation;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
@@ -48,17 +46,7 @@ public class DiagramNavigableElement implements NavigableElement {
if(pageManager.isOpen(targetDiagram)) {
pageManager.selectPage(targetDiagram);
} else {
- TransactionalEditingDomain domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(targetDiagram);
-
- RecordingCommand command = new RecordingCommand(domain, "Open diagram") {
-
- @Override
- protected void doExecute() {
- pageManager.openPage(targetDiagram);
- }
- };
-
- domain.getCommandStack().execute(command);
+ pageManager.openPage(targetDiagram);
}
return true;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
index 2209c186520..a6220b4d8d6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
@@ -125,9 +125,9 @@
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
<!--metamodel
- nsURI="http://www.eclipse.org/uml2/4.0.0/UML"-->
+ nsURI="http://www.eclipse.org/uml2/5.0.0/UML"-->
<metamodel
- nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
<adviceBinding
class="org.eclipse.papyrus.infra.nattable.common.helper.advice.NatTableDuplicateEditHelperAdvice"
id="org.eclipse.papyrus.infra.nattable.common.helper.advice.NatTableDuplicateEditHelperAdvice"
@@ -151,5 +151,15 @@
commandId="org.eclipse.papyrus.infra.nattable.createFromCatalog.command"
icon="icons/tableCatalog.png">
</image>
+</extension>
+<extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.papyrus.infra.nattable.model.nattable.Table"
+ class="org.eclipse.papyrus.infra.nattable.common.adapter.NattableAdapterFactory">
+ <adapter
+ type="org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable">
+ </adapter>
+ </factory>
</extension>
</plugin>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/adapter/NattableAdapterFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/adapter/NattableAdapterFactory.java
new file mode 100644
index 00000000000..73b90cbcb5b
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/adapter/NattableAdapterFactory.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.common.adapter;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenableWithContainer;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+@SuppressWarnings("rawtypes")
+public class NattableAdapterFactory implements IAdapterFactory {
+
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if(adapterType == IOpenable.class) {
+ if(adaptableObject instanceof Table) {
+ Table table = (Table)adaptableObject;
+ return new IOpenableWithContainer.Openable(adaptableObject, table.getContext());
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[]{ IOpenable.class };
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
index ab2952144d6..c46f94f1dbb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
@@ -15,81 +15,95 @@ package org.eclipse.papyrus.infra.nattable.views.config.manager.axis;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
+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.PageRef;
+import org.eclipse.papyrus.infra.emf.adapters.ResourceSetRootsAdapter;
import org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.views.config.Activator;
import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
/**
- *
+ *
* @author Vincent Lorenzo
- *
+ *
*/
public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOnEStructuralFeatureAxisManager {
- /**
- * we keep it to be able to remove the listener during the destruction of the table
- */
- private PageList pageList;
+ private IPageManager pageManager;
+ private ModelSet modelSet;
/**
- *
+ *
* @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#addContextFeatureValueListener()
- *
+ *
*/
@Override
protected void addContextFeatureValueListener() {
- this.featureListener = new AdapterImpl() {
+ this.featureListener = new ResourceSetRootsAdapter() {
@Override
- public void notifyChanged(final Notification msg) {
- if(msg.getFeature() == DiPackage.eINSTANCE.getPageList_AvailablePage()) {
+ protected void doNotify(Notification msg) {
+ switch(msg.getEventType()) {
+ case Notification.ADD:
+ case Notification.ADD_MANY:
+ case Notification.REMOVE:
+ case Notification.REMOVE_MANY:
featureValueHasChanged(msg);
}
}
};
- getPageList().eAdapters().add(this.featureListener);
+
+ try {
+ modelSet = ServiceUtilsForEObject.getInstance().getModelSet(getTableManager().getTable());
+ this.featureListener.setTarget(modelSet);
+ //modelSet.eAdapters().add(this.featureListener);
+ } catch (Exception ex) {
+ Activator.log.error("An error occurred when trying to install a listener on the available pages", ex);
+ }
}
- private PageList getPageList() {
- if(this.pageList == null) {
- this.pageList = Utils.getPageList(getTableManager().getTable());
+ @Override
+ protected void removeListeners() {
+ if(modelSet != null && featureListener != null) {
+ ((ResourceSetRootsAdapter)featureListener).unsetTarget(modelSet);
}
- return this.pageList;
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#getFeaturesValue()
- *
+ *
* @return
*/
@Override
protected List<Object> getFeaturesValue() {
- final List<Object> pages = new ArrayList<Object>();
- for(final PageRef current : getPageList().getAvailablePage()) {
- final Object pageIdentifier = current.getPageIdentifier();
- if(pageIdentifier != null) {
- pages.add(pageIdentifier);
+ if(pageManager == null) {
+ try {
+ pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(getTableManager().getTable());
+ } catch (Exception ex) {
+ Activator.log.error("The page manager is not accessible", ex);
+ return Collections.emptyList();
}
}
- return pages;
+ return new LinkedList<Object>(pageManager.allPages());
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#verifyValues()
- *
+ *
*/
@Override
protected void verifyValues() {
@@ -97,9 +111,9 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAllowedContents(java.lang.Object)
- *
+ *
* @param object
* @return
*/
@@ -112,7 +126,7 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @param page
* a page
* @return
@@ -134,24 +148,23 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose()
- *
+ *
*/
@Override
public void dispose() {
- if(getPageList() != null) {
- getPageList().eAdapters().remove(this.featureListener);
- }
- this.pageList = null;
+ this.pageManager = null;
super.dispose();
+ this.modelSet = null;
+ this.featureListener = null;
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#canEditAxisHeader()
- *
+ *
* @return
*/
@Override
@@ -160,9 +173,9 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#canDestroyAxisElement(java.lang.Integer)
- *
+ *
* @param axisPosition
* @return
*/
@@ -172,9 +185,9 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#getDestroyAxisElementCommand(TransactionalEditingDomain, java.lang.Integer)
- *
+ *
* @param domain
* @param axisPosition
* @return
@@ -185,7 +198,7 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
/**
- *
+ *
* @param notification
* update the list of the managed objects if its required
*/
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java
index 03979850031..19ec48e2fff 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java
@@ -13,20 +13,11 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.views.config.utils;
-import javax.naming.Context;
-
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-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.SashWindowsMngr;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.views.config.Activator;
/**
@@ -82,21 +73,6 @@ public class Utils {
/**
*
- * @return
- * the page list used for this model
- */
- public static final PageList getPageList(final Table table) {
- final Resource resource = table.eResource();
- final ModelSet modelSet = (ModelSet)resource.getResourceSet();
- final Resource diResource = modelSet.getAssociatedResource(resource, DiModel.DI_FILE_EXTENSION, false);
- final SashWindowsMngr windowMngr = DiUtils.lookupSashWindowsMngr(diResource);
- final PageList pageList = windowMngr.getPageList();
- assert pageList != null;
- return pageList;
- }
-
- /**
- *
* @param eobject
* an eobject
* @return
@@ -117,7 +93,7 @@ public class Utils {
* @param editor
* an editor
* @return
- * the {@link Context} of this editor, or <code>null</code> if not found
+ * the Context of this editor, or <code>null</code> if not found
*/
public static final Object getEditorContext(final Object editor) {
if(editor instanceof EObject) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
index 23e6ab67c03..d8fe5eabb5a 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -13,9 +13,6 @@ package org.eclipse.papyrus.infra.nattable.provider;
import java.util.Collection;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
@@ -43,11 +40,10 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
if(table instanceof IStructuredSelection) {
return super.getText((IStructuredSelection)table);
}
- Object el = table;
- if(table instanceof IAdaptable) {
- el = EMFHelper.getEObject(table);
- }
- if(el != null && el instanceof Table) {
+
+ Object el = EMFHelper.getEObject(table);
+
+ if(el instanceof Table) {
return ((Table)el).getName();
}
return ""; //$NON-NLS-1$
@@ -65,11 +61,11 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
if(table instanceof IStructuredSelection) {
return getImage(((IStructuredSelection)table));
}
- if(table instanceof IAdaptable) {
- table = EMFHelper.getEObject(table);
- }
+
+ table = EMFHelper.getEObject(table);
+
if(table instanceof Table) {
- final String iconPath = ((Table)table).getTableConfiguration().getIconPath();
+ final String iconPath = getIcon((Table)table);
if(iconPath != null) {
return Activator.getDefault().getImage(iconPath);
}
@@ -77,6 +73,13 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
return null;
}
+ protected String getIcon(Table table) {
+ if(table == null || table.getTableConfiguration() == null || table.getTableConfiguration().getIconPath() == null) {
+ return null;
+ }
+ return table.getTableConfiguration().getIconPath();
+ }
+
/**
*
* @see org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider#accept(java.lang.Object)
@@ -84,19 +87,13 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
* @param object
* @return
*/
+ @Override
public boolean accept(Object object) {
if(object instanceof IStructuredSelection) {
return accept((IStructuredSelection)object);
}
- Object el = object;
- if(object instanceof IAdaptable) {
- el = EMFHelper.getEObject(object);
- }
- if(el != null) {
- return el instanceof Table;
- }
- return false;
+ return EMFHelper.getEObject(object) instanceof Table;
}
/**
@@ -127,14 +124,18 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
protected boolean hasCommonImage(Collection<?> objects) {
String iconPath = null;
for(Object current : objects) {
- Assert.isTrue(current instanceof Table);
- Table table = (Table)current;
- String icon = table.getTableConfiguration().getIconPath();
- Assert.isNotNull(icon);
+ if(!(current instanceof Table)) {
+ return false;
+ }
+
+ String icon = getIcon((Table)current);
+ if(icon == null && iconPath != null) {
+ return false;
+ }
+
if(iconPath == null) {
iconPath = icon;
- }
- if(!iconPath.equals(icon)) {
+ } else if(!iconPath.equals(icon)) {
return false;
}
}
@@ -148,10 +149,9 @@ public class TableLabelProvider extends EMFLabelProvider implements IFilteredLab
* @param commonObject
* @return
*/
+ @Override
protected Image getNonCommonIcon(final Object commonObject) {
return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(org.eclipse.papyrus.infra.nattable.Activator.PLUGIN_ID, "/icons/table.gif");
}
-
-
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/plugin.xml b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/plugin.xml
index 2fd59656b57..c1b0cd1dd03 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/plugin.xml
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/plugin.xml
@@ -103,7 +103,7 @@
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
<metamodel
- nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
<adviceBinding
class="org.eclipse.papyrus.infra.extendedtypes.advices.ExtendedTypesOwnerAdvice"
id="org.eclipse.papyrus.uml.advice.ExtendedTypesOwnerAdvice"
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
index b0b335a9e35..79aa3d7ed94 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,8 +22,6 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -35,15 +33,11 @@ import org.eclipse.papyrus.commands.CreationCommandRegistry;
import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.commands.ICreationCommandRegistry;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageModelFactoryRegistry;
import org.eclipse.papyrus.infra.core.extension.NotFoundException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.PluggableEditorFactoryReader;
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.IPageModel;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -70,7 +64,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
/**
* Gets the selected editor.
- *
+ *
* @return the selectedEditor
*/
protected Object getSelectedEditor() {
@@ -78,13 +72,8 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
}
/**
- * This factory is used to know if represent a valid editor or not
- */
- private PageModelFactoryRegistry pageFactory = null;
-
- /**
* Sets the selected editor
- *
+ *
* @param selectedEditor
* the selectedEditor to set
*/
@@ -111,7 +100,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
* component using the component's <code>addDiagramCreateListener<code> method. When
* the diagramCreate event occurs, that object's appropriate
* method is invoked.
- *
+ *
* @see DiagramCreateEvent
*/
public class DiagramCreateListener extends SelectionAdapter {
@@ -127,7 +116,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
/**
* {@inheritedDoc}.
- *
+ *
* @param e
* the e
*/
@@ -163,7 +152,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
/**
* Instantiates a new diagram create listener.
- *
+ *
* @param commandDescriptor
* the command descriptor
* @param backboneContext
@@ -182,7 +171,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
/**
* Sets the container.
- *
+ *
* @param container
* the new container
*/
@@ -196,7 +185,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
/**
* Instantiates a new editor look for diagram.
- *
+ *
* @param editorFactoryRegistry
* the editor factory registry
* @param amodel
@@ -251,10 +240,11 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
public boolean hasChildren(Object element) {
return super.getChildren(element).length > 0;
}
+
/**
- *
- * @see org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider#getChildren(java.lang.Object)
*
+ * @see org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider#getChildren(java.lang.Object)
+ *
* @param parentElement
* @return
*/
@@ -291,7 +281,8 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
//we can't reuse the same instance of the label provider see bug 385599: [Hyperlink] We can't select the diagram/table for referencing them
diagramListTreeViewer.setLabelProvider(labelProvider);
- diagramListTreeViewer.setContentProvider(new EditorListContentProvider(model, getPageModelFactoryRegistry()));
+
+ diagramListTreeViewer.setContentProvider(new EditorListContentProvider(model));
diagramListTreeViewer.setInput(""); //$NON-NLS-1$
// add listner on the new button to display menu for each diagram
@@ -320,10 +311,8 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
Iterator<?> iterator = iSelection.iterator();
final IPageManager pageManager;
- TransactionalEditingDomain editingDomain;
try {
pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(model);
- editingDomain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(model);
} catch (ServiceException ex) {
Activator.log.error(ex);
return;
@@ -341,15 +330,9 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
return;
}
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Delete diagrams") {
-
- @Override
- protected void doExecute() {
- for(Object page : pagesToDelete) {
- pageManager.removePage(page);
- }
- }
- });
+ for(Object page : pagesToDelete) {
+ pageManager.closeAllOpenedPages(page);
+ }
//getDiagramfilteredTree().getViewer().setInput(""); //$NON-NLS-1$
getModeFilteredTree().getViewer().refresh();
@@ -439,45 +422,14 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
if(!(object instanceof EObject)) {
return false;
}
- EObject eobject = (EObject)object;
- try {
- final IPageManager pageMng = ServiceUtilsForEObject.getInstance().getIPageManager(eobject);
- if(pageMng.allPages().contains(eobject)) {
- return true;
- }
- } catch (ServiceException ex) {
- //nothing to do
- }
- //if we are here, there are 2 cases :
- //1. the object is a valid editor but it is not in the page manager (imported file probably)
- //2. or the object is not a valid editor
- IPageModel pageModel = getPageModelFactoryRegistry().createIPageModel(eobject);
- if(pageModel != null) {
- pageModel = null;
- return true;
- }
- return false;
- }
+ EObject eObject = (EObject)object;
- /**
- *
- * @return
- * returns the page model factory
- */
- protected PageModelFactoryRegistry getPageModelFactoryRegistry() {
- if(this.pageFactory == null) {
- this.pageFactory = new PageModelFactoryRegistry();
- final PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
- ServicesRegistry reg = null;
- try {
- reg = ServiceUtilsForEObject.getInstance().getServiceRegistry(model);
- editorReader.populate(pageFactory, reg);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
+ try {
+ return ServiceUtilsForEObject.getInstance().getIPageMngr(eObject).allPages().contains(object);
+ } catch (ServiceException ex) {
+ return false;
}
- return this.pageFactory;
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
index 1ee66c8b3f8..b7603596d8f 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
@@ -17,13 +17,9 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
@@ -37,33 +33,10 @@ public class EditorListContentProvider implements ITreeContentProvider {
//The context of the ContentProvider
private EObject model;
- @Deprecated
- // since february 2014
public EditorListContentProvider(EObject model) {
- this(model, null);
- }
-
- /**
- * This factory is used to know if represent a valid editor or not
- */
- private IPageModelFactory pageFactory;
-
-
- /**
- *
- * Constructor.
- *
- * @param model
- * the model
- * @param pageModelFactory
- * the page factory used to know is an object can be a page or not
- */
- public EditorListContentProvider(EObject model, IPageModelFactory pageModelFactory) {
this.model = model;
- this.pageFactory = pageModelFactory;
}
-
/**
* {@inheritDoc}
*/
@@ -90,25 +63,14 @@ public class EditorListContentProvider implements ITreeContentProvider {
*/
public Object[] getElements(Object inputElement) {
try {
- List<Object> res = new ArrayList<Object>();
- if(pageFactory == null) {
- IPageManager iPageMngr = ServiceUtilsForEObject.getInstance().getIPageManager(model);
- Object[] result = iPageMngr.allPages().toArray();
-
+ IPageManager iPageMngr = ServiceUtilsForEObject.getInstance().getIPageManager(model);
+ Object[] result = iPageMngr.allPages().toArray();
- for(Object current : result) {
- if(current != null /* && current instanceof PapyrusTableInstance */) {
- // if the model is a little bit corrupted, we can have a null element in the list
- res.add(current);
- }
- }
- } else {
- for(final Resource current : model.eResource().getResourceSet().getResources()) {
- for(final Object object : current.getContents()) {
- if(isAValidEditor(object)) {
- res.add(object);
- }
- }
+ List<Object> res = new ArrayList<Object>();
+ for(Object current : result) {
+ if(current != null /* && current instanceof PapyrusTableInstance */) {
+ // if the model is a little bit corrupted, we can have a null element in the list
+ res.add(current);
}
}
return res.toArray();
@@ -119,33 +81,6 @@ public class EditorListContentProvider implements ITreeContentProvider {
return null;
}
- //duplicated code from EditorLookForEditorShell
- private boolean isAValidEditor(final Object object) {
- if(!(object instanceof EObject)) {
- return false;
- }
- EObject eobject = (EObject)object;
- try {
- final IPageManager pageMng = ServiceUtilsForEObject.getInstance().getIPageManager(eobject);
- if(pageMng.allPages().contains(eobject)) {
- return true;
- }
- } catch (ServiceException ex) {
- //nothing to do
- }
-
- //if we are here, there are 2 cases :
- //1. the object is a valid editor but it is not in the page manager (imported file probably)
- //2. or the object is not a valid editor
- IPageModel pageModel = this.pageFactory.createIPageModel(eobject);
- if(pageModel != null) {
- pageModel = null;
- return true;
- }
- return false;
- }
-
-
/**
* {@inheritDoc}
*/
diff --git a/plugins/infra/queries/org.eclipse.papyrus.infra.queries.core.configuration/model/Configuration.genmodel b/plugins/infra/queries/org.eclipse.papyrus.infra.queries.core.configuration/model/Configuration.genmodel
index f3e5af92bf1..e1ab6b1384f 100644
--- a/plugins/infra/queries/org.eclipse.papyrus.infra.queries.core.configuration/model/Configuration.genmodel
+++ b/plugins/infra/queries/org.eclipse.papyrus.infra.queries.core.configuration/model/Configuration.genmodel
@@ -31,11 +31,11 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Configuration.ecore#//ListParameterValue/values"/>
</genClasses>
</genPackages>
- <genPackages prefix="Types" ecorePackage="http://www.eclipse.org/uml2/4.0.0/Types#/">
- <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
- <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/4.0.0/Types#//Integer"/>
- <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/4.0.0/Types#//Real"/>
- <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/4.0.0/Types#//UnlimitedNatural"/>
+ <genPackages prefix="Types" ecorePackage="http://www.eclipse.org/uml2/5.0.0/Types#/">
+ <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
+ <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/5.0.0/Types#//Integer"/>
+ <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/5.0.0/Types#//Real"/>
+ <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
+ <genDataTypes ecoreDataType="http://www.eclipse.org/uml2/5.0.0/Types#//UnlimitedNatural"/>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.history/src/org/eclipse/papyrus/infra/services/controlmode/history/HistoryModel.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.history/src/org/eclipse/papyrus/infra/services/controlmode/history/HistoryModel.java
index a2cc46211c1..d588191ab32 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.history/src/org/eclipse/papyrus/infra/services/controlmode/history/HistoryModel.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode.history/src/org/eclipse/papyrus/infra/services/controlmode/history/HistoryModel.java
@@ -1,8 +1,20 @@
-/**
- *
- */
+/*****************************************************************************
+ * Copyright (c) 2010, 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:
+ * LIFL - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.services.controlmode.history;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
import org.eclipse.papyrus.infra.services.controlmode.mm.history.ControledResource;
@@ -65,4 +77,12 @@ public class HistoryModel extends AbstractModelWithSharedResource<ControledResou
return object instanceof ControledResource;
}
+ @Override
+ public void loadModel(URI uriWithoutExtension) {
+ // It is a common use case that this resource does not (and will not) exist
+ if(exists(uriWithoutExtension)) {
+ super.loadModel(uriWithoutExtension);
+ }
+ }
+
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/InitializeSashCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/InitializeSashCommand.java
index 49bb5a53216..32139c23623 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/InitializeSashCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/InitializeSashCommand.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -34,9 +34,9 @@ import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequestParamete
/**
* Initialize the di resource with all necessary informations
* ex : Page Ref
- *
+ *
* @author adaussy
- *
+ *
*/
public class InitializeSashCommand extends AbstractControlCommand {
@@ -64,7 +64,7 @@ public class InitializeSashCommand extends AbstractControlCommand {
e.printStackTrace();
return CommandResult.newErrorCommandResult(e);
}
- return CommandResult.newOKCommandResult();
+ return CommandResult.newOKCommandResult();
}
/**
@@ -88,7 +88,7 @@ public class InitializeSashCommand extends AbstractControlCommand {
/**
* Create a new {@link SashModel} and add page ref for each diagrams and tables being controlled
- *
+ *
* @param openables
* @return
* @throws SashEditorException
@@ -101,11 +101,11 @@ public class InitializeSashCommand extends AbstractControlCommand {
for(EObject openable : openables) {
PageRef pageRef = DiUtils.getPageRef(diResource, openable);
if(pageRef != null) {
- windowsMngr.getPageList().addPage(pageRef.getPageIdentifier());
+ //windowsMngr.getPageList().addPage(pageRef.getPageIdentifier()); //The page list is not used anymore
DiUtils.addPageToTabFolder(windowsMngr, pageRef);
}
}
return windowsMngr;
}
-} \ No newline at end of file
+}
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 04b6d10618a..490fdf7dab6 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
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -28,9 +28,7 @@ import org.eclipse.emf.ecore.EObject;
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.RecordingCommand;
import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editor.IPapyrusPageInput;
import org.eclipse.papyrus.infra.core.editor.PapyrusPageInput;
@@ -164,7 +162,7 @@ public class OpenElementServiceImpl implements OpenElementService {
URI diFile = getDiResourceURI(semanticElement);
editor = openURIsInNewEditor(diFile, pageURIs);
} else {
- final IPageManager pageMngr = registry.getService(IPageManager.class);
+ final IPageManager pageManager = registry.getService(IPageManager.class);
ModelSet modelSet = registry.getService(ModelSet.class);
final LinkedHashSet<EObject> pagesToOpen = new LinkedHashSet<EObject>();
final LinkedHashSet<EObject> pagesToSelect = new LinkedHashSet<EObject>();
@@ -172,8 +170,8 @@ public class OpenElementServiceImpl implements OpenElementService {
for(URI pageURI : pageURIs) {
final EObject page = modelSet.getEObject(pageURI, true);
- if(pageMngr.allPages().contains(page)) {
- if(pageMngr.isOpen(page)) {
+ if(pageManager.allPages().contains(page)) {
+ if(pageManager.isOpen(page)) {
pagesToSelect.add(page);
} else {
pagesToOpen.add(page);
@@ -182,23 +180,15 @@ public class OpenElementServiceImpl implements OpenElementService {
}
if(!pagesToOpen.isEmpty()) {
- TransactionalEditingDomain editingDomain = registry.getService(TransactionalEditingDomain.class);
- RecordingCommand command = new RecordingCommand(editingDomain, "Open pages") {
-
- @Override
- protected void doExecute() {
- for(EObject page : pagesToOpen) {
- pageMngr.openPage(page);
- }
- }
- };
- editingDomain.getCommandStack().execute(command);
+ for(EObject page : pagesToOpen) {
+ pageManager.openPage(page);
+ }
}
- //More than one editor can be visible (SashEditor).
+ //More than one editor can be visible (SashEditor).
//We need to select each page
for(EObject page : pagesToSelect) {
- pageMngr.selectPage(page);
+ pageManager.selectPage(page);
}
}
@@ -266,7 +256,7 @@ public class OpenElementServiceImpl implements OpenElementService {
return EcoreUtil.getURI(currentViewElement);
}
} catch (ServiceException ex) {
- //There is no IPageManager (The editor is not opened yet)
+ //There is no IPageManager (The editor is not opened yet)
//The page is "probably" the root element of the view
EObject rootElement = EcoreUtil.getRootContainer(viewElement);
if(rootElement != null) {
@@ -300,7 +290,7 @@ public class OpenElementServiceImpl implements OpenElementService {
return false;
}
}
-
+
protected URI getDiResourceURI(EObject element) {
Resource resource = element.eResource();
URI fileURI = resource.getURI();
@@ -332,15 +322,7 @@ public class OpenElementServiceImpl implements OpenElementService {
if(pageManager.isOpen(page)) {
pageManager.selectPage(page);
} else {
- TransactionalEditingDomain editingDomain = registry.getService(TransactionalEditingDomain.class);
- RecordingCommand command = new RecordingCommand(editingDomain, "Open page") {
-
- @Override
- protected void doExecute() {
- pageManager.openPage(page);
- }
- };
- editingDomain.getCommandStack().execute(command);
+ pageManager.openPage(page);
}
}
}
@@ -350,11 +332,11 @@ public class OpenElementServiceImpl implements OpenElementService {
protected IMultiDiagramEditor openURIsInNewEditor(URI diResourceURI, URI[] pageURIs) throws PartInitException {
final IEditorInput input = createPapyrusPageInput(diResourceURI, pageURIs);
-
- if (input == null) {
+
+ if(input == null) {
return null;
}
-
+
RunnableWithResult<IMultiDiagramEditor> runnable;
Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<IMultiDiagramEditor>() {
@@ -379,16 +361,16 @@ public class OpenElementServiceImpl implements OpenElementService {
protected IPapyrusPageInput createPapyrusPageInput(URI diResourceURI, URI[] pageURIs) {
IFile diFile = null;
-
+
if((diResourceURI != null) && diResourceURI.isPlatformResource()) {
diFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(diResourceURI.toPlatformString(true)));
}
-
+
return ((diFile == null) || !diFile.exists()) ? null : new PapyrusPageInput(diFile, pageURIs, false);
}
-
+
protected IMultiDiagramEditor openEditor(IWorkbenchPage workbenchPage, IEditorInput input) throws PartInitException {
return (IMultiDiagramEditor)IDE.openEditor(workbenchPage, input, PAPYRUS_EDITOR_ID);
}
-
+
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
index ffd71bfcc4b..c0fbb880675 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
@@ -24,9 +24,9 @@ import org.eclipse.ui.part.EditorPart;
/**
* A simple model that can be used as editor in tests.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class UnloadResourcesEditorModel implements IEditorModel {
@@ -42,7 +42,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- *
+ *
* @return
*/
public String getTabTitle() {
@@ -51,7 +51,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- *
+ *
* @return
*/
public Image getTabIcon() {
@@ -60,7 +60,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- *
+ *
* @return
*/
public Object getRawModel() {
@@ -70,7 +70,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- *
+ *
* @return
* @throws PartInitException
*/
@@ -80,7 +80,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- *
+ *
* @return
*/
public EditorActionBarContributor getActionBarContributor() {
@@ -89,9 +89,9 @@ public class UnloadResourcesEditorModel implements IEditorModel {
/**
* A class implementing a fake editor.
- *
+ *
* @author dumoulin
- *
+ *
*/
public static class UnloadResourcesEditorPart extends EditorPart {
@@ -135,7 +135,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
label.setImage(image);
label.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
Text t = new Text(compo, SWT.None);
- t.setText("This diagram is contained in an unresolved resource : " + unloadedUri.trimFragment().toString());
+ t.setText("This diagram is contained in an unresolved resource : " + URI.decode(unloadedUri.trimFragment().toString()));
t.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
t.setEditable(false);
label.setBackground(t.getBackground());
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/EcoreDiagnostician.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/EcoreDiagnostician.java
index 25c89b5c292..0a06f3af747 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/EcoreDiagnostician.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/EcoreDiagnostician.java
@@ -32,7 +32,16 @@ public class EcoreDiagnostician extends Diagnostician implements IPapyrusDiagnos
protected AdapterFactory adapterFactory;
protected IProgressMonitor progressMonitor;
+ /**
+ * Create diagnostician with custom validator (that must subclass ECore validator)
+ * @param validatorAdapter custom validator adapter
+ */
+ public EcoreDiagnostician(EValidatorAdapter validatorAdapter) {
+ this.validatorAdapter = validatorAdapter;
+ }
+
public EcoreDiagnostician() {
+ validatorAdapter = new EValidatorAdapter();
}
public void initialize (final AdapterFactory adapterFactory, final IProgressMonitor progressMonitor) {
@@ -40,7 +49,7 @@ public class EcoreDiagnostician extends Diagnostician implements IPapyrusDiagnos
this.progressMonitor=progressMonitor;
}
- protected EValidatorAdapter validatorAdapter = new EValidatorAdapter();
+ protected EValidatorAdapter validatorAdapter;
@Override
public String getObjectLabel(EObject eObject) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
index 553d5dfc013..efa81b4be64 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
@@ -29,11 +29,11 @@ import org.eclipse.ui.PlatformUI;
public class ValidationFunctions implements IDecorationSpecificFunctions {
- public static final String error_co = "icons/etool16/error_co.gif";
+ public static final String error_co = "icons/etool16/error_co.gif"; //$NON-NLS-1$
- public static final String warning_co = "icons/etool16/warning_co.gif";
+ public static final String warning_co = "icons/etool16/warning_co.gif"; //$NON-NLS-1$
- public static final String info_co = "icons/etool16/info_co.gif";
+ public static final String info_co = "icons/etool16/info_co.gif"; //$NON-NLS-1$
/**
* Return the image descriptor associated with an validation marker
@@ -104,7 +104,7 @@ public class ValidationFunctions implements IDecorationSpecificFunctions {
public String getMessage(IPapyrusMarker marker) {
// message is stored within marker
- return marker.getAttribute(IPapyrusMarker.MESSAGE, "");
+ return marker.getAttribute(IPapyrusMarker.MESSAGE, ""); //$NON-NLS-1$
}
public int getPriority(IPapyrusMarker marker) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
index dff5bbd8114..22358c24cc4 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
@@ -96,7 +96,7 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
super(domain, label, Collections.EMPTY_LIST);
this.domain = domain;
this.selectedElement = selectedElement;
- this.diagnostician= diagnostician;
+ this.diagnostician = diagnostician;
this.showUIfeedback = true; // default is true;
}
@@ -161,13 +161,12 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
}
if(diagnostic != null) {
int markersToCreate = diagnostic.getChildren().size();
- if((markersToCreate > 0) && PreferenceUtils.getAutoShowValidation()) {
+ if((markersToCreate > 0) && PreferenceUtils.getAutoShowValidation() && showUIfeedback) {
// activate model view, if activated in configuration
// IViewRegistry viewRegistry = PlatformUI.getWorkbench().getViewRegistry();
// IViewDescriptor desc = viewRegistry.find(modelValidationViewID);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(modelValidationViewID);
// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().showView(modelValidationViewID);
-
}
// don't fork this dialog, i.e. run it in the UI thread. This avoids that the diagrams are constantly refreshing *while*
// markers/decorations are changing. This greatly enhances update performance. See also bug 400593
@@ -226,12 +225,12 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
ValidationTool vt = new ValidationTool(validateElement, resource);
int markersToCreate = diagnostic.getChildren().size();
- sub.beginTask("Delete existing markers", 1);
+ sub.beginTask(Messages.AbstractValidateCommand_DeleteExistingMarkers, 1);
flushDisplayEvents(shell.getDisplay());
vt.deleteSubMarkers(sub.newChild(1));
- monitor.setTaskName("Create markers (total: " + markersToCreate + " markers) and refresh diagrams"); //$NON-NLS-1$
+ monitor.setTaskName(String.format(Messages.AbstractValidateCommand_CreateNMarkers, markersToCreate));
flushDisplayEvents(shell.getDisplay());
vt.createMarkers(diagnostic, sub.newChild(1));
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AsyncValidateSubtreeCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AsyncValidateSubtreeCommand.java
new file mode 100644
index 00000000000..edd2646136d
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AsyncValidateSubtreeCommand.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.services.validation.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Execute a subtree validation command asynchronously. This is useful to avoid that update
+ * commands, e.g. from xtext editors take too long.
+ */
+public class AsyncValidateSubtreeCommand extends ValidateSubtreeCommand {
+
+ public AsyncValidateSubtreeCommand(EObject selectedElement,
+ IPapyrusDiagnostician diagnostician) {
+ super(selectedElement, diagnostician);
+ }
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ asyncDoExecute(monitor, info);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus asyncDoExecute(final IProgressMonitor monitor, final IAdaptable info) {
+ try {
+ return super.doExecute(monitor, info);
+ }
+ catch (ExecutionException e) {}
+ return null;
+ }
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/Messages.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/Messages.java
new file mode 100644
index 00000000000..8f452dccb34
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/Messages.java
@@ -0,0 +1,21 @@
+package org.eclipse.papyrus.infra.services.validation.commands;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.services.validation.commands.messages"; //$NON-NLS-1$
+ public static String AbstractValidateCommand_CreateNMarkers;
+ public static String AbstractValidateCommand_DeleteExistingMarkers;
+ public static String ValidateDelMarkersFromModelCommand_DeleteMarkersFromModel;
+ public static String ValidateDelMarkersFromModelCommand_FailedToDeleteMarkers;
+ public static String ValidateDelMarkersFromSubtreeCommand_DelMarkersFromSubtree;
+ public static String ValidateModelCommand_ValidateModel;
+ public static String ValidateSubtreeCommand_ValidateSubtree;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateModelCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateModelCommand.java
index fcbb0fd8587..57b22fd6693 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateModelCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateModelCommand.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
import org.eclipse.ui.dialogs.PreferencesUtil;
@@ -39,7 +38,7 @@ public class SelectAndValidateModelCommand extends AbstractValidateCommand {
* @param selectedElement
*/
public SelectAndValidateModelCommand(EObject selectedElement, IPapyrusDiagnostician diagnostician) {
- super("Validate subtree", TransactionUtil.getEditingDomain(selectedElement), getTopOwner(selectedElement), diagnostician);
+ super(Messages.ValidateModelCommand_ValidateModel, TransactionUtil.getEditingDomain(selectedElement), getTopOwner(selectedElement), diagnostician);
}
/**
@@ -63,8 +62,8 @@ public class SelectAndValidateModelCommand extends AbstractValidateCommand {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- String idRootPage = "org.eclipse.emf.validation.ui.rootPage";
- String idConstraints = "org.eclipse.emf.validation.constraintsPrefs";
+ String idRootPage = "org.eclipse.emf.validation.ui.rootPage"; //$NON-NLS-1$
+ String idConstraints = "org.eclipse.emf.validation.constraintsPrefs"; //$NON-NLS-1$
String filter[] = {
idRootPage,
idConstraints
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateSubtreeCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateSubtreeCommand.java
index 4d6807cc897..1b7b6bbbc30 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateSubtreeCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/SelectAndValidateSubtreeCommand.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
import org.eclipse.ui.dialogs.PreferencesUtil;
@@ -30,7 +29,7 @@ import org.eclipse.ui.dialogs.PreferencesUtil;
public class SelectAndValidateSubtreeCommand extends AbstractValidateCommand {
public SelectAndValidateSubtreeCommand(EObject selectedElement, IPapyrusDiagnostician diagnostician) {
- super("Validate subtree", TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
+ super(Messages.ValidateSubtreeCommand_ValidateSubtree, TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
}
/**
@@ -39,8 +38,8 @@ public class SelectAndValidateSubtreeCommand extends AbstractValidateCommand {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- String idRootPage = "org.eclipse.emf.validation.ui.rootPage";
- String idConstraints = "org.eclipse.emf.validation.constraintsPrefs";
+ String idRootPage = "org.eclipse.emf.validation.ui.rootPage"; //$NON-NLS-1$
+ String idConstraints = "org.eclipse.emf.validation.constraintsPrefs"; //$NON-NLS-1$
String filter[] = {
idRootPage,
idConstraints
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromModelCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromModelCommand.java
index 7f5af0cad41..4e9395a2aa7 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromModelCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromModelCommand.java
@@ -24,14 +24,13 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.papyrus.infra.services.markerlistener.util.MarkerListenerUtils;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
public class ValidateDelMarkersFromModelCommand extends AbstractValidateCommand {
public ValidateDelMarkersFromModelCommand(EObject selectedElement,IPapyrusDiagnostician diagnostician) {
- super("Delete markers from model", TransactionUtil.getEditingDomain(selectedElement), selectedElement,diagnostician);
+ super(Messages.ValidateDelMarkersFromModelCommand_DeleteMarkersFromModel, TransactionUtil.getEditingDomain(selectedElement), selectedElement,diagnostician);
}
/**
@@ -45,7 +44,7 @@ public class ValidateDelMarkersFromModelCommand extends AbstractValidateCommand
MarkerListenerUtils.getMarkerProvider(getValidationResource())
.deleteMarkers(resource, monitor);
} catch (CoreException e) {
- throw new ExecutionException("Failed to delete all markers.", e);
+ throw new ExecutionException(Messages.ValidateDelMarkersFromModelCommand_FailedToDeleteMarkers, e);
}
}
return null;
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromSubtreeCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromSubtreeCommand.java
index 4e3f876444d..0e1bbf0789d 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromSubtreeCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateDelMarkersFromSubtreeCommand.java
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
import org.eclipse.papyrus.infra.services.validation.ValidationTool;
@@ -28,7 +27,7 @@ import org.eclipse.papyrus.infra.services.validation.ValidationTool;
public class ValidateDelMarkersFromSubtreeCommand extends AbstractValidateCommand {
public ValidateDelMarkersFromSubtreeCommand(EObject selectedElement,IPapyrusDiagnostician diagnostician) {
- super("Delete markers from subtree", TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
+ super(Messages.ValidateDelMarkersFromSubtreeCommand_DelMarkersFromSubtree, TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
}
/**
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateModelCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateModelCommand.java
index f6e93d2a90d..43d686a03dc 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateModelCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateModelCommand.java
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
@@ -37,7 +36,7 @@ public class ValidateModelCommand extends AbstractValidateCommand {
* @param selectedElement
*/
public ValidateModelCommand(EObject selectedElement,IPapyrusDiagnostician diagnostician) {
- super("Validate model", TransactionUtil.getEditingDomain(selectedElement), getTopOwner(selectedElement), diagnostician);
+ super(Messages.ValidateModelCommand_ValidateModel, TransactionUtil.getEditingDomain(selectedElement), getTopOwner(selectedElement), diagnostician);
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateSubtreeCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateSubtreeCommand.java
index 88e10ab6742..02386812e99 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateSubtreeCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/ValidateSubtreeCommand.java
@@ -20,14 +20,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
public class ValidateSubtreeCommand extends AbstractValidateCommand {
public ValidateSubtreeCommand(EObject selectedElement,IPapyrusDiagnostician diagnostician) {
- super("Validate subtree", TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
+ super(Messages.ValidateSubtreeCommand_ValidateSubtree, TransactionUtil.getEditingDomain(selectedElement), selectedElement, diagnostician);
}
/**
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/messages.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/messages.properties
new file mode 100644
index 00000000000..b7588e0cab7
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/messages.properties
@@ -0,0 +1,7 @@
+AbstractValidateCommand_CreateNMarkers=Create markers (total: %d markers) and refresh diagrams
+AbstractValidateCommand_DeleteExistingMarkers=Delete existing markers
+ValidateDelMarkersFromModelCommand_DeleteMarkersFromModel=Delete markers from model
+ValidateDelMarkersFromModelCommand_FailedToDeleteMarkers=Failed to delete all markers.
+ValidateDelMarkersFromSubtreeCommand_DelMarkersFromSubtree=Delete markers from subtree
+ValidateModelCommand_ValidateModel=Validate model
+ValidateSubtreeCommand_ValidateSubtree=Validate subtree

Back to the top