Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-02-13 21:28:59 +0000
committerChristian W. Damus2014-02-20 19:38:53 +0000
commit4d9b5f1786a1a311b4df7379c419d56a5d58bd74 (patch)
treea721388b28551912f2e3d3f1e7271877b6f9d7b1 /extraplugins
parentb1841729809bb3a0d045f72ae1ef17056522d3e3 (diff)
downloadorg.eclipse.papyrus-4d9b5f1786a1a311b4df7379c419d56a5d58bd74.tar.gz
org.eclipse.papyrus-4d9b5f1786a1a311b4df7379c419d56a5d58bd74.tar.xz
org.eclipse.papyrus-4d9b5f1786a1a311b4df7379c419d56a5d58bd74.zip
323802: [General] Papyrus shall provide a read only mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323802 Implement a custom TransactionChangeRecorder that aborting the transaction if a read-only object is modified. Add a new extension point oep.infra.gmfdiag.commands.historyListeners for registration of listeners to be added to the Papyrus operation history. Implement a listener that detects operations that failed because of rollback and presents a status dialog explaining the rollback. Add a new label provider for EMF Resources to support presentation of the rollback dialog when an affected object is a resource.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java
index 723ae2fc3dd..f9608413a5e 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.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,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
@@ -19,6 +20,7 @@ import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.NotificationFilter;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.Transaction;
@@ -40,7 +42,19 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd
@Override
protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset) {
- return new DawnTransactionChangeRecorder(this, rset);
+ return new DawnTransactionChangeRecorder(this, rset) {
+
+ @Override
+ protected void appendNotification(Notification notification) {
+ // Append to the transaction first
+ super.appendNotification(notification);
+
+ if(!NotificationFilter.READ.matches(notification)) {
+ // Check whether we are modifying a read-only object
+ assertNotReadOnly(notification.getNotifier());
+ }
+ }
+ };
}
protected void fireResourceSetChanged(CDOViewInvalidationEvent event) {
@@ -53,6 +67,7 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd
CDOUtils.notify(this, new Runnable() {
+ @Override
public void run() {
for(ResourceSetListener element : listeners) {
try {

Back to the top