[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Changing a label to a dropdown menu

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