Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-10 21:16:25 +0000
committerChristian W. Damus2014-03-10 21:16:25 +0000
commit82393c406cede01d7cb6acd6632d775a0c48ef1f (patch)
treec8020ddebeccfa5dfe29cf9145d881d161af1d0a /plugins/uml
parent999616da64f24cf97b90b34cbb1d9de9a7f83efe (diff)
downloadorg.eclipse.papyrus-82393c406cede01d7cb6acd6632d775a0c48ef1f.tar.gz
org.eclipse.papyrus-82393c406cede01d7cb6acd6632d775a0c48ef1f.tar.xz
org.eclipse.papyrus-82393c406cede01d7cb6acd6632d775a0c48ef1f.zip
429826: [Read-Only] Orthogonal Classification of Read-Only Concerns
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429826 Update clients of the ReadOnlyManager to ensure that all read-only axes are considered where appropriate (such as in the EnableWriteCommandHandler). Add a listener protocol to notify interested parties when the read-only state of a resource changes on some axis. Update the Model Explorer view to trigger refresh on read-only state changes.
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java10
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/ControlledElementReadOnlyHandler.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java11
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/providers/ResourceLabelProvider.java14
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/readonly/AppliedProfileReadOnlyHandler.java2
5 files changed, 21 insertions, 18 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
index 5fe91cae260..8c4aac11912 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429826
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.handlers;
@@ -37,7 +38,8 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
@@ -94,7 +96,7 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
@Override
protected boolean computeEnabled() {
TransactionalEditingDomain editingDomain = getEditingDomain();
- IReadOnlyHandler readOnly = ReadOnlyManager.getReadOnlyHandler(editingDomain);
+ IReadOnlyHandler2 readOnly = ReadOnlyManager.getReadOnlyHandler(editingDomain);
for(IGraphicalEditPart editPart : getSelectedElements()) {
EObject semantic = EMFHelper.getEObject(editPart);
@@ -117,7 +119,7 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
uris.add(EcoreUtil.getURI(graphical));
}
- Optional<Boolean> result = readOnly.anyReadOnly(uris.toArray(new URI[uris.size()]));
+ Optional<Boolean> result = readOnly.anyReadOnly(ReadOnlyAxis.anyAxis(), uris.toArray(new URI[uris.size()]));
if(result.isPresent() && result.get()) {
return false;
}
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 bc0739e861f..cbd577fa771 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
@@ -21,8 +21,8 @@ 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.AbstractReadOnlyHandler;
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;
import org.eclipse.uml2.uml.Element;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java
index a172fb66fa7..b19b4395a4c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.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,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429826
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.modelrepair.ui;
@@ -47,8 +49,9 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
import org.eclipse.papyrus.infra.emf.resource.DependencyManagementHelper;
@@ -306,9 +309,9 @@ public class SwitchProfileDialog extends SelectionDialog {
}
});
- IReadOnlyHandler handler = ReadOnlyManager.getReadOnlyHandler(editingDomain);
+ IReadOnlyHandler2 handler = ReadOnlyManager.getReadOnlyHandler(editingDomain);
for(Resource resource : modelSet.getResources()) {
- if(handler.anyReadOnly(new URI[]{ resource.getURI() }).get()) {
+ if(handler.anyReadOnly(ReadOnlyAxis.anyAxis(), new URI[]{ resource.getURI() }).get()) {
continue;
}
try {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/providers/ResourceLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/providers/ResourceLabelProvider.java
index 8d507133d95..45c7f978125 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/providers/ResourceLabelProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/providers/ResourceLabelProvider.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,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429826
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.modelrepair.ui.providers;
@@ -18,6 +20,7 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
import org.eclipse.swt.graphics.Image;
@@ -75,13 +78,8 @@ public class ResourceLabelProvider extends ColumnLabelProvider {
}
EditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(resourceSet);
- Optional<Boolean> readOnly = ReadOnlyManager.getReadOnlyHandler(domain).anyReadOnly(new URI[]{ uri });
- if(readOnly.isPresent()) {
- return readOnly.get() ? "true" : "false";
- } else {
- return "false";
- }
-
+ Optional<Boolean> readOnly = ReadOnlyManager.getReadOnlyHandler(domain).anyReadOnly(ReadOnlyAxis.anyAxis(), new URI[]{ uri });
+ return readOnly.or(false) ? "true" : "false";
}
public String getResourceText(Object element) {
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 f8a78d1e2b2..1c7da5f5ca6 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
@@ -18,9 +18,9 @@ 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.AbstractReadOnlyHandler;
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;

Back to the top