Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
index 4da0952f1a4..6a0432bc2c1 100644
--- a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
+++ b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
@@ -14,8 +14,10 @@ package org.eclipse.papyrus.uml.alf.properties.xtext.sheet;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.alf.transaction.observation.listener.filter.FUMLScopeUtil;
import org.eclipse.uml2.uml.Element;
@@ -59,6 +61,11 @@ public class AlfEditorPropertySectionFilter implements IFilter {
* @return true if element is accepted as an input false otherwise
*/
private boolean isValidInput(Element element){
+ /*1. First constraint: the element must be modifiable (i.e. not read only)*/
+ if(!this.isModifiable(element)){
+ return false;
+ }
+ /*2. It should be in the scope supported by the ALF editor*/
if(FUMLScopeUtil.isClass(element)){
return true;
}else if(FUMLScopeUtil.isPackage(element)){
@@ -79,6 +86,14 @@ public class AlfEditorPropertySectionFilter implements IFilter {
return false;
}
+ private boolean isModifiable(Element element){
+ Resource resource = element.eResource();
+ if(resource != null ){
+ return !EMFHelper.isReadOnly(element);
+ }
+ return false;
+ }
+
/**
* From a selection this methods tries to extract the underlying model element
*

Back to the top