Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Integration of GMF and Xtext -> Problem with ResourceDescription
Integration of GMF and Xtext -> Problem with ResourceDescription [message #1058633] Tue, 14 May 2013 15:09 Go to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi,

I'm trying to integrate GMF and Xtext at the moment. First I want to outline what I want to have, before I explain my problem.

In the GMF Editor you are able to create nodes, which should be reused by the Xtext grammar. In order to specify some constraints for the model, you can click on a specific node label which opens a xtext based cell editor.

To achieve this, the Xtext grammar reuse the existing ecore from the EMF/GMF project. Furthermore I created a custom Resource Description with an acording manager and service provider. The Resource Description filters the necessary objects, as you can see below:

protected List<IEObjectDescription> computeExportedObjects() {
   List<IEObjectDescription> exportedObjects = new ArrayList<IEObjectDescription>();
   Map<String, String> userData = new HashMap<String, String>();
   for (TreeIterator<EObject> iterator = resource.getAllContents(); iterator.hasNext();) {
      EObject eObject = iterator.next();
      if (eObject instanceof Feature) {
	String qualifiedName = ((Feature) eObject).getName();
          if (qualifiedName != null) {
		 exportedObjects.add(new EObjectDescription(qualifiedNameConverter.toQualifiedName(qualifiedName), eObject,userData));
         }
....


In the GMF Editor, I implemented the IXtextAwareEditPart interface in the corresponding edit part, which uses an XtextDirectEditManager and I also created a new DirectEditPolicy.

When I run the editor now, and reference the Objects in the xtext cell editor it seems to work. But when I add new model elements to my diagram, xtext dont get the reference to them. I need to save the whole diagram first in order that the computeExportedObjects() method is called again and the content assitant offers me the newly added elements.

Is there a way to get the exportedObjects updated every time when there a changes happen in the diagram (for example adding or deleting elements) ?? Because I've not much knowledge about xtext, it's hard for me to find a hook.

Cheers,
Phil
Re: Integration of GMF and Xtext -> Problem with ResourceDescription [message #1059973 is a reply to message #1058633] Wed, 22 May 2013 12:07 Go to previous message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
any suggestions on this?
Previous Topic:Calculate in XTend Template without output
Next Topic:Accessing an external Java class from JvmModelInferrer
Goto Forum:
  


Current Time: Thu Apr 18 15:14:37 GMT 2024

Powered by FUDForum. Page generated in 0.02239 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top