diff options
author | jeremie.tatibouet | 2015-05-04 13:24:49 +0000 |
---|---|---|
committer | Arnaud Cuccuru | 2015-05-05 16:47:26 +0000 |
commit | 67d24a73dcbbe539c906905c1f7788b1265ff11c (patch) | |
tree | 8ac3747985e5c0251ae8bb8f918fdf0f2636964b /extraplugins/alf/ui | |
parent | b8e467cba2b0fb654c7d8c10e43de9c5f526c6b1 (diff) | |
download | org.eclipse.papyrus-67d24a73dcbbe539c906905c1f7788b1265ff11c.tar.gz org.eclipse.papyrus-67d24a73dcbbe539c906905c1f7788b1265ff11c.tar.xz org.eclipse.papyrus-67d24a73dcbbe539c906905c1f7788b1265ff11c.zip |
Enables the ALF editor when an operation is selected. Still some merge
problem at this step (e.g. the implementation of an operation not
referenced in the "method" list after a compilation).
Change-Id: I6cd85e10180d9b113fd5a77d23ac572c9426000c
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
Reviewed-on: https://git.eclipse.org/r/47155
Tested-by: Hudson CI
Reviewed-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
Tested-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
Diffstat (limited to 'extraplugins/alf/ui')
2 files changed, 24 insertions, 3 deletions
diff --git a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditionPropertySection.java b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditionPropertySection.java index 57020118566..49f85098fb5 100644 --- a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditionPropertySection.java +++ b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditionPropertySection.java @@ -50,6 +50,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Operation;
import org.eclipse.xtext.resource.XtextResource;
import com.google.inject.Injector;
@@ -100,7 +101,7 @@ public class AlfEditionPropertySection extends /* 2. Compute edit string */
String serialization = "/*Error: serialization could not be computed*/";
if (this.eObject != null) {
- serialization = this.alfSerialization.getEditString((Element) this.eObject);
+ serialization = this.alfSerialization.getEditString(this.getEditableObject(this.eObject));
}
/* 3. Set up editor content (textControl) */
this.textControl.setText(serialization);
@@ -109,6 +110,23 @@ public class AlfEditionPropertySection extends }
}
+ /**
+ * Provide the object that will be edited through the editor. The particular case is for an edited
+ * that is an operation. In this situation we return the implementation (i.e. an activity) of this operation.
+ * This way it is transparent for the user that when editing an operation it can modify both the signature and
+ * its implementation.
+ *
+ * @param edited
+ * the object that is currently edited
+ *
+ * @return the real object that will be edited
+ */
+ private Element getEditableObject(EObject edited){
+ if(edited instanceof Operation){
+ return ((Operation)edited).getMethods().get(0);
+ }
+ return (Element)edited;
+ }
/**
* Provide the namespace of the element that is given as parameter
@@ -120,7 +138,8 @@ public class AlfEditionPropertySection extends */
private Namespace getNamespace(Element element){
if(element!=null && element instanceof NamedElement){
- return ((NamedElement)element).getNamespace();
+ Element edited = this.getEditableObject(element);
+ return ((NamedElement)edited).getNamespace();
}
return null;
}
@@ -275,7 +294,7 @@ public class AlfEditionPropertySection extends }
public EObject getContextObject() {
- return getEObject();
+ return this.getEditableObject(this.eObject);
}
@Override
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 c704aa1e25b..4da0952f1a4 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 @@ -73,6 +73,8 @@ public class AlfEditorPropertySectionFilter implements IFilter { return true;
}else if(FUMLScopeUtil.isActivity(element)){
return true;
+ }else if(FUMLScopeUtil.isOperationWithImplementation(element)){
+ return true;
}
return false;
}
|