|
Re: [MOFScript] Unprotected regions [message #380472 is a reply to message #380468] |
Mon, 26 November 2007 10:37 |
Eclipse User |
|
|
|
Originally posted by: javjimgon.alum.us.es
Gøran K. Olsen escribió:
> Hello Javier,
>
> Yes it should be possible, could you please be a bit more specific.
>
> /Gøran
>
>
> "Javier Jimenez" <javjimgon@alum.us.es> wrote in message
> news:fi6ueo$g49$1@build.eclipse.org...
>> Hello ,
>>
>> it is posible to difine different unprotect section in the same file.
>> I have some problem when I regenerate.
>>
>>
>> Thanks
>>
>> Javier Jimenez
>
>
Hello,
I apologize for the first email.
I defined a set of transformation rules with different 'unprotected
regions'. With these rules I generate a code-file however in this file
all the 'unprotected' regions have the same 'number' and the same 'id'.
The problem is when I write new code in these section. If I write new
code in first section and I regenerate, the code is copied in all the
unprotected section and if I write new code in the rest of the section
when I regenerate I lose it.
Example:
self.ownedAttribute->forEach(p : uml.Property) {
' 'p.mapPropertyModifier() ' ' p.umlProperty2JavaType() ' '
p.name'; ' nl(1)
}
'
//Manual Attributes' nl(1)
unprotect{
}
....
//Generate Methods
....
' //Generate Methods' nl(1)
self.ownedOperation->forEach(o : uml.Operation){
if(!(self.name.equals(o.name))) {
' 'o.mapMethodModifier() ' ' o.mapReturnType() ' '
o.name ' (' o.mapMethodParameter() ' )' /*o.mapException()*/ '{' nl(2)
unprotect{
}
' }' nl(2)
}
}
' //Manual methods' nl(1)
unprotect{
}
Result:
// Manual Attributes
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
......
//Generate Methods
void method1() {
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
}
//Manual methods
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
}
So my question is should be possible to define different unprotected
regions that will be independent when I generate the code. When I say
independent I mean the it is possible to write new and different code
that will not change when I generate the code again.
Thank you in advance!!
Javier Jimenez
|
|
|
|
Re: [MOFScript] Unprotected regions [message #609667 is a reply to message #380468] |
Mon, 26 November 2007 10:37 |
Eclipse User |
|
|
|
Originally posted by: javjimgon.alum.us.es
Gøran K. Olsen escribió:
> Hello Javier,
>
> Yes it should be possible, could you please be a bit more specific.
>
> /Gøran
>
>
> "Javier Jimenez" <javjimgon@alum.us.es> wrote in message
> news:fi6ueo$g49$1@build.eclipse.org...
>> Hello ,
>>
>> it is posible to difine different unprotect section in the same file.
>> I have some problem when I regenerate.
>>
>>
>> Thanks
>>
>> Javier Jimenez
>
>
Hello,
I apologize for the first email.
I defined a set of transformation rules with different 'unprotected
regions'. With these rules I generate a code-file however in this file
all the 'unprotected' regions have the same 'number' and the same 'id'.
The problem is when I write new code in these section. If I write new
code in first section and I regenerate, the code is copied in all the
unprotected section and if I write new code in the rest of the section
when I regenerate I lose it.
Example:
self.ownedAttribute->forEach(p : uml.Property) {
' 'p.mapPropertyModifier() ' ' p.umlProperty2JavaType() ' '
p.name'; ' nl(1)
}
'
//Manual Attributes' nl(1)
unprotect{
}
....
//Generate Methods
....
' //Generate Methods' nl(1)
self.ownedOperation->forEach(o : uml.Operation){
if(!(self.name.equals(o.name))) {
' 'o.mapMethodModifier() ' ' o.mapReturnType() ' '
o.name ' (' o.mapMethodParameter() ' )' /*o.mapException()*/ '{' nl(2)
unprotect{
}
' }' nl(2)
}
}
' //Manual methods' nl(1)
unprotect{
}
Result:
// Manual Attributes
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
......
//Generate Methods
void method1() {
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
}
//Manual methods
//#BlockStart number=2 id=_VO1DSI3YEdyiWvv5uxtF2A
//#BlockEnd number=2
}
So my question is should be possible to define different unprotected
regions that will be independent when I generate the code. When I say
independent I mean the it is possible to write new and different code
that will not change when I generate the code again.
Thank you in advance!!
Javier Jimenez
|
|
|
|
Powered by
FUDForum. Page generated in 0.03413 seconds