How to resolve EObjects coming from a DSL file residing in an eclipse plugin

I have a DSL (dsl1) with cross references to ecore model ecoe1. All works fine if the resources resides in the workspace. But when I run my DSL plugin in a second eclipse instance and try to import the dsl1 instance from the plugin into a second DSL dsl2 that resides in the workspace of the second eclipse instance I can not resolve the references to the ecore1 objects. The objects are present but all attributes are empty (null). I tried all six resolving methods from EcoreUtil but nothing works.
Has any body an idea what I can try else to solve this issue ?

Christian Dietrich wrote on Sun, 02 August 2015 01:54what do you mean by "import". if you model project in the second workspace is a plugin project and the libary plugin is on the classpath of that plugin project it should work fine
I use the "importURI" mechanism to import other ecore models into my dsl. All projects are plugin projects.
The library plugin of the dsl1 is implicit on the classpath it gets reexported from the model plugin of dsl2. I even tried to have it explicit on the classpath in the ui project of dsl2 but it does not work either.
I have written a small example of the problem see the atachment.
Here is the description of the example:
The example constists of three workspaces. Workspace1 contains the definition of dsl1 where the part of interest is:
// /org.xtext.example.mydsl.resolvebug.dsl1/src/org/xtext/example/mydsl/resolvebug/dsl1/DSL1.xtext
grammar org.xtext.example.mydsl.resolvebug.dsl1.DSL1 with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/2008/Xtext" as xt
generate dSL1 "http://www.xtext.org/example/mydsl/resolvebug/dsl1/DSL1"
RULE1:
"grammar" name=ID "ref" ref=[xt::Grammar]
I have defined a name provider that should produce the following name schema for RULE1 objects: <name>_<Grammar.name>. The relevant code is in /org.xtext.example.mydsl.resolvebug.dsl1/src-xtend/org/xtext/example/mydsl/resolvebug/dsl1/utils/GeneratedDSL1QualifiedNameProviderSwitch.xtend:
override caseRULE1(RULE1 object) {
val sb1 = new StringBuilder;
if (object.getName != null) {
sb1.append(object.getName)
sb1.append("_")
val sb2 = new StringBuilder;
if (object.getRef != null) {
var ref = object.getRef
if (ref instanceof EObject) {
ref = EcoreUtils.resolve(ref, object)
sb2.append(GeneratedXtextQualifiedNameProvider.doApply(ref).toString)
sb1.append(NamingUtils.lastSegment(sb2.toString))
sb1
What EcoreUtils.resolve does is explained below.
The GeneratedXtextQualifiedNameProvider.doApply(ref) effectively does the following:
override caseGrammar(Grammar object) {
val sb1 = new StringBuilder;
val sb2 = new StringBuilder;
if (object.getName != null) {
sb2.append(object.getName)
sb1.append(NamingUtils.lastSegment(sb2.toString))
sb1
The workspace2 contains the definition of dsl2 which references RULE1 objects:
grammar org.xtext.example.mydsl.resolvebug.dsl2.DSL2 with org.eclipse.xtext.common.Terminals
import "http://www.xtext.org/example/mydsl/resolvebug/dsl1/DSL1" as dsl1
generate dSL2 "http://www.xtext.org/example/mydsl/resolvebug/dsl2/DSL2"
Greeting:
'Hello' name=ID ref=[dsl1::RULE1];
I have defined a scope provider that uses the obove mentioned name provider to produce names for the referenced objects:
///org.xtext.example.mydsl.resolvebug.dsl2/src-xtend/org/xtext/example/mydsl/resolvebug/dsl2/scoping/GeneratedDSL2ScopeProvider.xtend
def IScope scope_Greeting_ref(EObject model, EReference reference) {
val itemList = GeneratedDSL2MakeRULE1ListSwitch.apply(model)
val scope0 = makeEObjectListScope(itemList, GeneratedDSL1QualifiedNameProvider::PROVIDER
scope0
GeneratedDSL2MakeRULE1ListSwitch.apply(model) retrieves the list of imported RULE1 objects. The import is effectively done by this code:
override caseDSL2(DSL2 object) {
val result = new ArrayList
for (item : object.getImportList) {
result.addAll(doSwitch(item))
result
override caseImport(Import object) {
val uriString = object.getImportURI()
val resourceSet = object.eResource().getResourceSet()
val resource = resourceSet.getResource(URI.createURI(uriString),true)
val itemList = resource.allContents.filter(typeof(RULE1))
val result = EcoreUtils.makeCollection(itemList)
result
The GeneratedDSL1QualifiedNameProvider::PROVIDER is a static instance of the name provider and the method makeEObjectListScope does the following:
val result = new LinkedList
for (eod : objectList) {
var EObject eobj = eod
val container = eod.eContainer
if(container != null) {
eobj = EcoreUtils.resolve(eobj, container)
} else if(eobj.eIsProxy) {
EcoreUtil.resolveAll(eobj)
val qname = nameProvider.getFullyQualifiedName(eobj)
val simpleName = qname.lastSegment
result.add(EObjectDescription.create(simpleName, eobj))
result.add(EObjectDescription.create(qname, eobj))
val resultScope = new SimpleScope(scope, result)
resultScope
where EcoreUtils.resolve() does the following:
if (object.eIsProxy()) {
EcoreUtil.resolveAll(object);
object = (T) EcoreUtil.resolve(object, context);
Resource resource = object.eResource();
if (resource == null) {
resource = context.eResource();
} else {
try {
resource.load(Collections.emptyMap());
} catch (IOException e) {
e.printStackTrace();
return (T) object;
EcoreUtil.resolveAll(resource);
if (resource != null) {
object = (T) EcoreUtil.resolve(object, resource);
ResourceSet objectContext = resource.getResourceSet();
if (objectContext != null){
try {
EcoreUtil.resolveAll(objectContext);
} catch (Throwable e) {
// e.printStackTrace(); // ignore if resolving fails because of link cycles.
return (T) EcoreUtil.resolve(object, objectContext);
return object;
As you can see I tried all methods of resolving proxy objects but all fail as you can see later.
The workspace3 contains an instance of dsl2 which references an instance of dsl1 which is contained in the dsl1 plugin itself.:
dsl2 my.DSL2
import "platform:/plugin/org.xtext.example.mydsl.resolvebug.dsl1/model/Dsl1.dsl1"
Hello hello xtext_ // should be "xtext_Xtext"
Here "hello" is the name of the Greeting object in dsl2 and "xtext_" is the name of the RULE1 object from the referenced dsl1. The name of the RULE1 object should be "xtext_Xtext" as I explained above but it is not because the referenced grammar "Xtext" does not get resolved properly although I have applied all available resolving methods to the grammar object in the name provider.
I hope you can tell me what I have done wrong.

Similar Messages

  • How to insert data coming from 2 different file adapters in to one DB adapt

    Hi
    i want insert data in to database containing two diffferent tables, so i imported tables in to DB adapter by creating relation ships.But, data for two tables are in xml format & two are in different locations.So, i used 2 file adapters to get data from 2 different & i used BPEL(Define service later) Service. now in bpel i used receive activity to receive one file adapter data ( i checked create instance in receive) then used transform activiy for tranformation & finally invoke activity to invoke DB adapteer........similarly i repeated sequetially to 2 file adapter, by keeping 2nd receive(no need to check create instance) next to invoke.*Problem is after deployment finished only data coming from 1st receive is inserting to the table...& 2 nd receive not working it showing as Pending & showing as Asynchronus Call back inte console*
    I configured all the adapters perfectly..........Can any one can help me how to Commit 2 nd receive to insert data in the 2nd table
    Regards,
    jay

    Thank u both for ur replay.........
    I am doing this in 11g there is no problem regarding transform activity.
    My requirement is
    two different files from two different folders in a drive & we can't use one file adapter bcoz both have different columns(only few are common columns) so we use two different xsd's .So, i am using two file adapters to insert in database having two different tables with respect to two different files data coming from two file adapters. i am using one DB adapter to insert bcoz both tables are in same database with relationships & i used BPEL(define service later) .
    NOW PLEASE SUGGEST ME THE FLOW IN BPEL TO INSERT BOTH FILES IN THERE RESPECTIVE TABLES IN DATABASE.
    The flow i did 1st file adater--->receive--->transform---->invoke----->DB adapter.....Then again repeating this as keeping 2nd receive below 1st invoke
    2nd file adapter-------->2nd receive---->2nd invoke------>same DB adapter
    MY problem is only data coming from 1st process is inserting & 2nd one is not working as i discussed earlier........I USED READ FILE OPTION, UNCHECKED DELETE FILES OPTION & SET DIFFERENT POLLING FREQUENCY FOR BOTH FILE ADAPTERS.
    I tried to set correlation but it is not working & later tried i kept non-blocking invoke as TRUE in DB adapter also didn't work...........also i tried this transaction property in bpel component _<property name="bpel.config.transaction"_
    many="false" type="xs:string">required / requiresNew</property>...............BUT NO CHANGE...........
    Regards,
    jay
    Edited by: 910162 on Apr 5, 2012 12:38 AM

  • Events or attributes triggered by data coming from a data file

    Without using scripts, is there any way to have rectangles or textboxes act on values coming from a data file? If not, does anyone know or have some scripting suggestions to do that. For examplle if the value in a textbox was greater than 10 coming from a data record, could the textbox change color, or any other attribute to make it change from record to recortd as it is being viewed or printed?
    Thanks

    That is how I solve your question.
    I use a formula in Excel:
    I import the result in ID, not Column A, but B (result of the calculation):
    And I modify the paragraph style like this:
    It is easy and fast to do. 

  • How can I copy layers from one .fla file to another .fla file?

    Hi,
    How can I copy layers from one .fla file to another .fla file? Please do help.
    Thanks.

    Select all the frames you want to copy, right click and select copy frames then select the file you want to paste them into and right click again and then paste frames.
    The layers the frames are should come across with them.

  • How can i import contacts from a csv file to "iCloud Contacts"?

    How can I import contacts from a csv file to "iCloud Contacts"?

    The only way I know of to import cells from a csv file is by creating a new file.  But then you can select the desired cells and copy them to the other file.  I just did it to be sure it works.
    1. Create the new spreadsheet file via the upload command.
    2. Select the cells (table) that you want to move to the other file and press command+C (copy).
    3. Close the new file and open the existing file.
    4. Select the top/right cell of the area to receive the copied "table" and press commant+V (paste).
    I hope this is what you're trying to do!

  • How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?

    How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?  I am fimilar with changing the setting for all network partitions(defaults write com.apple.desktopservices DSDontWriteNetworkStores true), but that is undesirable when I connect my laptop to my home network. A preferable solution would be where I could control the writing of these files based on disk format (NTFS vs HFS+).

    Go to MacUpdate or CNET Downloads and search for ds_store. There are numerous utilities for preventing them from being transferred to Windows systems.

  • Need how to get the data from the external file in eCatt

    Hi ,
      Could any body suggest how to get the values from the external file(Excel,CSV file,Text file) and pass it as varaiable in ecatt Test script.
    Problem: Need to execute FK01-Vendor creation Transaction with multiple set of data .As per my understanding we could achive through Variants in Testdata set in eCatt .
    But is there any way to store the data in excell file and get the data and pass it to FK01 Test scripts
    Appreciate response on this

    Hi
    See the links they may be useful
    check these link,
    eCATT- An Introduction
    /people/sumeet.kaul/blog/2005/07/26/ecatt-an-introduction
    Creating Test Scripts
    /people/sumeet.kaul/blog/2005/08/10/ecatt-creating-test-scripts
    eCATT Logs
    /people/sapna.modi/blog/2006/04/18/ecatt-logs-part-vi
    eCATT Scripts Creation – TCD Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation-150-tcd-mode-part-ii
    Creation of Test Data Container
    /people/sumeet.kaul/blog/2005/08/24/ecatt-creation-of-test-data-container
    eCATT Scripts Creation - SAPGUI Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation--sapgui-mode-part-iii
    Integrating ECATT & MERCURY QTP Part -1
    /people/community.user/blog/2007/01/02/integrating-ecatt-mercury-qtp-part-1
    Using eCatt to Test Web Dynpro ABAP
    /people/thomas.jung/blog/2006/03/21/using-ecatt-to-test-web-dynpro-abap
    and
    -command reference
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/3c333b40389c46e10000000a114084/content.htm
    /people/sapna.modi/blog/2006/04/10/ecatt--an-introduction-part-i
    http://prasadbabu.blogspot.com
    https://www.sdn.sap.com/sdn/developerareas/was.sdn?page=test_tool_integration_for_sap_e-catt.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1b/e81c3b84e65e7be10000000a11402f/frameset.htm
    http://www.erpgenie.com/ecatt/index.htm
    hope this helps.
    Reward points for useful Answers
    Regards
    Anji

  • How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    "adrianTNT" <[email protected]> wrote in message
    news:e6aitv$hkm$[email protected]..
    >
    quote:
    Originally posted by:
    kglad
    > you're welcome. with your solution loading another mp3,
    are you sure it stops
    > the download of the first mp3?
    > Yes, it seems to work fine, it loads another sound in
    same sound (my_sound)
    > and it seems to replace loaded progress with the empty
    sound I gave and stops
    > previous loading.
    > I look at traffic icons on task bar and I see that there
    is no network traffic
    > after I click "stop" before this I could see continuous
    traffic while sound was
    > loading in background.
    Yeah, I remember someone posted that solution a long time
    ago. It seems if you load a file with the same name the cache
    doesn't
    know any better and adjusts the download size to the smaller
    one. Maybe it's a good way to do it! Could it be a way to remove an
    mp3 from someone's cache after it plays? hmmmm Will have to
    do more testing.
    tralfaz

  • How can I print stuff from the 'Help' file using my MacBook Air?

    How can I print stuff from the 'Help' file using my MacBook Air?

    Open the Help viewer, select a category then from the menu bar top of your screen, click File > Print

  • How do I stop LR4 from organizing imported files into a folder by date.

    How do I stop LR4 from organizing imported files into a folder by date. Most times when I import files I have already created a folder and sub-folder structure tyat I want to use. I then right click the desired folder and choose import into this folder option. Why does LR4 insist on organizing my already selected destination into a sub-folder with a date by default?

    TimHillPhotography23 wrote:
    Most times when I import files I have already created a folder and sub-folder structure tyat I want to use.
    If you do it this way all the time consider a different approach:
    Manually copy your images from the card into your desired destination folder in the Finder/Explorer. Once complete drag&drop that entire folder into Lightroom. When the import dialog pops up select to Add the images to the catalog (not copy or move). You will end up with the exact folder structure reflected in your library.

  • HT201401 how to repair sound coming from receiver

    please tell me how to resolve this problem?

    That would depend on what the actual issue is.
    Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new).

  • How to store the data coming from visa into file

    Hi ,
    I want to store the data into text file,which is coming from visa-read.
    I tried visa read to file ,but it's not working.
     Am new to labview plz help me out.
    Thanks in advance. 

    CSFGF wrote:
    Hi ,
    I want to store the data into text file,which is coming from visa-read.
    I tried visa read to file ,but it's not working.
     Am new to labview plz help me out.
    Thanks in advance. 
     Share the code you have so far with us so that we can check what's going wrong.

  • How can I stop Firefox from opening (to "File Not Found") when opening my Opera browser?

    Ever since I installed Opera 10.61 on my new computer (Windows 7 Ultimate operating system), whenever I open Opera, Firefox opens one second later with the following error message:
    '''File not found '''
    Firefox can't find the file at /C:/Users/Nasheed/AppData/Local/Opera/Opera/temporary_downloads/client-en.xml.
    * Check the file name for capitalization or other typing errors.
    * Check to see if the file was moved, renamed or deleted.
    TRY AGAIN.
    <nowiki>****************************************************</nowiki><br />
    This happens EVERY TIME I OPEN THE OPERA BROWSER. How can I stop this from happening? I'm stumped.
    [EXTRA INFO - I was unable to enable Firefox to access my previous profile on the new computer (despite putting the old profile in the appropriate Mozilla Firefox folder. So, there are now two profiles in that location.
    After reading the answer to another forum member's question, I attempted to resolve the problem using Profile Manager, but I was unable to locate the Profile Manager. The Windows "Search" feature is not enabled on my new computer (nor can it be enabled from the Customize Start Menu options).]

    Thank you for your response, Cor-el.
    I had Opera set as my default browser since this began happening. I changed my default browser back to Firefox mainly because having Firefox open one or two seconds every time I open Opera was/is such a nuisance.
    I believe this problem began because I attempted to manually transfer the files from my old computer to the new one (via the backed up files in my external drive). I was unfamiliar with Windows 7 when I did this. Microsoft changed the file set up from what I had been used to in Windows XP. I used XP for six years before being exposed to Windows 7 (I never had Vista).
    I'm almost sure this problem has something to do with where I placed the application data when I was trying to reestablish the program set up on the new computer.

  • How do you read data from a text file into a JTextArea?

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    Student_Coder wrote:
    1) Read the file messages.txt into a String
    2) Initialize messages with the String as the textSwing text components are designed to use Unix-style linefeeds (\n) as line separators. If the text file happens to use a different style, like DOS's carriage-return+linefeed (\r\n), it needs to be converted. The read() method does that, and it saves the info about the line separator style in the Document so the write() method can re-convert it.
    lethalwire wrote:
    They have 2 different ways of importing documents in this link:
    http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
    Neither of those methods applies to JTextAreas.

  • How can I plott data from a text file in the same way as a media player using the pointer slide to go back and fort in my file?

    I would like to plott data from a text file in the same way as a media player does from a video file. I’m not sure how to create the pointer slide function. The vi could look something like the attached jpg.
    Please, can some one help me?
    Martin
    Attachments:
    Plotting from a text file like a media player example.jpg ‏61 KB

    HI Martin,
    i am not realy sure what you want!?!?
    i think you want to display only a part of the values you read from XYZ
    so what you can do:
    write all the values in an array.
    the size of the array is the max. value of the slide bar
    now you can select a part of the array (e.g. values from 100 to 200) and display this with a graph
    the other option is to use the history function of the graphes
    regards
    timo

Maybe you are looking for