|
|
|
Re: [PARTIALLY SOLVED] xpt templates [message #504841 is a reply to message #504840] |
Wed, 23 December 2009 01:03 |
No real name Messages: 62 Registered: July 2009 |
Member |
|
|
Hi,
I figured out, how to do it: It is possible to add custom code to the
'additions' DEFINE statement. This is expanded after all the other code
of the NodeEditPart is generated. In addition, GenNodes have the string
attribute 'editPartClassName', so I can simply test if that one is equal
to 'FBEditPart'.
However, I keep getting a strange error message:
Problems while generating code
Exception (org.eclipse.gmf.internal.xpand.util.ParserException,
@aspects::diagram::editparts::NodeEditPart
[131:33-131:33] "ERROR_TOKEN"unexpected token(s)
ignored(aspects::diagram::editparts::NodeEditPart:131:33:131 :33: ))
while generating code
org.eclipse.gmf.internal.xpand.util.ParserException,
@aspects::diagram::editparts::NodeEditPart
[131:33-131:33] "ERROR_TOKEN"unexpected token(s)
ignored(aspects::diagram::editparts::NodeEditPart:131:33:131 :33: )
Exception (org.eclipse.gmf.internal.xpand.util.ParserException,
@aspects::diagram::editparts::NodeEditPart
[131:33-131:33] "ERROR_TOKEN"unexpected token(s)
ignored(aspects::diagram::editparts::NodeEditPart:131:33:131 :33: ))
..
..
..
(This is repeated several times)
It looks like a syntax error, but I cannot figure it out. Does anyone
know, what is wrong here?
Thanks in advance,
Matthias
Matthias Schmeling wrote:
> I'll do that. Thanks :)
>
> Esteban DUGUEPEROUX wrote:
>> Hi Matthias,
>>
>> You should use AROUND keyword instead of DEFINE to customize code
>> generation from your *.gmfgen. You should also look at UML2Tools
>> source code to see how they do.
>>
>> Best Regards.
>>
>> Matthias Schmeling wrote:
>>> Hi,
>>>
>>> In my diagram project, I changed A specific editpart, called
>>> FBEditPart, which is located in diagram.edit.parts.FBEditPart.
>>>
>>> I just added a new method and some inner classes. Now I'd like to use
>>> a template so the code is generated automatically. So I made an new
>>> template file NodeEditPart.xpt
>>>
>>> Is it enough to simply add a new Define statement or do I have to
>>> change an existing one?
>>>
>>> And how can I specify that I want only FBEditPart to be affected and
>>> not other EditParts?
>>>
>>> Currently, my NodeEditPart.xpt looks like this:
>>>
>>> ------------------------------------------------------------
>>> «IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
>>> «EXTENSION xpt::diagram::ViewmapAttributesUtils»
>>> «EXTENSION xpt::diagram::editparts::Utils»
>>> «EXTENSION xpt::diagram::Utils»
>>>
>>> «DEFINE additions FOR gmfgen::GenNode-»
>>> «IF ----- only true if this is an FBEditPart ------»
>>> ----- method code -----
>>> ----- class1 code -----
>>> ----- class1 code -----
>>> ----- class1 code -----
>>> «ENDIF-»
>>> «ENDDEFINE»
>>> ------------------------------------------------------------
>>>
>>> Is this the right approach?
>>>
>>> Thanks,
>>> Matthias
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04399 seconds