Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Specific cross-reference
Specific cross-reference [message #1385871] Wed, 11 June 2014 16:29 Go to next message
Eclipse UserFriend
Hi,

I am creating an DSL language.

I would like to do domething like this :


welcome 2 :
   consequences 2.1 : doSomething
                2.2 : doOtherThing



I would like to have a reference between the number 2 from welcome and the number 2 from consequences.

Your help will be welcome.

best regards,
Felix
Re: Specific cross-reference [message #1385873 is a reply to message #1385871] Wed, 11 June 2014 16:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i dont know what this question is about? do you have problems to write a grammar for that?

the only thing you need to know is:


xxx=[YYY] is short for xxx=[YYY|ID] which means "parse an ID to refer to a YYY

=> you would have to change that to xxx=[YYY|INT] + maybe change the IQualifiedNameProvider as well since the default one will pick only string attributes named name
Re: Specific cross-reference [message #1385884 is a reply to message #1385873] Wed, 11 June 2014 23:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

What I want to do is this :
AlternativeDeclaration:
	"welcome" id=INT ":"
               "consequences" id1=INT "." id2=INT  ":" "doSomething"
                              id3=INT "." id4=INT  ":" "doOtherThing"
;   


I would like to know if can make id1 to be the same number as id. For example, if id=2 then id1 should 2 (id1=id).
Re: Specific cross-reference [message #1385885 is a reply to message #1385884] Thu, 12 June 2014 00:39 Go to previous messageGo to next message
Eclipse UserFriend
hi,

so you have to write a check in the validator that simply ensures that the use uses the same number at both places.

to have cross ref func (cmd click) you have to make it an actual cross ref or adapt HyperlinkHelper
Re: Specific cross-reference [message #1385889 is a reply to message #1385885] Thu, 12 June 2014 02:08 Go to previous messageGo to next message
Eclipse UserFriend
I don't understand why you need to retype the "2" in the consequences.
From the grammar you gave us,
it's already clear that these consequences belongs to the welcome with id = 2.

So it's better to get it in the generator using this hierarchy.
Re: Specific cross-reference [message #1386023 is a reply to message #1385889] Fri, 13 June 2014 00:00 Go to previous messageGo to next message
Eclipse UserFriend
Thank you very much for your advise.

I will need your help for something else. Actually, I don't know how to start.
I have create this grammar:
/***   Alternatives ****/
Alternative 1:
    for {e1, e2, e3} select :
    R1 or R2 or R3;

Alternative 2:
    for {e6, e7, e8} select :
    R6 or R7 or R8;



/***   Decision appears when the user make a choice from [b][i]alternative i[/i][/b], [b][i]alternative i[/i][/b] will be automatically delete from the file ****/
Decision 1 select R7 for {e6, e7, e8} :
    consequences : decision 1.0 select R2 for {e1, e2, e3} and exclude R7 for {e6,e7,e8}



/***   Tell if the rule has to be excluded or Apply when the decision is validate. Automatically, Decision will be delete from the file ****/
Exclude rule R10 for {e9};
Apply rule R12 for {e10,e11};


What I want to do is this :
1 - I have a file which contains only some Alternatives.
2 - An user has a possibility to make a choise from an Alternative
3 - Decision appears when the user make a choice from Alternative i, Alternative i will be automatically delete from the file
4 - Tell if the rule has to be exclude or Apply when the Decision is validate. Automatically, the Decision will be delete from the file

The problem is that, I don't know howI can do that.

Thank you in advance for your help.

[Updated on: Fri, 13 June 2014 06:42] by Moderator

Re: Specific cross-reference [message #1386027 is a reply to message #1386023] Fri, 13 June 2014 02:04 Go to previous messageGo to next message
Eclipse UserFriend
i dont think it is a good idea todo that.
Re: Specific cross-reference [message #1386073 is a reply to message #1386027] Fri, 13 June 2014 06:45 Go to previous messageGo to next message
Eclipse UserFriend
What do you suggest?
Re: Specific cross-reference [message #1386075 is a reply to message #1386073] Fri, 13 June 2014 06:52 Go to previous messageGo to next message
Eclipse UserFriend
dont use xtext for that. is not made for such a

automatically delete stuff when user uses it somewhere else (that is how i understand your problem)

but maybe i got your problem wrong. maybe you could post several sample models and what shall happen when a user does what action
Re: Specific cross-reference [message #1386077 is a reply to message #1386075] Fri, 13 June 2014 07:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

1 - when we use java code, if we add a specific element, it will automatically notice us to import the library. How can we make that using Xtext
2 - If I understand what you are saying, it is not possible to dynamically editing a file in Xtest.
Re: Specific cross-reference [message #1386081 is a reply to message #1386077] Fri, 13 June 2014 07:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

1 - autoimport is of course possible. it can be done with xbase based languages. you can do something similar (you have todo it yourself)
2 - it is possible, the point is what triggers the auto edit - you want todo this by typing right? - since xtext recreates the ast all the time, since during typing the model may be broken and not parsed at all
Re: Specific cross-reference [message #1386165 is a reply to message #1386081] Fri, 13 June 2014 17:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,
you understand what I want to do.

Your advice is useful.

Maybe it will be easier to have a java code to edit my file and then, the model wont be broken.
Re: Specific cross-reference [message #1386166 is a reply to message #1386165] Fri, 13 June 2014 17:32 Go to previous message
Eclipse UserFriend
Hi I forget something,

I do not want to edit the file by typing, I will just need to select a few elements (maximum 2) from a specific list.
I want XText to add automatically the text corresponding of the selection I made because.

Axample:
If I select alternative 1 , remove the line in the file corresponding of that and add a line for the decision.
Previous Topic:where can I store analysis data for reuse
Next Topic:Parse Xtext Editor Contents inside CustomEditor
Goto Forum:
  


Current Time: Wed Jul 23 10:48:00 EDT 2025

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

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

Back to the top