Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Label with Feature Seq Initializer via OCL
Label with Feature Seq Initializer via OCL [message #211649] Thu, 20 November 2008 14:31 Go to next message
Stephan Kleber is currently offline Stephan KleberFriend
Messages: 6
Registered: July 2009
Junior Member
Hi,

what I need is to set the "name"-attribute of model elements at creation
to the Type-Name + incNumber
i.e. the 12th Node "Topic" should at creation get the name: "Topic 12"

A fixed value (i.e. 'aString') works.

Topic.allInstances->size shows in the error log a "Expression
problem:Unrecognized variable: (allInstances)body:Topic.allInstances->size"
Topic.allInstances()->size() shows nothing in the error log but doesn't
have any effect on the name-Attribute.

Topic.name also did result in an similar error log entry,
Topic.name() resulted in "Expression problem:Cannot find operation
(name()) for the type (Topic)body:Topic.name()"
and Topic.getName() did not do anything at all, too.

Let alone did I try to concatenate anthing (which I have no idea how to
acomplish).

I looked for some general GMF-specific OCL documentation but didn't find
any. Isn't there one?

What could I do about this before I abandon OCL?

Stephan
Re: Label with Feature Seq Initializer via OCL [message #211678 is a reply to message #211649] Thu, 20 November 2008 15:24 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Stephan,

You should introduce back reference "topicContainer" into the Topic model
element. As a result OCL constraint will be like:
'Prefix' + topicContainer.topics->size()

-----------------
Alex Shatalin
Re: Label with Feature Seq Initializer via OCL [message #212046 is a reply to message #211678] Tue, 25 November 2008 13:09 Go to previous messageGo to next message
Stephan Kleber is currently offline Stephan KleberFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Alex,

thank you.

I looked into it and decided not to do this, because it would have meant
a major change in the model. The issue concerns a lot of model elements.

Instead of OCL I used the java-Option and did create the Label Strings
myself. There rose one question:

Is it meant to be that I cannot introduce java-Code into the mapping
model as I can do with OCL? I had to write directly into the generated
methods of class ElementInitializers after generation of the diagram editor.

This is OK to me but seamed to be odd.

Stephan

Alex Shatalin schrieb:
> Hello Stephan,
>
> You should introduce back reference "topicContainer" into the Topic
> model element. As a result OCL constraint will be like:
> 'Prefix' + topicContainer.topics->size()
>
> -----------------
> Alex Shatalin
>
>
Re: Label with Feature Seq Initializer via OCL [message #212053 is a reply to message #212046] Tue, 25 November 2008 14:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Stephan, Alex,

Perhaps the GMF team would consider applying the
ParsingOptions.IMPLICIT_ROOT_CLASS option to provide implicit access to
the features of EObject, in models that do not actually declare
generalizations to EObject? Then, eContainer() could be used in
constraints like this.

It could even be an option in the GMF model, to assuage concerns of OCL
portability/compliance.

Cheers,

Christian


Stephan Kleber wrote:
> Hi Alex,
>
> thank you.
>
> I looked into it and decided not to do this, because it would have meant
> a major change in the model. The issue concerns a lot of model elements.
>
> Instead of OCL I used the java-Option and did create the Label Strings
> myself. There rose one question:
>
> Is it meant to be that I cannot introduce java-Code into the mapping
> model as I can do with OCL? I had to write directly into the generated
> methods of class ElementInitializers after generation of the diagram
> editor.
>
> This is OK to me but seamed to be odd.
>
> Stephan
>
> Alex Shatalin schrieb:
>> Hello Stephan,
>>
>> You should introduce back reference "topicContainer" into the Topic
>> model element. As a result OCL constraint will be like:
>> 'Prefix' + topicContainer.topics->size()
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Label with Feature Seq Initializer via OCL [message #212098 is a reply to message #212046] Tue, 25 November 2008 16:05 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Stephan,

> Is it meant to be that I cannot introduce java-Code into the mapping
> model as I can do with OCL? I had to write directly into the generated
> methods of class ElementInitializers after generation of the diagram
> editor.
Try setting GenJavaExpressionProvider.injectExpressionBody property to "true".

-----------------
Alex Shatalin
Re: Label with Feature Seq Initializer via OCL [message #212105 is a reply to message #212098] Tue, 25 November 2008 16:06 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Alex,

> Try setting GenJavaExpressionProvider.injectExpressionBody property to
> "true".
This should be done in .gmfgen model. In addition you have to enter java
code as a "body" property to the corresponding java expression in .gmfmap
model.

-----------------
Alex Shatalin
Re: Label with Feature Seq Initializer via OCL [message #212124 is a reply to message #212053] Tue, 25 November 2008 16:40 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Christian,

Thanks, Christian, - I've submitted request for it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=256461.

-----------------
Alex Shatalin
Re: Label with Feature Seq Initializer via OCL [message #212132 is a reply to message #212105] Tue, 25 November 2008 17:34 Go to previous message
Stephan Kleber is currently offline Stephan KleberFriend
Messages: 6
Registered: July 2009
Junior Member
Hallo Alex,

yes indeed. This did the trick.
Thank you very much.

Stephan

Alex Shatalin schrieb:
> Hello Alex,
>
>> Try setting GenJavaExpressionProvider.injectExpressionBody property to
>> "true".
> This should be done in .gmfgen model. In addition you have to enter java
> code as a "body" property to the corresponding java expression in
> .gmfmap model.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Error on pasting Connections
Next Topic:Empty properties view in editor when using a ecore model with subpackages
Goto Forum:
  


Current Time: Fri Apr 26 00:37:30 GMT 2024

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

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

Back to the top