Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Changing a label to a dropdown menu
Changing a label to a dropdown menu [message #217185] Wed, 04 February 2009 08:26 Go to next message
Anna is currently offline AnnaFriend
Messages: 34
Registered: July 2009
Member
In my editor, used to draw statechart-diagrams, I have nodes (states) and
edges (transitions). Both nodes and edges are equipped with one or more
labels for names, events and so on. In the first stage, a label is only a
text field where the user him/herself can input any information he/she
wants to. Now, I want to change this to a dropdown menu, containing a set
of predefined names to choose from, but I don't know where I'm supposed to
do this. So, my question is; where is the type of the label defined? Where
in the code is it set to be a text field?

Thanks,
Anna
Re: Changing a label to a dropdown menu [message #217194 is a reply to message #217185] Wed, 04 February 2009 11:01 Go to previous messageGo to next message
Christian Muth is currently offline Christian MuthFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Anna,


> In my editor, used to draw statechart-diagrams, I have nodes (states) and
> edges (transitions). Both nodes and edges are equipped with one or more
> labels for names, events and so on. In the first stage, a label is only a
> text field where the user him/herself can input any information he/she
> wants to. Now, I want to change this to a dropdown menu, containing a set
> of predefined names to choose from, but I don't know where I'm supposed to
> do this. So, my question is; where is the type of the label defined? Where
> in the code is it set to be a text field?

These labels are of type WrappingLabel:
http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/runtime/org/eclipse/gmf/runtime/draw2d /ui/figures/WrappingLabel.html

WrappingLabel is used to draw the decorating icon along with the text (if
ElementIcon is set to true in gmfgraph Diagram Label definition).
So maybe a place to start would be creating a custom figure by subclassing
WrappingLabel.

You should also have a look at the EditPolicies for your model's Labels:
<model name>TextNonResizableEditPolicy
and
<model name>TextSelectionEditPolicy
which would imho be the place to enable the dropdown menu.

HTH

Christian
Re: Changing a label to a dropdown menu [message #217391 is a reply to message #217194] Thu, 05 February 2009 14:41 Go to previous message
Anna is currently offline AnnaFriend
Messages: 34
Registered: July 2009
Member
> These labels are of type WrappingLabel:
>
http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/runtime/org/eclipse/gmf/runtime/draw2d /ui/figures/WrappingLabel.html

> WrappingLabel is used to draw the decorating icon along with the text (if
> ElementIcon is set to true in gmfgraph Diagram Label definition).
> So maybe a place to start would be creating a custom figure by subclassing
> WrappingLabel.

Just one more question before I start digging: I don't use the decorating
icon in my diagram...is this still the place where I should look? Because
as far as I've understood (which might be wrong :)), the icon and the text
field aren't "one piece"? Don't I want to manipulate the text field rather
than the icon? Or is that not possible?

/Anna
Previous Topic:Problem creating link from derived class
Next Topic:Ocl question- check string is an integer similar to Integer.parseInt(myString)?
Goto Forum:
  


Current Time: Fri Mar 05 08:33:30 GMT 2021

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

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

Back to the top