Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java10
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java25
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java13
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java12
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java9
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java15
14 files changed, 134 insertions, 41 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java
index 2956c311344..7afe625c3ff 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.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,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
@@ -94,7 +96,7 @@ public class CustomStyleModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
return findProperty(propertyPath) != null;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
index 40bf9058df3..65c431481cb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.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
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.modelelement;
@@ -418,15 +419,12 @@ public class NatTableModelElement extends EMFModelElement {
}
/**
- *
- * @see org.eclipse.papyrus.views.properties.modelelement.EMFModelElement#isEditable(java.lang.String)
- *
* @param propertyPath
* @return
*/
@Override
- public boolean isEditable(String propertyPath) {
- boolean res = super.isEditable(propertyPath);
+ protected boolean isFeatureEditable(String propertyPath) {
+ boolean res = super.isFeatureEditable(propertyPath);
if(!res) {
//feature column label property
if(Constants.COLUMN_FEATURE_LABEL_CONFIGURATION_DISPLAY_ICON.equals(propertyPath)) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java
index c89b79685ab..da818a1a6a6 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.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,6 +8,8 @@
*
* Contributors:
* Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -68,11 +70,11 @@ public class CommentModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) {
return true;
}
- return super.isEditable(propertyPath);
+ return super.isFeatureEditable(propertyPath);
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
index 7bd9833d571..326e894de72 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.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
* 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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -23,6 +25,7 @@ import java.util.List;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.uml.properties.Activator;
@@ -119,9 +122,9 @@ public class MemberEndModelElement extends AbstractModelElement {
return false;
}
}
- return ((Property)source).getAssociation().getMemberEnds().size() <= 2;
+ return (((Property)source).getAssociation().getMemberEnds().size() <= 2) && !EMFHelper.isReadOnly(source);
}
- return true;
+ return !EMFHelper.isReadOnly(source);
}
private boolean isAssociation(Property property) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java
index f3f1ae272b0..d8f5bcda7d5 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -76,4 +78,9 @@ public class ProfileDefinitionModelElement extends AbstractModelElement {
public boolean getDirectCreation(String propertyPath) {
return true; //Cannot browse other definitions
}
+
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(profile);
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
index 5da9abffbb4..ab3adf72ee3 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -27,6 +29,7 @@ import static org.eclipse.papyrus.uml.properties.util.StereotypeAppearanceConsta
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
@@ -107,4 +110,8 @@ public class StereotypeAppearanceModelElement extends AbstractModelElement imple
return true;
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(umlSource);
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
index 7a4d132cc0a..cef0f90eb28 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -129,7 +131,7 @@ public class UMLModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
if(feature == UMLPackage.eINSTANCE.getMessage_Signature()) {
return true;
@@ -145,7 +147,7 @@ public class UMLModelElement extends EMFModelElement {
return false;
//return true; //TODO : Unsupported yet
}
- return super.isEditable(propertyPath);
+ return super.isFeatureEditable(propertyPath);
}
@Override
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
index d115969535e..c6c680cd2d8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -176,4 +178,8 @@ public class UMLNotationModelElement extends AbstractModelElement {
return super.isMandatory(propertyPath);
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(getEModelElement());
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
index 1023b5a408c..5e661874a2a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008, 2013 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST, Atos Origin, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,6 +12,7 @@
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
* Emilien Perico (Atos Origin) - fix bug on refresh
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
@@ -38,6 +39,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
@@ -299,6 +301,8 @@ public class AppliedProfileCompositeOnModel extends Composite {
profiles = createProfilesList();
profiles.setVisible(true);
+
+ updateEnablement();
}
/**
@@ -499,6 +503,23 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
}
+
+ updateEnablement();
+ }
+
+ protected boolean isEditable() {
+ Package currentPackage = getSelectedPackage();
+ return (currentPackage != null) && !EMFHelper.isReadOnly(currentPackage);
+ }
+
+ protected void updateEnablement() {
+ boolean isEditable = isEditable();
+
+ if((addButton != null) && !addButton.isDisposed()) {
+ addButton.setEnabled(isEditable);
+ removeButton.setEnabled(isEditable);
+ addRegisteredButton.setEnabled(isEditable);
+ }
}
/**
@@ -523,6 +544,8 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
public void setSelection(ISelection selection) {
this.selectedElement = selection;
+
+ updateEnablement();
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
index 812b00961d4..b10aed4ac3c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
@@ -287,6 +288,8 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
@Override
public void refresh() {
+ super.refresh();
+
if(treeViewer.getTree() != null && !(treeViewer.getTree().isDisposed())) {
treeViewer.setInput(null);
treeViewer.refresh();
@@ -298,10 +301,12 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
return;
}
+ boolean isEditable = isEditable();
+
// If the property is Multivalued show Up - Down
if((rTO.getChildren() != null) && (rTO.getChildren().length > 1)) {
- upButton.setEnabled(true);
- downButton.setEnabled(true);
+ upButton.setEnabled(isEditable);
+ downButton.setEnabled(isEditable);
} else {
upButton.setEnabled(false);
downButton.setEnabled(false);
@@ -310,7 +315,7 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
if((rTO.getChildren() != null) && (rTO.getChildren().length == 0)) {
removeButton.setEnabled(false);
} else {
- removeButton.setEnabled(true);
+ removeButton.setEnabled(isEditable);
}
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
index 608c1f9f3fd..ce77785961e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,12 +10,14 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementTreeViewer;
import org.eclipse.papyrus.uml.profile.tree.PropertyValueTreeViewer;
@@ -144,6 +146,8 @@ public abstract class DecoratedTreeComposite extends Composite implements ISecti
*/
public void setElement(Element element) {
this.element = element;
+
+ updateEnablement();
}
/**
@@ -265,18 +269,30 @@ public abstract class DecoratedTreeComposite extends Composite implements ISecti
data.bottom = new FormAttachment(100, -ITabbedPropertyConstants.VSPACE);
tree.setLayoutData(data);
+
+ // initialize enablement of controls
+ updateEnablement();
+
return this;
}
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.composites.ISectionComposite#refresh()
- */
- /**
- *
- */
public void refresh() {
+ updateEnablement();
+ }
+
+ protected boolean isEditable() {
+ return (element != null) && !EMFHelper.isReadOnly(element);
+ }
+
+ protected void updateEnablement() {
+ boolean isEditable = isEditable();
+
+ if((addButton != null) && !addButton.isDisposed()) {
+ addButton.setEnabled(isEditable);
+ removeButton.setEnabled(isEditable);
+ upButton.setEnabled(isEditable);
+ downButton.setEnabled(isEditable);
+ }
}
// /**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
index 0d92fa6ed33..16e03b2e26a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 Atos.
+ * Copyright (c) 2012, 2014 Atos, CEA, 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:
* Mathieu Velten (Atos) mathieu.velten@atos.net - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.widgets;
@@ -212,7 +214,7 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
protected void setValueEditorProperties(AbstractValueEditor editor, EObject stereotypeApplication, EStructuralFeature feature) {
editor.setLabel(feature.getName());
- if(feature.isDerived() || !feature.isChangeable()) {
+ if(!isEditable(stereotypeApplication, feature)) {
editor.setReadOnly(true);
}
@@ -232,7 +234,7 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
editor.setDirectCreation(((EReference)feature).isContainment());
}
- if(feature.isDerived() || !feature.isChangeable()) {
+ if(!isEditable(stereotypeApplication, feature)) {
editor.setReadOnly(true);
}
@@ -243,6 +245,10 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
observable.addListChangeListener(this);
}
+
+ protected boolean isEditable(EObject object, EStructuralFeature feature) {
+ return !feature.isDerived() && feature.isChangeable() && !EMFHelper.isReadOnly(object);
+ }
public void setLayoutData(GridData data) {
pageBook.setLayoutData(data);
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
index 9aa30330743..beca09c8205 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 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 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.modelelement;
@@ -15,6 +17,7 @@ import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.databinding.AnnotationObservableValue;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
/**
* A ModelElement for handling EAnnotations
@@ -63,4 +66,8 @@ public class AnnotationModelElement extends AbstractModelElement {
return new AnnotationObservableValue(source, domain, annotationName, propertyPath);
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(source);
+ }
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
index ed4cfe5f47c..bbe0b763493 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
@@ -9,6 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 402525
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.views.properties.modelelement;
@@ -242,14 +243,22 @@ public class EMFModelElement extends AbstractModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ public final boolean isEditable(String propertyPath) {
+ return isFeatureEditable(propertyPath) && isElementEditable();
+ }
+
+ protected boolean isFeatureEditable(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
if(feature == null) {
return false;
}
- return feature.isChangeable() && !EMFHelper.isReadOnly(source);
+ return feature.isChangeable();
}
-
+
+ protected boolean isElementEditable() {
+ return !EMFHelper.isReadOnly(source);
+ }
+
@Override
public boolean forceRefresh(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);

Back to the top