[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: add .xpt template

Hello Aurelien,

Where do I start the path? (my??)
In .gmfgen model there are two properties:
- GenEditorGenerator.Dynamic Templates (boolean)
- GenEditorGenerator.Template Directory (string) - see http://wiki.eclipse.org/GMF_GenModel_Hints#GenEditorGenerator

So, you can:
- create new template in a file: /project1/customTemplates/folder1/TemplateFile.xpt
- set Template Directory to "/project1/customTemplates"
- use ÂEXPAND folder1::TemplateFile::definitionName FOR myModelElement to execute definition "definitionName" from this file.


What is the myModelElement? (gmfgen::GenCustomPropertyTab??)
myModelElement is a name of variable or reference/attribute. It's type can be gmfgen::GenCustomPropertyTab. Here is an example from GMF templates:

ÂDEFINE Class FOR gmfgen::GenCustomPropertyTabÂ
............
public class ÂclassName extends ÂEXPAND extendsList ÂEXPAND implementsClauseÂ{
............
ÂENDDEFINEÂ

ÂEXPAND extendsList is a way to call another definition with name "extendsList" (defined in this file). This call is equivalent to: ÂEXPAND extendsList FOR self where "self" is a contextual parameter name (instanceof gmfgen::GenCustomPropertyTab). If you need to call a definition using any feature of contextual parameter you can use constructions like:

ÂEXPAND myDefinition FOR self.classNameÂ

the the following definition will be called:
ÂDEFINE myDefinition FOR StringÂ
............
ÂENDDEFINEÂ

where "String" is a type of gmfgen::GenCustomPropertyTab::className attribute in the model. Instead of shortname of a definition located in same file you can use full name like: myFolder::MyTemplate::myDefinition

[1]
[...]
ÂEXPAND xpt::propsheet::newTemplate::Class
FOR gmfgen::GenCustomPropertyTabÂ
It should be something like:
ÂEXPAND xpt::propsheet::newTemplate::Class FOR self.customPropertyTabÂ

-----------------
Alex Shatalin