Changing a label to a dropdown menu [message #217185] |
Wed, 04 February 2009 08:26 |
Anna 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 |
Christian Muth 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.01933 seconds