summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibault Le Ouay2014-05-15 12:04:29 (EDT)
committerRemi Schnekenburger2014-05-22 05:27:18 (EDT)
commit683d23471f2690d3c2383360364c0a5ec2c91a8f (patch)
tree1d49e15ea52eace2f9d97e206a3fe22efcf87a15
parent08a6fd63074d659f082df91c8fb98f95a6c921b7 (diff)
downloadorg.eclipse.papyrus-683d23471f2690d3c2383360364c0a5ec2c91a8f.zip
org.eclipse.papyrus-683d23471f2690d3c2383360364c0a5ec2c91a8f.tar.gz
org.eclipse.papyrus-683d23471f2690d3c2383360364c0a5ec2c91a8f.tar.bz2
434839: [Wizards] Errors when creating a Papyrus Profile Model based onrefs/changes/90/26690/3
an existing.profile.uml https://bugs.eclipse.org/bugs/show_bug.cgi?id=434839 Change-Id: I0e0567614b21f834cdd25d5b02758985ba1d57b1 Signed-off-by: Thibault Le Ouay <t.leouay@sherpa-eng.com>
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java8
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelProviderManager.java13
3 files changed, 20 insertions, 7 deletions
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 e0c17b9..dcc4051 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
@@ -976,8 +976,12 @@ public class ModelSet extends ResourceSetImpl {
return new Internal() {
@Override
- public void setPrimaryModelResourceURI(URI uri) {
- setURIWithoutExtension(uri.trimFileExtension());
+ public void setPrimaryModelResourceURI(URI uri) { //Bug 434839 : we create a new papyrus sashmodel from an existing model.profile.uml and we are avoiding to trim .profile
+ if(uri.lastSegment().endsWith("profile")) {
+ setURIWithoutExtension(uri);
+ } else {
+ setURIWithoutExtension(uri.trimFileExtension());
+ }
}
@Override
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 a940f92..4b7f81d 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
@@ -147,7 +147,11 @@ public class SashModel extends EMFLogicalModel implements IModel {
if(isLegacy(uriWithoutExtension)) {
super.createModel(getSashModelStoreURI(uriWithoutExtension).trimFileExtension());
} else {
- super.createModel(uriWithoutExtension);
+ if(!uriWithoutExtension.lastSegment().endsWith(SASH_MODEL_FILE_EXTENSION)) {//Bug 434839 : we create a new papyrus sashmodel from an existing model.profile.uml and were avoiding to trim .profile
+ super.createModel(getSashModelStoreURI(uriWithoutExtension).trimFileExtension());
+ } else {
+ super.createModel(uriWithoutExtension);
+ }
}
}
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
index d904a48..36384c5 100644
--- 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
@@ -1,6 +1,6 @@
/*
* 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
@@ -64,9 +64,9 @@ class SashModelProviderManager {
/**
* 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) {
@@ -118,7 +118,12 @@ class SashModelProviderManager {
@Override
public URI getSashModelURI(URI userModelURI) {
- final URI uriWithoutExtension = userModelURI.trimFileExtension();
+ final URI uriWithoutExtension;
+ if(!userModelURI.lastSegment().endsWith(SashModel.SASH_MODEL_FILE_EXTENSION)) { //Bug 434839 : we create a new papyrus sashmodel from an existing model.profile.uml
+ uriWithoutExtension = userModelURI;
+ } else {
+ uriWithoutExtension = userModelURI.trimFileExtension();
+ }
IPath stateLocation = Activator.getDefault().getStateLocation();