Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using templates(Question on top level Model template)
Using templates [message #674290] Thu, 26 May 2011 12:44
Michel Simeon is currently offline Michel SimeonFriend
Messages: 128
Registered: December 2009
Senior Member
I have a grammar for a DSL I use for data entry, that is as follows:

Model :
(('Country Name' | 'Nom du pays') '=')? countryName = STRING ';'
(('Project Name' | 'Nom du projet') '=')? projectName = STRING ';'
(elements += (Entity))*
('fin' | 'end') 'model'

Commodity | Plan | Script | Table | Herd ;


I have a full set of templates to assist in data entry, including one for the entire Model, with a list of the initial parameters (Headers), some comments, and the end of model key words; it is defined with Model as context. There is also one template for each entity type.

When I create an empty file, ctrl-space bar gives me the choice between the initial optional keywords, the countryName string, or the Headers template, as expected.

If I select the key words or the string entry it works fine.

If I select the Headers template, it does not work. If I type a space, for exemple, so that the file is no longer empty, then it will work and write the template into my file.

I find this odd for the end users. Does anybody know a workaroud ?


PS Just in case, here is the actual template:

<template name="-Headers in English" description="template for header data"
enabled="true">Country Name = '${countryName}' ;
Project Name = '${projectName}' ;
Data Set Name = '${dataSetName}' ;
Currency Name = '${currency}' ;
Exchange Rate = ${1} to the US Dollar ;
OCC = ${12} % ;
Project life = ${20} years ;
File specs : ??
// optional list of file specs for import : export
end ; ??
Results as ${resultAs:Enum('ResKW')} ;
// A model is made of declarations of type Commodity, Plan, Script or Table
// A script item can be a command (print, display, filespec or export), a variable declaration
// or an instruction (variable declaration or variable Reference = expression)
// where expression combines numbers, [series], varRef, commRef, functions using + - / * ^ or ()
// Use ctrl-space for content proposals
end model

Previous Topic:How to implement function calls
Next Topic:Internationalization of DSL ?
Goto Forum:

Current Time: Tue May 22 14:20:15 GMT 2018

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

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

Back to the top