Is there any way to include a Text开发者_如何学Python Box inside a draw2d figure? (a code example would be nice)
Not easily, and if you're just using Draw2d without GEF, then I don't think it's possible.
With GEF, you can make use of a DirectEditManager
in an Edit Part, and create an Edit Policy (extending DirectEditPolicy
, installed with the key EditPolicy.DIRECT_EDIT_ROLE
) to allow a direct edit to be performed on a figure.
You could create a figure which extends Label
that is styled to look like a text box, and activate (by overriding performRequest
in the Edit Part) editing upon selection.
This Schema Diagram example contains this type of functionality (and more importantly, the code!), although the figure used for edit (EditableLabel
) isn't styled to look like a text box, and the activation itself is on double-click rather than selection.
It may point you in the right direction though.
精彩评论