Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Today's Messages (on)  | Unanswered Messages (off)

Forum: TMF (Xtext)
 Topic: JVM model inferrer comments out type reference
Re: JVM model inferrer comments out type reference [message #1730997 is a reply to message #1730991] Mon, 02 May 2016 03:08
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Hi you should respect the two phases the inferrer has by moving the field stuff to the second closure

Acceptor.accept(xyz.toClass("name")) [
// add members here
]


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: JVM model inferrer comments out type reference [message #1730998 is a reply to message #1730997] Mon, 02 May 2016 03:41
Scott Forbes is currently offline Scott ForbesFriend
Messages: 4
Registered: February 2016
Junior Member
Thanks, I knew I was doing something wrong - all that trouble caused by a misplaced bracket!
 Topic: Incorporating Validations at Runtime
Re: Incorporating Validations at Runtime [message #1731000 is a reply to message #1730330] Mon, 02 May 2016 05:34
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 42
Registered: November 2014
Member
Hi All

I am waiting for any reply. Is there no one that can help me with my requirement? Sad
Please help Christian, Sven, Jan.!!

Puneet
Re: Incorporating Validations at Runtime [message #1731003 is a reply to message #1731000] Mon, 02 May 2016 06:01
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
you have basically do this yourself

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Incorporating Validations at Runtime [message #1731006 is a reply to message #1731003] Mon, 02 May 2016 06:29
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 42
Registered: November 2014
Member
Hi christian

Agreed. But any direction will be really helpful?? Is it even feasible? Do you think the idea is reasonably good? Otheriwse I would end up wasting a lot of time. I just want to know an expert's opinion about this, that's it.

Thanks for your reply.

Puneet
Re: Incorporating Validations at Runtime [message #1731008 is a reply to message #1731006] Mon, 02 May 2016 06:42
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
i dont know if it is a good idea. you need a way to "find" and "classload" the user written validators (e.g. from a checkEObject(Eobject) method inside your validator.
this code wont be trivial so make sure it is worth the effort.


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Incorporating Validations at Runtime [message #1731010 is a reply to message #1731008] Mon, 02 May 2016 07:02
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 42
Registered: November 2014
Member
Hmm... Ok. I will have to explore my options of implementation. By the way, Have you used Sirius? It has this beautiful techique that allows you to modify diagramatic descriptions (*.odesign) in the runtime and see the changes immediately in the same eclipse instance. It looks similar to what I want.

Also, I like the way, Sirius has provided the option of calling "Java Services" for complex scenarios to create mappings, etc.. I was thinking if such a philophy can be applied here. So when a user creates a DSL using the grammar, he also gets option to create java services for validation purpose. It's just preliminary thoughts. What do you think?

By the way, I would like help of you people to get it done. So, sorry for disturbing. Smile

Puneet
 Topic: How to get eclipse runtime application exact location?
How to get eclipse runtime application exact location? [message #1731014] Mon, 02 May 2016 08:25
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 10
Registered: April 2016
Junior Member
Hi,

I am using below code to get the run time eclipse application location


val File workspaceDirectory = workspace.getRoot().getLocation().toFile()
println("Work space directory ::::::::"+workspaceDirectory)

Output ::

E:\WORKSPACES\runtime-EclipseApplication

But how can I get exact location of runtime-EclipseApplication?

Something like this ::

E:\WORKSPACES\MyDSLEditor
Re: How to get eclipse runtime application exact location? [message #1731016 is a reply to message #1731014] Mon, 02 May 2016 08:35
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
still the same answer

IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(resource.getURI().toPlatformString(true)));
System.err.println(file.getRawLocation())


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: How to get eclipse runtime application exact location? [message #1731021 is a reply to message #1731016] Mon, 02 May 2016 10:09
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 10
Registered: April 2016
Junior Member
Yes I know this but I want path upto the workspace root directory not file location
Re: How to get eclipse runtime application exact location? [message #1731022 is a reply to message #1731021] Mon, 02 May 2016 10:22
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Sachin Samaram <forums-noreply@xxxxxxxx> wrote:
> Yes I know this but I want path upto the workspace root directory not file location
>
>

The same should work with the iworkspaceroot
As well (getting the rawlocation)


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
 Topic: Showing error on run time application
Showing error on run time application [message #1731051] Mon, 02 May 2016 14:53
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 10
Registered: April 2016
Junior Member
Hi,

I want to show compile/runtime errors on run time application console not no xtext project console. What should I do?
Re: Showing error on run time application [message #1731053 is a reply to message #1731051] Mon, 02 May 2016 14:57
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Hi,

how is this question xtext related ?

https://wiki.eclipse.org/FAQ_How_do_I_write_to_the_console_from_a_plug-in%3F


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
 Topic: JAR entry DomainmodelParser.class not found in domainmodel.ide-1.0.0-SNAPSHOT.jar
Re: JAR entry DomainmodelParser.class not found in domainmodel.ide-1.0.0-SNAPSHOT.jar [message #1731060 is a reply to message #1722864] Mon, 02 May 2016 15:08
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1669
Registered: July 2009
Senior Member
could this be related to

https://bugs.eclipse.org/bugs/show_bug.cgi?id=491873

?

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
 Topic: Project Wizard for xtext Project
Project Wizard for xtext Project [message #1731030] Mon, 02 May 2016 11:46
Han Li Koay is currently offline Han Li KoayFriend
Messages: 24
Registered: February 2016
Junior Member
Hi guys!

May i know how do i configure my mwe2 workflow to generate the project wizard automatically for me for xtext 2.9.2? I realized that the workflow changed from the old Xtext version and i did not know how exactly should I configure the wizard fragments for the latest Xtext version.

And previously when i try to create my DSL project using the custom project wizard, it was found in the "Xtext" folder which looks like this:
http://s32.postimg.org/z05nj1k9x/xtext.png

I was hoping to get a project wizard structure like this that has its own individual folder which is not under Xtext folder:
- Xtext
-- Xtext Project

- UPF Editor 
-- UPF Editor file
-- UPF Editor project

Is there any way to achieve something like that in xtext project?
Any help is appreciated greatly!

Thanks
Hanli Smile
Re: Project Wizard for xtext Project [message #1731032 is a reply to message #1731030] Mon, 02 May 2016 12:02
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
you may follow https://bugs.eclipse.org/bugs/show_bug.cgi?id=490796.

did you try to use as workaround

fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.ui.generator.projectWizard.SimpleProjectWizardFragment {} //from .... xtext.generator
}


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Project Wizard for xtext Project [message #1731035 is a reply to message #1731032] Mon, 02 May 2016 12:41
Han Li Koay is currently offline Han Li KoayFriend
Messages: 24
Registered: February 2016
Junior Member
Sorry Christian, but that link is broken.

But i successfully generated the project wizard by using:
fragment = ui.projectWizard.SimpleProjectWizardFragment2{
generate = true
}

Do you have any idea on the 2nd question of my first post?

Thanks
Hanli Smile
Re: Project Wizard for xtext Project [message #1731044 is a reply to message #1731035] Mon, 02 May 2016 13:11
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
well it seems to be the . https://bugs.eclipse.org/bugs/show_bug.cgi?id=490796

have a look the the generated plugin.xml / plugin.xml_gen (you may have to merge the second to the first) - i am sure it puts the wizard to a certain category


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Project Wizard for xtext Project [message #1731063 is a reply to message #1731044] Mon, 02 May 2016 15:14
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1669
Registered: July 2009
Senior Member
As Christian said, this is now available, but in Xtext 2.10 nightly.

The documentation has also been updated, you can see the diff here:

https://github.com/eclipse/xtext/pull/989/files

The project wizard will be by default in the "Xtext" category as it also
used to be in the past.

cheers
Lorenzo

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
 Topic: eliminating left recursion
Re: eliminating left recursion [message #1731073 is a reply to message #1730958] Mon, 02 May 2016 17:06
Danny Quizzo is currently offline Danny QuizzoFriend
Messages: 12
Registered: April 2016
Junior Member
Thank you very much for your answer, and for that link.

First I am attaching my full grammar based on the comments I got in this thread as well as stuff that I was able to understand from the pre and postfix post.
Domainmodel :
    (elements+=Object)*;
Object :
	expressions += Expression

Expression:
	Or_expr;

Or_expr returns Expression:
	And_expr ({Or_expr.left=current} '||' right=And_expr)*;
	
And_expr returns Expression:
	Subtract_expr ({And_expr.left=current} '&&' right=Subtract_expr)*;

Subtract_expr returns Expression:
	{Subtract_expr} ('!!')*'!' operand=Subtract_expr
	//('!!')* not_ex+=Subtract_expr
	not_ex+=Compare_expr;

Compare_expr returns Expression:
	Math_expr ({Compare_expr.left=current} operator=('>=' | '<=' | '==' | '!=' | '>' | '<') right=Math_expr)*;

Math_expr returns Expression:
      Term ({Math_expr.left= current} operator=('+' | '-' | '*' | '/' | '%') right=Term)*;

Term returns Expression: 
 	(unary+=('+' | '-' | '~' | '!'))* atom+=Atom (trailer+=Trailer)* |
   // (unary+=('+' | '-' | '~'))*  expr+=Math_expr  |
     '(' Expression ')'

Atom:
      INT 
    | FLOAT 
    | id;

Trailer:
	'[' (index+=Expression)?']'|
	'.' name=id (=>trailer+=Trailer)*;


Based on the pre postfix post I think the '(' Expression ')' is in the right place.
I also think that I am doing the atom and trailer correctly

I read the hints about the '!' but I find them confusing

So at the moment I have 3 problems that I am not sure how to address,

1) since I need both

	{Subtract_expr} ('!!')*'!' operand=Subtract_expr
       and
	('!!')* not_ex+=Subtract_expr


I am not sure how to do this and to avoid a LL recursion. I cannot just move Subtract_expr to a terminal

2) there is an ambiguaity between
{Subtract_expr} ('!!')*'!' operand=Subtract_expr
and
 	(unary+=('+' | '-' | '~' | '!'))* atom+=Atom (trailer+=Trailer)* |


due to the '!' string , and I do not think forcing the grammar to go to the atom line with => , is appropriate

3)

 	(unary+=('+' | '-' | '~' | '!'))* atom+=Atom (trailer+=Trailer)* |
       (unary+=('+' | '-' | '~'))*  expr+=Math_expr  |


there is some overlap between the first line and the 2nd line due to the unary. I think that since a subtract can get '!' the entire 2nd line
(unary+=('+' | '-' | '~'))* expr+=Math_expr |
can just be deleted
Re: eliminating left recursion [message #1731078 is a reply to message #1731073] Mon, 02 May 2016 17:23
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Hi,

i still do not understand why you do the !! stuff is and why you dont handle ( recursion) this strange way.
and i have no idea what you want to do with the Term thing.


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: eliminating left recursion [message #1731082 is a reply to message #1731078] Mon, 02 May 2016 17:42
Danny Quizzo is currently offline Danny QuizzoFriend
Messages: 12
Registered: April 2016
Junior Member
I am writing a domain specific lang, so the '!!' is just a string that can be written in my lang
I can have !!(X+Y) in my language as well as !!! as well as !!!!!.

I am not sure what you mean with :
why you dont handle ( recursion) this strange way

the term can either be
a list of these symbols unary+=('+' | '-' | '~' | '!'))* with an atom, or it can be
'+' | '-' | '~' with another math expression , and clearly since subrtact expression already has ! in it, I think this entire line redundant

the problem is that
both
! subrtact_expr
and also
subrtact_expr should be valid I have two issues
fist the LL recursion in subtract expr and second that
! subrtact_expr
and ... '!'))* atom+=Atom cause some ambiguity
Re: eliminating left recursion [message #1731083 is a reply to message #1731082] Mon, 02 May 2016 17:42
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
so !! is not the same as not not ?!?

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: eliminating left recursion [message #1731085 is a reply to message #1731083] Mon, 02 May 2016 17:46
Danny Quizzo is currently offline Danny QuizzoFriend
Messages: 12
Registered: April 2016
Junior Member
None of them are actual Xtext not, all of them are just the string '!'
so it can either be
'!' 1
'!!!' 3
'!!!!!' 5

My DSL will deal with all of them as what they are
Re: eliminating left recursion [message #1731087 is a reply to message #1731085] Mon, 02 May 2016 17:51
Danny Quizzo is currently offline Danny QuizzoFriend
Messages: 12
Registered: April 2016
Junior Member
am I being clear?
for example
terminal SL_COMMENT: 
    '//' !('\n'|'\r')* ('\r'? '\n')?;

vs.

terminal SL_COMMENT: 
    '//' '!'('\n'|'\r')* ('\r'? '\n')?;

The ! is just a string in the 2nd one
Re: eliminating left recursion [message #1731088 is a reply to message #1731087] Mon, 02 May 2016 17:55
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
i dont get that. and i have not the time. but you can have a look at

Domainmodel :
    (elements+=Object ";")*;
Object :
	expressions += Expression
;


Expression:
	Disjunction
;

Disjunction returns Expression
    :   Conjunction ({BinaryExpression.left=current} operator='||' right=Conjunction)*
    ;
    
Conjunction returns Expression
    :   Comparison ({BinaryExpression.left=current} operator='&&' right=Comparison)*
    ;
    
Comparison returns Expression
    :   Addition ({BinaryExpression.left=current} operator=('='|'!='|'<'|'<='|'>'|'>=') right=Addition)?
    ;
    
Addition returns Expression:
	Multiplication (({Plus.left=current} '+' | {Minus.left=current} '-') right=Multiplication)*;

Multiplication returns Expression:
    UnitaryMinus (({Multi.left=current} '*' | {Div.left=current} '/') right=UnitaryMinus)*;
    
 UnitaryMinus returns Expression:
    PrimaryExpression | ({UnitaryMinus} ('-'|"!"|"~") expr=UnitaryMinus);   
PrimaryExpression returns Expression:
	'(' Expression ')' |
	{NumberLiteral} value=Atom trailer+=Trailer*;


Atom:
      INT 
    | FLOAT 
    | ID;

Trailer:
	'[' (index+=Expression)?']'|
	'.' name=ID (=>trailer+=Trailer)*;


FLOAT: INT ("." INT);	


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
 Topic: Packaging xtext project
Packaging xtext project [message #1731054] Mon, 02 May 2016 15:00
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Hi,

I have done with my xtext project. Now I want to package my xtext project as plugin and make it available to my customers that they can download and install the plugin from server.

Can anyone explain what are the steps I need to perform?
Re: Packaging xtext project [message #1731056 is a reply to message #1731054] Mon, 02 May 2016 15:02
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
do you use a build system like maven? if not

- create a new feature project
- add your plugins to the feature
- use the export -> deployable features wizard


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731059 is a reply to message #1731054] Mon, 02 May 2016 15:06
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1669
Registered: July 2009
Senior Member
On 02/05/2016 17:00, RamaRao Nandamuri wrote:
> Hi,
>
> I have done with my xtext project. Now I want to package my xtext
> project as plugin and make it available to my customers that they can
> download and install the plugin from server.
> Can anyone explain what are the steps I need to perform?

you may also want to have a look at this thread

https://www.eclipse.org/forums/index.php/t/1076761/

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: Packaging xtext project [message #1731072 is a reply to message #1731056] Mon, 02 May 2016 17:04
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Hi Christian,

I have created feature project it generated feature.xml and build.properties files.

Now I right click on that generated plugin and exported that project.

But when I am trying to install that using eclipse new software install options in help menu but it is showing an error like no project exists to install.

After export it created a folder with all jars.

What I have to do now?
Re: Packaging xtext project [message #1731077 is a reply to message #1731072] Mon, 02 May 2016 17:12
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Did you deselect the categorize item when installing. What is the error you
get


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731079 is a reply to message #1731077] Mon, 02 May 2016 17:29
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Hi Christian,

I didn't see any option like categorize item.

I am getting error : No repository found
Re: Packaging xtext project [message #1731080 is a reply to message #1731079] Mon, 02 May 2016 17:31
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
are you shure you added the correct reprository and correctly do the export
please describe step by step what you do


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731081 is a reply to message #1731080] Mon, 02 May 2016 17:36
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Steps I followed:

New -> Project -> Plugin -in Development -> Feature Project and selected all xtext related projects.

Then it generate project with only two files : build.properties and feature.xml

Next: right click on feature.xml -> Export -> Deployable Features -> Select available features and Archive file option. Thats all I did. It generated zip file.

Next: Went to eclipse help menu-> install new software. Then I got no repository error
Re: Packaging xtext project [message #1731084 is a reply to message #1731081] Mon, 02 May 2016 17:45
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
did you add your plugin to feature.xml?

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731086 is a reply to message #1731084] Mon, 02 May 2016 17:46
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
yes I did.
Re: Packaging xtext project [message #1731089 is a reply to message #1731086] Mon, 02 May 2016 17:56
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
and it does not work?
can you share the folder / zip created?


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731090 is a reply to message #1731086] Mon, 02 May 2016 17:57
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Can I use apache maven for build
Re: Packaging xtext project [message #1731091 is a reply to message #1731089] Mon, 02 May 2016 17:58
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
No Message Body

[Updated on: Mon, 02 May 2016 18:04]

Report message to a moderator

Re: Packaging xtext project [message #1731092 is a reply to message #1731091] Mon, 02 May 2016 18:01
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
if i delesect "group items by catorgory" then i get your stuff.
you can add a category.xml as well and select it during export


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731093 is a reply to message #1731092] Mon, 02 May 2016 18:03
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Can you tell the steps I need to do?
Re: Packaging xtext project [message #1731094 is a reply to message #1731093] Mon, 02 May 2016 18:05
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
take this category.xml

https://gitlab.com/cdietrich/xtext-maven-example/blob/master/org.xtext.example.demodsl.p2repo/category.xml

replace the feature name with yours.

in the export dialog on the options page there is a box to select the category.xml


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731095 is a reply to message #1731094] Mon, 02 May 2016 18:12
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/org.xtext.example.demodsl.sdk_1.0.0.qualifier.jar" id="com.prolifics.JPLEditor" version="1.0.0.qualifier">
<category name="com.prolifics.jpl.JPLEditor"/>
</feature>
<category-def name="com.prolifics.jpl.JPLEditor" label="JPL Editor"/>
</site>


I have added category name with my What about feature url ?
Re: Packaging xtext project [message #1731096 is a reply to message #1731095] Mon, 02 May 2016 18:13
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Simply open it with the category editor and hit the add button there

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731097 is a reply to message #1731096] Mon, 02 May 2016 18:16
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
Yeah its working. Why it is asking for git username and password? Can I skip that?
Re: Packaging xtext project [message #1731098 is a reply to message #1731097] Mon, 02 May 2016 18:16
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
It should not be asking. Are you sure that is related?

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Packaging xtext project [message #1731099 is a reply to message #1731098] Mon, 02 May 2016 18:25
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 43
Registered: April 2016
Member
No it is not related
 Topic: Providing type for keywords
Providing type for keywords [message #1731047] Mon, 02 May 2016 14:38
Marina Andric is currently offline Marina AndricFriend
Messages: 6
Registered: March 2016
Junior Member
I am learning/trying to implement scoping for my dsl, which is small java-like one. I have two keywords I need to provide a type and consecutively scope for, one is this and the other is here.

In the TypeProvider, type of this is computed as the containing class, and the scope is members of the class. The problem is to compute the type of here, which should be a class contained in the small library I wrote for my dsl. I don't know how to 'link' the two.

Can someone please help? Thanks a lot
Re: Providing type for keywords [message #1731049 is a reply to message #1731047] Mon, 02 May 2016 14:43
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
do you use xbase or not? how does your grammar look like?
this the keyword itself a cross reference or not? .....

which type system do you use?
....


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com

[Updated on: Mon, 02 May 2016 14:44]

Report message to a moderator

Re: Providing type for keywords [message #1731050 is a reply to message #1731049] Mon, 02 May 2016 14:51
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
p.s:

simply asking the delegating scope provider for the "here" thing does not work?


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731064 is a reply to message #1731049] Mon, 02 May 2016 15:28
Marina Andric is currently offline Marina AndricFriend
Messages: 6
Registered: March 2016
Junior Member
Hi Christian,
Thanks a lot for your responsiveness.

I am not using xbase.
My grammar is similar to this one
https://github.com/LorenzoBettini/packtpub-xtext-book-examples/blob/master/org.example.smalljava/src/org/example/smalljava/SmallJava.xtext
with only a few additions.
I was basically copying the approach applied in that book example, until I ran into the problem of providing the type of 'here'.

I've just googled, are you suggesting I should in some way use IDelegatingScopeProvider ?
Re: Providing type for keywords [message #1731065 is a reply to message #1731064] Mon, 02 May 2016 16:03
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
i mean something like

package org.example.smalljava.typing

import com.google.common.base.Predicates
import com.google.inject.Inject
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EcoreFactory
import org.eclipse.xtext.naming.QualifiedName
import org.eclipse.xtext.scoping.IGlobalScopeProvider
import org.example.smalljava.lib.SmallJavaLib
import org.example.smalljava.smallJava.SJAssignment
import org.example.smalljava.smallJava.SJBoolConstant
import org.example.smalljava.smallJava.SJClass
import org.example.smalljava.smallJava.SJExpression
import org.example.smalljava.smallJava.SJHere
import org.example.smalljava.smallJava.SJIntConstant
import org.example.smalljava.smallJava.SJMemberSelection
import org.example.smalljava.smallJava.SJMethod
import org.example.smalljava.smallJava.SJNew
import org.example.smalljava.smallJava.SJNull
import org.example.smalljava.smallJava.SJReturn
import org.example.smalljava.smallJava.SJStringConstant
import org.example.smalljava.smallJava.SJSuper
import org.example.smalljava.smallJava.SJSymbolRef
import org.example.smalljava.smallJava.SJThis
import org.example.smalljava.smallJava.SJVariableDeclaration
import org.example.smalljava.smallJava.SmallJavaFactory
import org.example.smalljava.smallJava.SmallJavaPackage

import static extension org.example.smalljava.util.SmallJavaModelUtil.*
import org.eclipse.emf.ecore.util.EcoreUtil

class SmallJavaTypeProvider {
	
	@Inject extension SmallJavaLib
	
	@Inject IGlobalScopeProvider globalScopeProvider
	
	val ep = SmallJavaPackage::eINSTANCE
	
	public static val stringType = 
		SmallJavaFactory::eINSTANCE.createSJClass => [name = 'stringType']
	public static val intType = 
		SmallJavaFactory::eINSTANCE.createSJClass => [name = 'intType']
	public static val booleanType = 
		SmallJavaFactory::eINSTANCE.createSJClass => [name = 'booleanType']

	public static val nullType = 
		SmallJavaFactory::eINSTANCE.createSJClass => [name = 'nullType']
	
	def typeFor(SJExpression e) {
		switch (e) {
			SJThis : e.containingClass
			SJHere : e.here
			SJSuper : e.containingClass.getSuperclassOrObject
			SJSymbolRef: e.symbol?.type
			SJNew: e.type
			SJMemberSelection: e.member?.type
			SJNull: nullType
			SJStringConstant: stringType
			SJIntConstant: intType
			SJBoolConstant: booleanType
		}
	}
	
	def SJClass getHere(EObject e) {
		var result = globalScopeProvider.getScope(e.eResource, EcoreFactory.eINSTANCE.createEReference => [EType = SmallJavaPackage.Literals.SJ_CLASS] , Predicates.alwaysTrue).getSingleElement(QualifiedName.create("Here")).EObjectOrProxy as SJClass
		return EcoreUtil.resolve(result, e.eResource.resourceSet) as SJClass
	}

	def expectedType(SJExpression e) {
		val c = e.eContainer
		val f = e.eContainingFeature
		switch (c) {
			SJVariableDeclaration case f == ep.SJVariableDeclaration_Expression : 
				c.type
			SJAssignment case f == ep.SJAssignment_Right : 
				c.left.typeFor
			SJReturn case f == ep.SJReturn_Expression :
				c.containingMethod.type
			SJMemberSelection case f == ep.SJMemberSelection_Args : {
				// assume that it refers to a method and that there
				// is a parameter corresponding to the argument
				try {
					(c.member as SJMethod).params.get(c.args.indexOf(e)).type
				} catch (Throwable t) {
					null // otherwise there is no specific expected type
				}
			}
			case f == ep.SJIfStatement_Expression: booleanType
		}
	}

	def argsTypesAsStrings(SJMemberSelection sel) {
		"(" + sel.args.map[typeFor?.name].join(", ") + ")"
	}

	def isPrimitive(SJClass c) {
		c.eResource == null
	}
}


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731067 is a reply to message #1731065] Mon, 02 May 2016 16:33
Marina Andric is currently offline Marina AndricFriend
Messages: 6
Registered: March 2016
Junior Member
No Message Body
Re: Providing type for keywords [message #1731071 is a reply to message #1731067] Mon, 02 May 2016 16:58
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
?

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731075 is a reply to message #1731067] Mon, 02 May 2016 17:12
Marina Andric is currently offline Marina AndricFriend
Messages: 6
Registered: March 2016
Junior Member

I tried this solution and it works nicely when the class 'Here' is in the same source folder, like other user-defined classes.
In my case, the class 'Here' is defined in another package. Only if I type 'here' explicitly in the test program, say, write 'val here:Here;' then I'm able to select members define in 'Here'.

(When I created an eclipse project for my dsl I added as dependency the project where my package is defined).

Should there be some code to suggest to look for the class definition in the package? Perhaps in the ScopeProvider..

Thanks a lot for your wisdom and time Smile
Re: Providing type for keywords [message #1731076 is a reply to message #1731075] Mon, 02 May 2016 17:14
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
sry please share all needed to reproduce

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731100 is a reply to message #1731076] Mon, 02 May 2016 18:27
Marina Andric is currently offline Marina AndricFriend
Messages: 6
Registered: March 2016
Junior Member
I uploaded my code here:
https://github.com/marinamygithub/xtext_project/tree/master/org.xtext.example.ADSL

In my case 'here' should be of type Place, which is a class defined in main.adsl
Re: Providing type for keywords [message #1731101 is a reply to message #1731100] Mon, 02 May 2016 18:32
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Yes but I don't see why you cannot adopt this from my example. I ask the scope for a sjclass called here you can ask it for a sjclass called place

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731102 is a reply to message #1731101] Mon, 02 May 2016 18:43
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
p.s.

did you test the "Qualified name" of Here? maybe you have to ask the scope for

full.qualified.name.Here


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Providing type for keywords [message #1731103 is a reply to message #1731102] Mon, 02 May 2016 18:43
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 8866
Registered: July 2009
Senior Member
Thus QualifiedName.create("full","qualified","name","Here")

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com



Current Time: Mon May 02 19:42:55 GMT 2016

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

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