开发者

TextBox inside eclipse's draw2d figure

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜