Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to use New Element Spec in a Feature Seq Initializer
How to use New Element Spec in a Feature Seq Initializer [message #171010] Fri, 01 February 2008 04:37 Go to next message
Eclipse UserFriend
Hello

I am trying to create a node (called Switch) with 3 ports. I think I
have got the graphics and the domain model right.

However, I would like the 3 ports to be created automatically when I
create a new Switch node. So I guessed that this is something that can
be done using a Feature Initializer.

So in the Node Mapping for Switch I added a Feature Seq Initializer. To
this I added 3 Reference New Element Specs for the contained type of the
ports. At this point validation fails, complaining that the feature
newElementInitializers must have at least 1 value.

Now I do not know what to do. For the New Element Specs I can add a
Feature Seq Initializer, but I have no clue how to use this to say that
I want to create a new element of the port type.

Ideally I would like to achieve the needed functionality without adding
any Java code. Is this possible?


Regards


Tor
Re: How to use New Element Spec in a Feature Seq Initializer [message #171055 is a reply to message #171010] Fri, 01 February 2008 06:10 Go to previous messageGo to next message
Eclipse UserFriend
Hello Tor,

> Now I do not know what to do. For the New Element Specs I can add a
> Feature Seq Initializer, but I have no clue how to use this to say
> that I want to create a new element of the port type.
Feature Seq Initializer element has Element Class property i suppose this
property should be set to PortType in your case.

-----------------
Alex Shatalin
Re: How to use New Element Spec in a Feature Seq Initializer [message #171076 is a reply to message #171055] Fri, 01 February 2008 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the prompt reply

Adding a FeatureSeqInitializer with a sub FeatureValueSpec worked.

Now I get 3 PortType instances in the model, albeit only one of them
show up in the diagram



Tor

Alex Shatalin wrote:
> Hello Tor,
>
>> Now I do not know what to do. For the New Element Specs I can add a
>> Feature Seq Initializer, but I have no clue how to use this to say
>> that I want to create a new element of the port type.
> Feature Seq Initializer element has Element Class property i suppose
> this property should be set to PortType in your case.
>
> -----------------
> Alex Shatalin
>
>
Re: How to use New Element Spec in a Feature Seq Initializer [message #171122 is a reply to message #171076] Fri, 01 February 2008 08:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ali.akar.geensys.com

hello,

look at the logic example, I think you found something that can help
you. Look how to create an halfAdder, they add Terminals by a
getConfigureCommand.

I think if you Create a specilization type for your node(swith) you can
acheive your goal by configuring the swith once its created !!



Tor Neple a écrit :
> Thanks for the prompt reply
>
> Adding a FeatureSeqInitializer with a sub FeatureValueSpec worked.
>
> Now I get 3 PortType instances in the model, albeit only one of them
> show up in the diagram
>
>
>
> Tor
>
> Alex Shatalin wrote:
>> Hello Tor,
>>
>>> Now I do not know what to do. For the New Element Specs I can add a
>>> Feature Seq Initializer, but I have no clue how to use this to say
>>> that I want to create a new element of the port type.
>> Feature Seq Initializer element has Element Class property i suppose
>> this property should be set to PortType in your case.
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: How to use New Element Spec in a Feature Seq Initializer [message #171167 is a reply to message #171076] Fri, 01 February 2008 10:32 Go to previous messageGo to next message
Eclipse UserFriend
Hello Tor,

Actually Feature Sequence initializer was designed for the creation of domain
model parts. The rest should be done by diagram updater in contrast to normal
element creation via toolbar tool - in this case both domain model structure
and corresponding visual elements will be created explicitly.

Anyway, try pressing F5 with diagram/main diagram element selected. If this
helps you can try calling update from the corresponding place in the code.

-----------------
Alex Shatalin
Re: How to use New Element Spec in a Feature Seq Initializer [message #171249 is a reply to message #171167] Fri, 01 February 2008 18:58 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alex

I found that my issue was related to this:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg09194.html

I worked around it, so now all three ports show up.

However, only one of them show up at the place I want. The one with
Affixed Parent Side = WEST shows to the left of the figure whilst the
two others (Affixed Parent Side = EAST) show up below. So are my skills
of compasses totally of, or do the NORTH, WEST, EAST, SOUTH values refer
to something else than what side the port node should "stick" to.

BTW: is there any way of setting more precisely where on the edge to put
the port node? For instance one on the top of the right side and one on
the bottom.

Thanks for all of the help!


Regards


Tor

Alex Shatalin wrote:
> Hello Tor,
>
> Actually Feature Sequence initializer was designed for the creation of
> domain model parts. The rest should be done by diagram updater in
> contrast to normal element creation via toolbar tool - in this case both
> domain model structure and corresponding visual elements will be created
> explicitly.
>
> Anyway, try pressing F5 with diagram/main diagram element selected. If
> this helps you can try calling update from the corresponding place in
> the code.
>
> -----------------
> Alex Shatalin
>
>
Re: How to use New Element Spec in a Feature Seq Initializer [message #171325 is a reply to message #171249] Mon, 04 February 2008 10:09 Go to previous message
Eclipse UserFriend
Hello Tor,

You can try to find the reason by debugging org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator
class.

-----------------
Alex Shatalin
Previous Topic:Context menu, connection between two items
Next Topic:Taipan example and GMF
Goto Forum:
  


Current Time: Tue Jul 22 14:50:35 EDT 2025

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

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

Back to the top