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
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')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java14
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java17
2 files changed, 21 insertions, 10 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();
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java
index 6c13310f271..f8a78d1e2b2 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 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,28 +8,35 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429826
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.profile.readonly;
+import java.util.Set;
+
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.emf.readonly.AbstractReadOnlyHandler;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.uml2.uml.Profile;
import com.google.common.base.Optional;
-
+/**
+ * Discretion-based read-only handler for applied profiles.
+ */
public class AppliedProfileReadOnlyHandler extends AbstractReadOnlyHandler {
public AppliedProfileReadOnlyHandler(EditingDomain editingDomain) {
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)) {
Resource mainUmlResource = null;
if(getEditingDomain().getResourceSet() instanceof ModelSet) {
UmlModel umlModel = (UmlModel)((ModelSet)getEditingDomain().getResourceSet()).getModel(UmlModel.MODEL_ID);
@@ -62,7 +69,7 @@ public class AppliedProfileReadOnlyHandler extends AbstractReadOnlyHandler {
return false;
}
- public Optional<Boolean> makeWritable(URI[] uris) {
+ public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
return Optional.absent(); //Applied profiles should remain read-only
}

Back to the top