Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-07 18:18:29 +0000
committerChristian W. Damus2014-03-07 18:18:29 +0000
commit88c526225da8a5742d19207f870ce037a39ff734 (patch)
treee0e90699184e5fedc0eea484df7c5a87cb502866 /plugins/infra
parent27d724bf0cf0c50e6666b4711030ea563cde171c (diff)
downloadorg.eclipse.papyrus-88c526225da8a5742d19207f870ce037a39ff734.tar.gz
org.eclipse.papyrus-88c526225da8a5742d19207f870ce037a39ff734.tar.xz
org.eclipse.papyrus-88c526225da8a5742d19207f870ce037a39ff734.zip
323802: [General] Papyrus shall provide a read only mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323802 Don't prompt multiple times to make a resource read-only if the user already answered in the negative and we are therefore rolling back.
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
index de7b67ec2eb..0d178b8c6be 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
@@ -92,8 +93,11 @@ public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDom
InternalTransaction tx = getActiveTransaction();
// If there's no transaction, then there will be nothing to roll back. And if it's unprotected, let the client do whatever.
- // And, of course, don't interfere with rollback!
- if((tx != null) && !tx.isRollingBack() && !Boolean.TRUE.equals(tx.getOptions().get(Transaction.OPTION_UNPROTECTED))) {
+ // And, of course, don't interfere with rollback! Finally, if we're already going to roll back, don't bother
+ if((tx != null) && !tx.isRollingBack() //
+ && !Boolean.TRUE.equals(tx.getOptions().get(Transaction.OPTION_UNPROTECTED)) //
+ && !willRollBack(tx)) {
+
boolean readOnly;
// Check for Resource first because CDO resources *are* EObjects
@@ -119,6 +123,11 @@ public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDom
}
}
}
+
+ private boolean willRollBack(Transaction tx) {
+ IStatus status = tx.getStatus();
+ return (status != null) && (status.getSeverity() >= IStatus.ERROR);
+ }
protected boolean makeWritable(Resource resource) {
URI[] uris = getCompositeModelURIs(resource.getURI());

Back to the top