Skip to main content



      Home
Home » Modeling » TMF (Xtext) » modifications to imported models(updated imported language files programmatically)
modifications to imported models [message #1798340] Thu, 15 November 2018 11:50 Go to next message
Eclipse UserFriend
I apologize if this is a repost but I've already written this post once and it was moderated. I've since had a post unmoderated in the newcomers forum and thought it would be wise to attempt again.

I'm having a problem updating a language file programmatically. Specifically, I'm having a problem updating a language file that is imported from the file I begin executing my code in. I'm working within the OSATE framework, which is an Xtext-based implementation of the architecture description language AADL.

To make this concrete, I want to process a model "test.aadl" that imports another model "B.aadl". I've included a screenshot of both files open in the editor below:

index.php/fa/34340/0/

My code, shown below, does the following, at a high level.


  1. I have a contextual AADL element that defines the place I want to make modifications. Usually this is an AADL classifier. You can see it referenced on line 126.
  2. I manually open the file that contains the classifier. (lines 126 - 145)
  3. I call getDocument().modify() on the newly opened editor.
  4. The method doInsert() in this case just creates an abstract type named abs1 and inserts it into the private section of the AADL package containing the provided contextual classifier. (lines 149-162)


index.php/fa/34341/0/

When running this code on "test.aadl" and the context element is contained within the test aadl package, the insert works just fine. In this case it opens (it's already open) "test.aadl" and inserts an abstract type "abs1" into the private section of the test package.

When running this code on "test.aadl" and the context element is contained within the B aadl package, the editor is opened (B.aadl pops open in the editor), the model is updated in memory (confirmed through the debugger) but the concrete syntax isn't updated. Running this code repeatedly shows that the model contains N number of duplicates of "abs1", where N is the total number of times this is repeated. This suggets that the model updates are persistent in memory but the concrete syntax just isn't being updated.

I receive no exception traces when executing this code, for what that's worth. Any help or insight into why the imported file's concrete syntax is not being updated would be much appreciated.
Re: modifications to imported models [message #1798344 is a reply to message #1798340] Thu, 15 November 2018 12:20 Go to previous message
Eclipse UserFriend
Problem solved. The issue was that my modify method was not using the provided resource. I had to add some code to find the contextual element within the modification resource.
Previous Topic:Multiple grammars and example web editor
Next Topic:Grammar and Color high light of Nested Variable Names
Goto Forum:
  


Current Time: Mon Jun 16 06:47:37 EDT 2025

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

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

Back to the top