开发者

Direct edit on selected label in eclipse gef

开发者 https://www.devze.com 2023-04-04 05:31 出处:网络
I have two labels in an figure . by default gef allows direct editing to be performed when the user clicks the edit part. I have two labels in the same figure i have开发者_如何转开发 to perform direct

I have two labels in an figure . by default gef allows direct editing to be performed when the user clicks the edit part. I have two labels in the same figure i have开发者_如何转开发 to perform direct editing on the label on which the mouse was clicked . but now when i click both the labels are displaying for direct edit ?

i have placed the coding

@Override
public void performRequest( final Request req )
{

if( req.getType().equals( RequestConstants.REQ_OPEN ) || req.getType().equals( RequestConstants.REQ_DIRECT_EDIT ) )
{

perform directedi()
} 
}


you can try to read this article: direct edit is one of the topics Moreover this is another intresting resource about gef development


I've never done it, but my guess is that either you have to either create an editpart for each label and then each editpart will get the REQ_DIRECT request, or you can plug directly a draw2d listener to the label and create more specific requests. The first option can be implemented by returning from the containing figure two model children that you can probably store at the parent. The factory should be able go identify them and create a new edit part which in turn creates a figure that only contains a label and which installs the direct edit policy I don't know how to implement the second solution :-)

0

精彩评论

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