From 08f1067b5d8478a799c683ed4b65fe21b61c46d8 Mon Sep 17 00:00:00 2001 From: jeremie.tatibouet Date: Thu, 21 May 2015 17:49:55 +0200 Subject: https://bugs.eclipse.org/bugs/show_bug.cgi?id=467895 The ALF editor does not appear when a selected element is read-only. Change-Id: I6a83904297a59a2bf4fc5c07b0319957e2327bd3 Signed-off-by: jeremie.tatibouet Reviewed-on: https://git.eclipse.org/r/48637 Tested-by: Hudson CI Reviewed-by: Arnaud Cuccuru Tested-by: Arnaud Cuccuru --- .../xtext/sheet/AlfEditorPropertySectionFilter.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'extraplugins/alf') 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 * -- cgit v1.2.3