Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-05 19:57:14 +0000
committerChristian W. Damus2014-03-05 20:08:24 +0000
commitef02345456af69efa0fdf684567443ea0f99b5d7 (patch)
tree36beccdf01918a06a677670ee507b6b599f0b6b5 /extraplugins/cdo
parent83604245b493b403edae0aac4d614c98fc8415db (diff)
downloadorg.eclipse.papyrus-ef02345456af69efa0fdf684567443ea0f99b5d7.tar.gz
org.eclipse.papyrus-ef02345456af69efa0fdf684567443ea0f99b5d7.tar.xz
org.eclipse.papyrus-ef02345456af69efa0fdf684567443ea0f99b5d7.zip
429242: [CDO] [Resource Management] Refactoring of the 3-files model and PageManager
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429242 Open *.uml/*.notation resources in Papyrus editor in Model Repositories view. Implement CDO-specific sash model storage.
Diffstat (limited to 'extraplugins/cdo')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF1
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/plugin.xml10
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java57
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java7
4 files changed, 73 insertions, 2 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
index ad2a18cef65..bc93e32545e 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Export-Package: org.eclipse.papyrus.cdo.core,
org.eclipse.papyrus.cdo.internal.core.repositories;x-friends:="org.eclipse.papyrus.cdo.core.tests,org.eclipse.papyrus.cdo.ui",
org.eclipse.papyrus.cdo.internal.core.repositories.impl;x-friends:="org.eclipse.papyrus.cdo.core.tests,org.eclipse.papyrus.cdo.ui",
org.eclipse.papyrus.cdo.internal.core.repositories.util;x-friends:="org.eclipse.papyrus.cdo.core.tests,org.eclipse.papyrus.cdo.ui",
+ org.eclipse.papyrus.cdo.internal.core.resource;x-internal:=true,
org.eclipse.papyrus.cdo.internal.core.services.localizer;x-internal:=true
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/plugin.xml b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/plugin.xml
index b5daa137254..c3a91523985 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/plugin.xml
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2013 CEA LIST.
+ Copyright (c) 2013, 2014 CEA LIST and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
@@ -11,6 +11,7 @@
Contributors:
CEA LIST - Initial API and implementation
+ Christian W. Damus (CEA) - bug 429242
-->
@@ -96,5 +97,12 @@
startKind="lazy">
</serviceFactory>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.sashModelProvider">
+ <sashModelProvider
+ class="org.eclipse.papyrus.cdo.internal.core.resource.CDOSashModelProvider"
+ scheme="cdo">
+ </sashModelProvider>
+ </extension>
</plugin>
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java
new file mode 100644
index 00000000000..6b3c35486f0
--- /dev/null
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.cdo.internal.core.resource;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.cdo.util.CDOURIUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.cdo.internal.core.Activator;
+import org.eclipse.papyrus.cdo.internal.core.CDOUtils;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.AbstractSashModelProvider;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
+
+
+/**
+ * A CDO-specific sash model storage provider.
+ */
+public class CDOSashModelProvider extends AbstractSashModelProvider {
+
+ private static final IPath SASH_MODEL_STORAGE_ROOT = Activator.getDefault().getStateLocation().append("sashidx"); //$NON-NLS-1$
+
+ private IPath indexFolder;
+
+ public CDOSashModelProvider() {
+ super();
+ }
+
+ @Override
+ public void initialize(ModelSet modelSet) {
+ super.initialize(modelSet);
+
+ CDOView view = CDOUtils.getView(modelSet);
+ if(view != null) { // Model probably is in the workspace if null
+ indexFolder = SASH_MODEL_STORAGE_ROOT.append(view.getSession().getRepositoryInfo().getUUID());
+ }
+ }
+
+ @Override
+ public URI getSashModelURI(URI userModelURI) {
+ final URI uriWithoutExtension = userModelURI.trimFileExtension();
+
+ IPath stateLocation = indexFolder.append(CDOURIUtil.extractResourcePath(uriWithoutExtension));
+
+ return URI.createFileURI(stateLocation.toString()).appendFileExtension(SashModel.SASH_MODEL_FILE_EXTENSION);
+ }
+
+}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
index d589d619f1e..3160ee7a508 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,12 +8,15 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.views;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.cdo.admin.CDOAdminClientManager;
+import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceLeaf;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -253,6 +256,8 @@ public class ModelRepositoriesView extends ContainerView {
manager.add(openModelAction);
manager.add(renameModelAction);
manager.add(deleteModelAction);
+ } else if(selected instanceof CDOResource) {
+ manager.add(openModelAction);
}
if(selected instanceof IPapyrusRepository) {

Back to the top