Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-07 03:51:57 +0000
committerChristian W. Damus2014-03-07 21:45:37 +0000
commitb97cafff961eaf540abf031e047b42674b7b68b0 (patch)
treec64e3461846de625a3e0363d11b9ca33584762a2 /plugins/uml/org.eclipse.papyrus.uml.controlmode.profile
parent44365ad33949a1212cca04b234d6ecf1317cce67 (diff)
downloadorg.eclipse.papyrus-b97cafff961eaf540abf031e047b42674b7b68b0.tar.gz
org.eclipse.papyrus-b97cafff961eaf540abf031e047b42674b7b68b0.tar.xz
org.eclipse.papyrus-b97cafff961eaf540abf031e047b42674b7b68b0.zip
429826: [Read-Only] Orthogonal Classification of Read-Only Concerns
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429826 Add classification of orthogonal axes of concern to the API for read-only queries.
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.uml.controlmode.profile')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java
index 78020d006ce..bc0739e861f 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 Atos.
+ * Copyright (c) 2013, 2014 Atos, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,15 +9,19 @@
*
* Contributors:
* Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429826
*
*****************************************************************************/
package org.eclipse.papyrus.uml.controlmode.profile;
+import java.util.Set;
+
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.emf.readonly.AbstractReadOnlyHandler;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
@@ -30,7 +34,7 @@ import com.google.common.base.Optional;
/**
* Read only handler that will prevent model fragment to be modified it the root element is not a package
* This restriction is because of the UML2 implementation which delete stereotype applications if the current model can not find the corresponding profile
- * application
+ * application. This handler is discretion-based.
*
* @author adaussy
*
@@ -41,8 +45,8 @@ public class ControlledElementReadOnlyHandler extends AbstractReadOnlyHandler {
super(editingDomain);
}
- public Optional<Boolean> anyReadOnly(URI[] uris) {
- if(getEditingDomain() == null) {
+ public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) {
+ if((getEditingDomain() == null) || !axes.contains(ReadOnlyAxis.DISCRETION)) {
return Optional.absent();
}
ResourceSet resourceSet = getEditingDomain().getResourceSet();
@@ -65,7 +69,7 @@ public class ControlledElementReadOnlyHandler extends AbstractReadOnlyHandler {
return Optional.absent();
}
- public Optional<Boolean> makeWritable(URI[] uris) {
+ public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
//Never authorize write
NotificationBuilder.createErrorPopup("This model fragment can not be modified independently from the rest of the model").run();
return Optional.absent();

Back to the top