Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » new xtext
new xtext [message #848597] Wed, 18 April 2012 11:52 Go to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
HI.

XTEX ragas are again and I'm stuck.
I basically wrote my grammar and I would like to introduce within this external objects ... someone can help me I read the tutorial but I still need a little help .... Shocked
Re: new xtext [message #848620 is a reply to message #848597] Wed, 18 April 2012 12:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

a German phrase says: Ich verstehe nur Bahnhof
so what is your problem?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #848715 is a reply to message #848620] Wed, 18 April 2012 14:05 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
What do you mean by that phrase in German?
Anyway the problem is one for which I had already written ..... and that is how I can bring into the grammar of my external ogetti ..... or better Coime can inject!! I want to make sure that the car appears to me a complete list of java objects created by me .... (class.java) .... ok .... I was not clear??
Thank you.
Re: new xtext [message #848739 is a reply to message #848715] Wed, 18 April 2012 14:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

you opened a new post and did not answer a question.
you dont even ask one in you last post.
so post your grammar and what you want to achieve.
e.g. by posting a sample model

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 18 April 2012 14:29]

Report message to a moderator

Re: new xtext [message #848780 is a reply to message #848739] Wed, 18 April 2012 15:11 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
ok


I wrote the grammar on a 'select' sql! I wish I was with the auto-complete list of proposed names attribbuti a db. Clearly the list of the names and I should give input into this thing ... I'm sure you can do but as I do not know .... I read all the documentation but I did not understand how much .... . you place the example


Select: 'select' nameAttributes=NAME;

NAME must be one of the names on the list that I will step input
I hope I was clear!
Re: new xtext [message #848794 is a reply to message #848780] Wed, 18 April 2012 15:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

still the question?
are you talking about content assist? your grammar suggest so
are you talking about validation? the MUST indicates this
are you talking about cross refs? this would do content assist and validation, but
you need something (emf based) you can refer to. do you have something?

normally you would have a dsl that supports the definition
and the usage of the things (attibutename or whatever it is in your case)

so lets asume you want some content assist only

so let us simply fill the ProposalProvider hook for this?


public class MyDslProposalProvider extends AbstractMyDslProposalProvider {

	@Override
	public void completeSelect_NameAttributes(EObject model,
			Assignment assignment, ContentAssistContext context,
			ICompletionProposalAcceptor acceptor) {
		acceptor.accept(createCompletionProposal("non", context));
		acceptor.accept(createCompletionProposal("capirci", context));
		acceptor.accept(createCompletionProposal("un", context));
		acceptor.accept(createCompletionProposal("tubo", context));
		super.completeSelect_NameAttributes(model, assignment, context, acceptor);
	}
	
}


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #849206 is a reply to message #848780] Thu, 19 April 2012 00:50 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-18-04 17:11, Gianluca Viscomi wrote:
> ok
>
>
> I wrote the grammar on a 'select' sql! I wish I was with the
> auto-complete list of proposed names attribbuti a db. Clearly the list
> of the names and I should give input into this thing ... I'm sure you
> can do but as I do not know .... I read all the documentation but I did
> not understand how much .... . you place the example
>
> Select: 'select' nameAttributes=NAME;
>
> NAME must be one of the names on the list that I will step input
> I hope I was clear!

Maybe you want a reference / link instead of a value? I.e. if NAME is
define elsewhere and you want the Select.nameAttribues to be a (non
containment) reference to that name? In order to reference, something
must make that name available.

Regards
- henrik
Re: new xtext [message #849544 is a reply to message #848794] Thu, 19 April 2012 08:40 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Thank you Christian right from the guide I had a tube capiuto .... now thanks to you beginning to understand something ... I'm sorry but I must translate the English language because even if I know I'm not a veteran and often lose logical thread of a conversation .... I hope you understand me! Thanks again
Re: new xtext [message #849562 is a reply to message #849206] Thu, 19 April 2012 08:58 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Henrik is just like the NAME should be a value, such as a string, contained in a list that is outside the grammar.In The my case should be a list of names of attributes.The My goal is to interface with a db and then map table names, names attributes and more. These names will be available with my grammar when I go to use the auto! I hope I was clear! Thanks so much
Re: new xtext [message #849666 is a reply to message #849562] Thu, 19 April 2012 10:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
hi,

still the question: why no create table in the dsls? do you want to query the db live?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #849778 is a reply to message #849666] Thu, 19 April 2012 12:52 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Kindly explain how you do this?
For now, I did what you told me earlier and that is rewriting the methods in the class MyDslProposalProvider and everything is ok!
Now I ask you.
If instead of the name would have a get method that returns the name of an external object can do that?
example:
acceptor.accept (createCompletionProposal (Object.getName (), context));

Thanks for your patience
Re: new xtext [message #849838 is a reply to message #849778] Thu, 19 April 2012 13:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
do whatever you want in the complete method

but i ask you to have a look at following grammar, give it a try use it and you will understand what we mean when talking about cross refs

Model:
elements+=Element*
usages+=Usage*;

Element: "element" name=ID;
Usage: "use" ref=[Element];

just create a sample model with some elements
and some usages
and have a look how the contentsasst and the editor behave for the usages.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 19 April 2012 14:01]

Report message to a moderator

Re: new xtext [message #850923 is a reply to message #849838] Fri, 20 April 2012 13:22 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Ok I've done this kind of evidence, and I realized what a cross-reference.
Now I ask you, if it is possible that the name for Element I is returned by a get method elementValue from any interface? I need to inject in my grammar names for Element interface through which users enter!

User Name >> insert Element -> Goofy
User Name >> insert Element -> Gino

Do you understand?
thanks
Re: new xtext [message #850931 is a reply to message #850923] Fri, 20 April 2012 13:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
hi I won't do that at model time but in your generator/interpreter
logic


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #850936 is a reply to message #850923] Fri, 20 April 2012 13:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
PS maybe I did not understand your problem so could you explain what
you mean with interface


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #850937 is a reply to message #850931] Fri, 20 April 2012 13:35 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Christian I do not mean that when I write the grammar?
Sorry if I did not get the point, be patient! Embarrassed
Re: new xtext [message #850941 is a reply to message #850937] Fri, 20 April 2012 13:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Could you please describe step by step what should happen when what
action is done


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #850942 is a reply to message #850936] Fri, 20 April 2012 13:42 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
ok ok sorry!! An interface might be a java class that has a method getName() and does nothing but return a name!
Re: new xtext [message #850955 is a reply to message #850941] Fri, 20 April 2012 13:55 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Ok I'll explain everything! I wrote the grammar for a sql editor although I'm not sure that's entirely accurate since 15 days and I are experimented.
This editor would later take input attributes names and tables names in the db. I'm trying to create a link
so it is possible that once you have entered these names are visible in my grammar so that they can use the car completed and all the resources I offer xtext! Now the point is ... in your example above cross-reference as I can assign a name obtained by a getName () element?
Re: new xtext [message #850965 is a reply to message #850955] Fri, 20 April 2012 14:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi yes but this is IMHO not the time worth to do that with a cross ref

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon14.gif  Re: new xtext [message #850987 is a reply to message #850965] Fri, 20 April 2012 14:29 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Thanks!!
Re: new xtext [message #851033 is a reply to message #850965] Fri, 20 April 2012 15:28 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Sorry again christian .... ok fine cross-reference!
Now I ask you.
Doing so:
Attribute:
name = [jvmType :: JvmType];

Assists with the content I get a list of Java types
... right?
And if you want to see a list of my guys ... I have to redefine what??
example
Attribute:
name = [MyTypes MyType =]
;
In a way that I return all attributes the db?
Re: new xtext [message #851054 is a reply to message #851033] Fri, 20 April 2012 15:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Please post a sample model otherwise it is hard what you want to do

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #851062 is a reply to message #851054] Fri, 20 April 2012 16:02 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Model:
attribbuti+=Attributo*
selects+=Select
;

Attributo: "attribbuto" name=ID;

Select: "select" ref=[Mytypes::Mytype];

so that:

select list< name
last name
age
work
>

course list <> does not appear
Re: new xtext [message #851070 is a reply to message #851062] Fri, 20 April 2012 16:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
ref=[Attributo]

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #857140 is a reply to message #851070] Thu, 26 April 2012 09:23 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Hi

I wonder if formulation can aggingere xtext interface to my project, I get the string from which to throw them into the content assist
example:

public interface NamesAttributes
{

public String getNameAttribute ();
}

and so do

MyDslProposalProvider {public class extends AbstractMyDslProposalProvider

@ Inject
NameAttributes nameAttributes

@ Override
public void completeSelect_Nomeattribbuto
(EObject model, Assignment assignment,ContentAssistContext context,
ICompletionProposalAcceptor acceptor)
{


acceptor.accept (createCompletionProposal
(nameAttributes.getNameAttribute (), context));


super.completeSelect_Nomeattribbuto (model, assignment, context, acceptor);


}


}
Re: new xtext [message #857258 is a reply to message #857140] Thu, 26 April 2012 11:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
yes this should work perfectly

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: new xtext [message #857340 is a reply to message #857258] Thu, 26 April 2012 13:15 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Sorry Christian ... where I could implement my interface ..... I mean where I can implement it (I mean the place) for viewing. This interface is basically an external link from which I attribute names are provided!
Re: new xtext [message #857346 is a reply to message #857340] Thu, 26 April 2012 13:19 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Read the docs about the usage of dependency injection

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Conditional expression with xtext
Next Topic:Is it possible to define built-in EObjects
Goto Forum:
  


Current Time: Wed Sep 25 22:32:39 GMT 2024

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

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

Back to the top