aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2018-06-11 09:50:07 -0400
committervincent lorenzo2018-06-13 05:32:44 -0400
commit004543b17ed36046bc094f671e63c486d2fc0589 (patch)
tree558a6d4df82a93c5de0ba2ea47a2e3175c23de5d
parent54612e929f7374dd5464534634d28c1ef73afdf1 (diff)
downloadorg.eclipse.papyrus-004543b17ed36046bc094f671e63c486d2fc0589.zip
org.eclipse.papyrus-004543b17ed36046bc094f671e63c486d2fc0589.tar.gz
org.eclipse.papyrus-004543b17ed36046bc094f671e63c486d2fc0589.tar.xz
bug 535070: [Table] Table can't reopen4.0.0_RC4a
Change-Id: I0bdc0ec798600ffc65fd78271a946dc658f35a20 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rwxr-xr-xplugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResource.java14
-rw-r--r--plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResourceWithUUID.java29
2 files changed, 29 insertions, 14 deletions
diff --git a/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResource.java b/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResource.java
index 7f7d1d9..660f317 100755
--- a/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResource.java
+++ b/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResource.java
@@ -8,7 +8,6 @@
*
* Contributors:
* Vincent LORENZO (CEA LIST) - Initial API and implementation
- * Vincent LORENZO (CEA LIST) - Bug 535070
*****************************************************************************/
package org.eclipse.papyrus.emf.resources;
@@ -95,16 +94,5 @@ public abstract class AbstractEMFResource extends XMIResourceImpl {
}
return this.defaultLoadOptions;
}
-
- /**
- * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#assignIDsWhileLoading()
- *
- * @return
- */
- @Override
- protected boolean assignIDsWhileLoading() {
- //bug 535070
- return false; // overridden to avoid to assign XMI_ID to element of previous configuration which are stilling use position to be saved
-
- }
+
}
diff --git a/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResourceWithUUID.java b/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResourceWithUUID.java
index e589fa0..53436ca 100644
--- a/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResourceWithUUID.java
+++ b/plugins/emf/org.eclipse.papyrus.emf/src/org/eclipse/papyrus/emf/resources/AbstractEMFResourceWithUUID.java
@@ -8,12 +8,16 @@
*
* Contributors:
* Vincent LORENZO (CEA LIST) - Initial API and implementation
- *
+ * Vincent LORENZO (CEA LIST) - Bug 535070
*****************************************************************************/
package org.eclipse.papyrus.emf.resources;
+import java.util.Collections;
+import java.util.Map;
+
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.URIConverter;
/**
* @author Vincent LORENZO
@@ -49,4 +53,27 @@ public abstract class AbstractEMFResourceWithUUID extends AbstractEMFResource {
return true;
}
+ /**
+ * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#assignIDsWhileLoading()
+ *
+ * @return
+ */
+ @Override
+ protected boolean assignIDsWhileLoading() {
+ // bug 535070
+ // if the resource is read-only, we don't assign XMI_ID (to avoid that writeable resource saves assigned XMI_ID of the current read-only resource which won't be saved.
+ // doing that, we avoid trouble when we reopen the models
+ return !isReadOnly();// overridden to avoid to assign XMI_ID to element of previous configuration which are stilling use position to be saved
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> is the resource is read-only
+ */
+ private boolean isReadOnly() {
+ final Map<?, ?> options = Collections.singletonMap(URIConverter.OPTION_REQUESTED_ATTRIBUTES, Collections.singleton(URIConverter.ATTRIBUTE_READ_ONLY));
+ final Map<String, ?> attributes = (getResourceSet()).getURIConverter().getAttributes(getURI(), options);
+ return Boolean.TRUE.equals(attributes.get(URIConverter.ATTRIBUTE_READ_ONLY));
+ }
}