Cannot reference elements in other files using xtext editor in papyrus [message #1037432] |
Tue, 09 April 2013 14:55 |
Dennis Stampfer Messages: 23 Registered: April 2013 |
Junior Member |
|
|
Hi,
I am working on a proof of concept that integrates several dsls with several modes of editing with/in UML.
I have a very basic DSL where I want to reference elements declared in external files:
Test:
'ComplexTest' name=ID
;
TestRef:
'Testref' name=ID 'references' ref=[Test]
;
declarations.mydsl:
ComplexTest basicParamTest
In a second file I reference basicParamTest from the first file.
use.mydsl: (same project/folder as declarations.mydsl)
Testref myref references basicParamTest
This simple example works fine out of the box. Since we are integrating this DSL with papyrus UML modeling, I created a PopupEditor for papyrus that uses the Editor of mydsl:
public class MyEditorConfiguration extends org.eclipse.xtext.gmf.glue.PopupEditorConfiguration implements IPopupEditorConfiguration {
// standard stuff skipped
@Override
public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
System.out.println("createPopupEditorHelper!!!!!");
IGraphicalEditPart graphicalEditPart = null;
if(!(editPart instanceof IGraphicalEditPart)) {
return null;
}
graphicalEditPart = (IGraphicalEditPart)editPart;
if(!(graphicalEditPart.getTopGraphicEditPart().resolveSemanticElement() instanceof Comment)) {
return null;
}
content = (Content)graphicalEditPart.getTopGraphicEditPart().resolveSemanticElement();
Injector injector = org.example.ParameterActivator.getInstance().getInjector("org.example.Parameter");
String textToEdit = "" + this.getTextToEdit(content);
String fileExtension = "" + ".mydsl";
IXtextEMFReconciler reconciler = new IXtextEMFReconciler() {
@Override
public void reconcile(EObject modelObject, EObject xtextObject) {
// ... apply changes from popup editor ...
}
};
return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new DefaultXtextSemanticValidator());
}
}
It all works fine so far: I can use the popup editor of a uml model (say, 'use.uml') to write stuff in my DSL, embed it in the uml model, and are able to generate code from it. However, as we are following the library idea, we have to reference objects declared in the above mentioned declarations.mydsl from the popup editor when editing use.uml: "Testref myref references basicParamTest". However, the editor cannot resolve the reference to basicParamTest ("Could not resolve reference to basicParamTest"). Using the generated editor of mydsl (opening/editing use.mydsl) it works fine.
I suspect that from within the papyrus editor, the contents of declarations.mydsl are not loaded. I do not have any Idea where to begin in order to track down the problem or direction of solution. Is it about global scoping or resourceServiceProviders or import statements? I read about this but have no Idea how to use that from the papyrus editor.
What am I missing? Any help appreciated.
cheers,
Dennis
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03556 seconds