Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code templates
Code templates [message #637332] Fri, 05 November 2010 06:33 Go to next message
No real name is currently offline No real nameFriend
Messages: 101
Registered: August 2010
Senior Member
Hi,

I've created templates.xml and put in in a templates/ folder in the UI plugin. If I use the eclipse debug framework, I can see these templates in the Window->Preferences->MyDSL. However, when I create a stadnalone product configuration, while my plugins are working, these templates are not appearing. I've added the 'ID' attribute like this:

 <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 
 <templates>
  <template autoinsert="false" context="org.xtext.example.hlm.MyHLM.Condition" deleted="false" description="" enabled="true" name="cond_template" ID="hlm2">cond (${condition}) { ${true_state} }</template> 
  <template autoinsert="true" context="org.xtext.example.hlm.MyHLM.Default" deleted="false" description="" enabled="true" name="default template" ID="hlm3">default { ${default_state} }</template> 
   <template autoinsert="false" context="org.xtext.example.hlm.MyHLM.State" deleted="false" description="" enabled="true" name="state_template" ID="hlm4">state ${state_name} { action { ${operation}; } cond (${condition}) { ${true_state} } default { ${default_state} } }</template> 
  </templates>


These plugins (along with others) are put in the dependencies of teh UI plugin:

<plugin id="org.eclipse.xpand"/>
<plugin id="org.eclipse.xtend"/>
<plugin id="org.eclipse.xtend.typesystem.emf"/>
<plugin id="org.eclipse.xtext"/>
<plugin id="org.eclipse.xtext.builder"/>
<plugin id="org.eclipse.xtext.common.types"/>
<plugin id="org.eclipse.xtext.generator"/>
<plugin id="org.eclipse.xtext.logging" fragment="true"/>
<plugin id="org.eclipse.xtext.ui"/>
<plugin id="org.eclipse.xtext.ui.shared"/>
<plugin id="org.eclipse.xtext.util"/>
<plugin id="org.eclipse.xtext.xtend"/>
<plugin id="org.xtext.example.hlm"/>
<plugin id="org.xtext.example.hlm.generator"/>
<plugin id="org.xtext.example.hlm.ui"/>


Is there some other dependency that I have to add to get this working? I've done 'Add required plugins' when I created the product configuration file and there are no missing dependencies (i.e, everythign is validated). Or maybe I need to set the ID attirbute to something special?

Thanks.
Re: Code templates [message #637338 is a reply to message #637332] Fri, 05 November 2010 06:49 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I don't know whether this might solve the problem, but have you added
the templates directory in your build.properties so that it is included
in the binary build?

cheers
Lorenzo

On 11/05/2010 07:33 AM, pgbackup@yahoo.com wrote:
> Hi,
>
> I've created templates.xml and put in in a templates/ folder in the UI
> plugin. If I use the eclipse debug framework, I can see these templates
> in the Window->Preferences->MyDSL. However, when I create a stadnalone
> product configuration, while my plugins are working, these templates are
> not appearing. I've added the 'ID' attribute like this:
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <templates>
> <template autoinsert="false"
> context="org.xtext.example.hlm.MyHLM.Condition" deleted="false"
> description="" enabled="true" name="cond_template" ID="hlm2">cond
> (${condition}) { ${true_state} }</template> <template autoinsert="true"
> context="org.xtext.example.hlm.MyHLM.Default" deleted="false"
> description="" enabled="true" name="default template" ID="hlm3">default
> { ${default_state} }</template> <template autoinsert="false"
> context="org.xtext.example.hlm.MyHLM.State" deleted="false"
> description="" enabled="true" name="state_template" ID="hlm4">state
> ${state_name} { action { ${operation}; } cond (${condition}) {
> ${true_state} } default { ${default_state} } }</template> </templates>
>
>
> These plugins (along with others) are put in the dependencies of teh UI
> plugin:
>
> <plugin id="org.eclipse.xpand"/>
> <plugin id="org.eclipse.xtend"/>
> <plugin id="org.eclipse.xtend.typesystem.emf"/>
> <plugin id="org.eclipse.xtext"/>
> <plugin id="org.eclipse.xtext.builder"/>
> <plugin id="org.eclipse.xtext.common.types"/>
> <plugin id="org.eclipse.xtext.generator"/>
> <plugin id="org.eclipse.xtext.logging" fragment="true"/>
> <plugin id="org.eclipse.xtext.ui"/>
> <plugin id="org.eclipse.xtext.ui.shared"/>
> <plugin id="org.eclipse.xtext.util"/>
> <plugin id="org.eclipse.xtext.xtend"/>
> <plugin id="org.xtext.example.hlm"/>
> <plugin id="org.xtext.example.hlm.generator"/>
> <plugin id="org.xtext.example.hlm.ui"/>
>
>
> Is there some other dependency that I have to add to get this working?
> I've done 'Add required plugins' when I created the product
> configuration file and there are no missing dependencies (i.e,
> everythign is validated). Or maybe I need to set the ID attirbute to
> something special?
>
> Thanks.


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Code templates [message #637474 is a reply to message #637338] Fri, 05 November 2010 17:15 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 101
Registered: August 2010
Senior Member
Hi Lorenzo,

Thank you for your help. I have verified that the templates directory is included. Here is how my build.properties file looks like:

bin.includes = META-INF/,\
               .,\
               plugin.xml,\
               lib/dom4j-1.6.1.jar,\
               lib/poi-3.6-20091214.jar,\
               lib/poi-ooxml-3.6-20091214.jar,\
               lib/xmlbeans-2.3.0.jar,\
               lib/poi-ooxml-schemas-3.6-20091214.jar,\
               log4j.xml,\
               templates/,\
               templates/templates.xml, \
               plugin_customization.ini,\
               splash.bmp,\
               icons/
source.. = src/,\
           src-gen/
bin.excludes = META-INF/.svn/,\
               templates/.svn/,\
               icons/.svn/
jars.extra.classpath = lib/dom4j-1.6.1.jar,\
                       lib/poi-3.6-20091214.jar,\
                       lib/poi-ooxml-3.6-20091214.jar,\
                       lib/poi-ooxml-schemas-3.6-20091214.jar,\
                       lib/xmlbeans-2.3.0.jar


Just to be paranoid, I also added /templates/templates.xml, \ . I confirmed that the file is pesent by doing 'jar xf <jarfile>' so it is included in the UI plugin. But no templates are visible.

Thank you again.
Re: Code templates [message #637486 is a reply to message #637474] Fri, 05 November 2010 19:01 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
then probably templates are implemented in some plugins which are not
included as an automatic dependency?

On 11/05/2010 06:15 PM, pgbackup@yahoo.com wrote:
> Hi Lorenzo,
>
> Thank you for your help. I have verified that the templates directory is
> included. Here is how my build.properties file looks like:
>
>
> bin.includes = META-INF/,\
> .,\
> plugin.xml,\
> lib/dom4j-1.6.1.jar,\
> lib/poi-3.6-20091214.jar,\
> lib/poi-ooxml-3.6-20091214.jar,\
> lib/xmlbeans-2.3.0.jar,\
> lib/poi-ooxml-schemas-3.6-20091214.jar,\
> log4j.xml,\
> templates/,\
> templates/templates.xml, \
> plugin_customization.ini,\
> splash.bmp,\
> icons/
> source.. = src/,\
> src-gen/
> bin.excludes = META-INF/.svn/,\
> templates/.svn/,\
> icons/.svn/
> jars.extra.classpath = lib/dom4j-1.6.1.jar,\
> lib/poi-3.6-20091214.jar,\
> lib/poi-ooxml-3.6-20091214.jar,\
> lib/poi-ooxml-schemas-3.6-20091214.jar,\
> lib/xmlbeans-2.3.0.jar
>
>
> Just to be paranoid, I also added /templates/templates.xml, \ . I
> confirmed that the file is pesent by doing 'jar xf <jarfile>' so it is
> included in the UI plugin. But no templates are visible.
>
> Thank you again.


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Code templates [message #637493 is a reply to message #637486] Fri, 05 November 2010 19:29 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 101
Registered: August 2010
Senior Member
That is what I'm thinking as well. But I'm not sure what the name of that dependent plugin is Very Happy
Re: Code templates [message #637691 is a reply to message #637332] Mon, 08 November 2010 11:10 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Am 05.11.10 07:33, schrieb pgbackup@yahoo.com:
> Hi,
>
> I've created templates.xml and put in in a templates/ folder in the UI
> plugin. If I use the eclipse debug framework, I can see these templates
> in the Window->Preferences->MyDSL. However, when I create a stadnalone
> product configuration, while my plugins are working, these templates are
> not appearing. I've added the 'ID' attribute like this:
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <templates>
> <template autoinsert="false"
> context="org.xtext.example.hlm.MyHLM.Condition" deleted="false"
> description="" enabled="true" name="cond_template" ID="hlm2">cond
> (${condition}) { ${true_state} }</template> <template autoinsert="true"
> context="org.xtext.example.hlm.MyHLM.Default" deleted="false"
> description="" enabled="true" name="default template" ID="hlm3">default
> { ${default_state} }</template> <template autoinsert="false"
> context="org.xtext.example.hlm.MyHLM.State" deleted="false"
> description="" enabled="true" name="state_template" ID="hlm4">state
> ${state_name} { action { ${operation}; } cond (${condition}) {
> ${true_state} } default { ${default_state} } }</template> </templates>
>

I am not sure, but the element names could be case sensitive. Try to set
id="xx" instead of ID="xx".

>
> These plugins (along with others) are put in the dependencies of teh UI
> plugin:
>
> <plugin id="org.eclipse.xpand"/>
> <plugin id="org.eclipse.xtend"/>
> <plugin id="org.eclipse.xtend.typesystem.emf"/>
> <plugin id="org.eclipse.xtext"/>
> <plugin id="org.eclipse.xtext.builder"/>
> <plugin id="org.eclipse.xtext.common.types"/>
> <plugin id="org.eclipse.xtext.generator"/>
> <plugin id="org.eclipse.xtext.logging" fragment="true"/>
> <plugin id="org.eclipse.xtext.ui"/>
> <plugin id="org.eclipse.xtext.ui.shared"/>
> <plugin id="org.eclipse.xtext.util"/>
> <plugin id="org.eclipse.xtext.xtend"/>
> <plugin id="org.xtext.example.hlm"/>
> <plugin id="org.xtext.example.hlm.generator"/>
> <plugin id="org.xtext.example.hlm.ui"/>

I am a bit confused: Aren't you using the MANIFEST.MF to define the
dependencies? This looks like Eclipse 3.0.

>
>
> Is there some other dependency that I have to add to get this working?
> I've done 'Add required plugins' when I created the product
> configuration file and there are no missing dependencies (i.e,
> everythign is validated). Or maybe I need to set the ID attirbute to
> something special?
>
> Thanks.


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: Code templates [message #637759 is a reply to message #637691] Mon, 08 November 2010 17:53 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 101
Registered: August 2010
Senior Member
Hi Jan,

I can confirm it was a case-sensitive issue!. It should be id=".." instead of ID="". Perhaps the Xtext documentation can be updated with a small one-line example to reflect this.

Thanks!
Re: Code templates [message #676052 is a reply to message #637332] Thu, 02 June 2011 16:00 Go to previous messageGo to next message
Robert Coop is currently offline Robert CoopFriend
Messages: 3
Registered: June 2011
Junior Member
I just had and resolved this same issue. As of 6/2/2011, the current Xtext guide (at www.eclipse.org/Xtext/documentation/latest/xtext.html#templates ) still specifically states that you need to "insert an ID attribute". Could this be corrected to prevent others from struggling with this same issue?
Re: Code templates [message #676053 is a reply to message #676052] Thu, 02 June 2011 16:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14677
Registered: July 2009
Senior Member
Hi,

please file a bug/enhancement request against the docs into bugzilla.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code templates [message #676057 is a reply to message #676053] Thu, 02 June 2011 16:22 Go to previous messageGo to next message
Robert Coop is currently offline Robert CoopFriend
Messages: 3
Registered: June 2011
Junior Member
Thanks, I'm not that familiar with the process here so I wasn't sure what needed to be done. I appreciate the direction and will fill out the bug.
Re: Code templates [message #676531 is a reply to message #676057] Sun, 05 June 2011 04:53 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

http://www.eclipse.org/Xtext/support/ has a link to the bugzila

By the way, the sample template contained in the documentation does indicate that "id" is to be written in lower case.

Alex
Previous Topic:Next step after defining a grammar
Next Topic:Content assist offering illegal keywords
Goto Forum:
  


Current Time: Mon May 13 07:27:10 GMT 2024

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

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

Back to the top