Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » 3 DSLs, references inbetween and eProxies
3 DSLs, references inbetween and eProxies [message #1402774] Thu, 17 July 2014 13:28 Go to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
Hi,

I've got two problems which i just can't solve by myself. I'd gladly appreciate some help.

Here's what i got so far:

3 Xtext dsls. Mabl, Mosa, Mobe.
Mabl references a class from Mosa, while Mosa references Mobe.

Here are my Xtext files

Mabl.xtext:
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://.../xtext/mosa/Mosa" as mosa
import "http://.../xtext/mobe/Mobe" as mobe

Mabl:
	head=STRING
	mosas+=MosaReference*
;

MosaReference:
	mosaReference=[mosa::Mosa] (COLON mobeReference=[mobe::Mobe])? range=STRING?
;


Mosa.xtext:
import "http://.../xtext/mobe/Mobe" as mobe

Mosa:
	name=STRING
	mobeReferences+=[mobe::Mobe]*
;


Mobe.xtext:
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Mobe:
	'name' name=STRING
	images+=Images*
	'text1' text1=STRING?
	'text2' text2=STRING?
	metainfos=Metainfos?
;

Images:
	'img' path=STRING
;

Metainfos:
	'author' author=STRING
	'date' date=STRING
	'version' version=STRING
;



Now to the main problems:
1. As you can see in the "MosaReference" in the Mabl.xtext I first load the mosaReference with a reference of [mosa::Mosa] and then I'm allowed to load mobeReference with [mobe::Mobe]. Currently all references for [mobe::Mobe] are accepted. Though now I only want to allow references from [mobe::Mobe] which are references inside the previously set [mosa::Mosa]. Basically I only want to display the entires of the list "mobeReferences" from Mosa.xtext corresponding to the [mosa::Mosa] in front.
How do i achive this?
EDIT: I just found the solution for question 1 here: https://www.eclipse.org/forums/index.php/t/794151/
After searching for so long i just find it by randomly scrolling the frontpage...


2. When I'm parsing those files with the standalone parser I got problems with eProxies. I then searched and found a half working solution. I had to add all resources prior to resolving. Unfortunately as I'm parsing the .mabl file, this only works for the references from Mabl to Mosa, not however for the references from Mosa to Mobe. Any ideas on this one?

Thanks for your help,
Florian

[Updated on: Fri, 18 July 2014 06:10]

Report message to a moderator

Re: 3 DSLs, references inbetween and eProxies [message #1402847 is a reply to message #1402774] Thu, 17 July 2014 20:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi, (1) can be done with Scoping e.g.
https://www.eclipse.org/forums/index.php/t/794151/

for (2) in standalone mode you have to call
- the standalonesetups of all dsls
- add all files to the recourceset and then start resolving


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: 3 DSLs, references inbetween and eProxies [message #1402876 is a reply to message #1402847] Fri, 18 July 2014 06:13 Go to previous messageGo to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
Thanks Christian, works perfect.

[Updated on: Fri, 18 July 2014 06:17]

Report message to a moderator

Re: 3 DSLs, references inbetween and eProxies [message #1402941 is a reply to message #1402847] Fri, 18 July 2014 14:27 Go to previous messageGo to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
Hi again,

Quote:

(1) can be done with Scoping e.g.
https://www.eclipse.org/forums/index.php/t/794151/

this worked fine at first but as I was trying to open an editor by calling it programmatically I got the same problem again.

This is what i used:
def IScope scope_MosaReference_mobeReference (MosaReference ctx, EReference r) {
	Scopes.scopeFor(ctx.mosaReference.mobeReferences)
}


I open the dsl editor by calling this:
IFile fileToBeOpened = root.getFile(path);
IEditorInput editorInput = new FileEditorInput(fileToBeOpened);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
	page.openEditor(editorInput, "xtext.mabl.Mabl");
} catch (PartInitException e) {
	e.printStackTrace();
}


With the code inside the "scope_MosaReference_mobeReference" method it won't reference at all. When removing the code it displays all references again. Somehow my scopeFor call is now wrong although it worked fine before or am I calling the editor wrong? What am I missing?

Regards,
Florian
Re: 3 DSLs, references inbetween and eProxies [message #1402945 is a reply to message #1402941] Fri, 18 July 2014 14:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

what is the intend of your code? what do you tro to do? page.openEditor(editorInput, "xtext.mabl.Mabl");


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: 3 DSLs, references inbetween and eProxies [message #1402946 is a reply to message #1402945] Fri, 18 July 2014 15:00 Go to previous messageGo to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
Hi,

I'm opening the gernerated editor which is able to work with the .mabl dsl. At least that's what I think I'm doing.

[Updated on: Fri, 18 July 2014 15:07]

Report message to a moderator

Re: 3 DSLs, references inbetween and eProxies [message #1402947 is a reply to message #1402946] Fri, 18 July 2014 15:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you share complere reproducable code + example project?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: 3 DSLs, references inbetween and eProxies [message #1403068 is a reply to message #1402947] Mon, 21 July 2014 07:58 Go to previous messageGo to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
I kind of got closer to determining the problem.

Opening the editor works just fine the way above. Referencing works as intended. However only as long as I don't setup my parser for the dsl.
I'm running in an OSGi environment and setup the parser this way:
injector = new MablStandaloneSetup().createInjectorAndDoEMFRegistration();
new MobeStandaloneSetup().createInjectorAndDoEMFRegistration();
new MosaStandaloneSetup().createInjectorAndDoEMFRegistration();
injector.injectMembers(this);


If I don't run this code referencing in the editor works, but as soon as I parse the referencing in the editor fails.

How do I setup the parser correctly as it's not actually standalone here?
Re: 3 DSLs, references inbetween and eProxies [message #1403070 is a reply to message #1403068] Mon, 21 July 2014 08:07 Go to previous message
Florian Dunz is currently offline Florian DunzFriend
Messages: 20
Registered: March 2014
Junior Member
If I change the code from:
injector = new MablStandaloneSetup().createInjectorAndDoEMFRegistration();
new MobeStandaloneSetup().createInjectorAndDoEMFRegistration();
new MosaStandaloneSetup().createInjectorAndDoEMFRegistration();
injector.injectMembers(this);

to:
injector = new MablStandaloneSetup().createInjectorAndDoEMFRegistration();
injector.injectMembers(this);

the referencing works, however then I get eProxies again.

[Updated on: Mon, 21 July 2014 08:43]

Report message to a moderator

Previous Topic:Injector problems in deployed plugin
Next Topic:Generation with maven fornax plugin and use of own fragments
Goto Forum:
  


Current Time: Thu Mar 28 18:17:16 GMT 2024

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

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

Back to the top