直接编辑 eclipse gef 中选定的标签
我在一个图中有两个标签。默认情况下,gef 允许在用户单击编辑部分时执行直接编辑。我在同一个图中有两个标签,我必须对单击鼠标的标签执行直接编辑。但现在当我单击时,两个标签都显示以供直接编辑?
我已经放置了编码
@Override
public void performRequest( final Request req )
{
if( req.getType().equals( RequestConstants.REQ_OPEN ) || req.getType().equals( RequestConstants.REQ_DIRECT_EDIT ) )
{
perform directedi()
}
}
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()
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试阅读这篇文章:直接编辑是主题之一
此外,这是关于 GEF 开发的另一个有趣的资源
you can try to read this article: direct edit is one of the topics
Moreover this is another intresting resource about gef development
我从来没有这样做过,但我的猜测是,要么您必须为每个标签创建一个 editpart,然后每个 editpart 将收到 REQ_DIRECT 请求,要么您可以直接将一个draw2d侦听器插入到标签并创建更具体的请求。
第一个选项可以通过从包含的图二模型子项返回来实现,您可以将其存储在父项中。工厂应该能够识别它们并创建一个新的编辑部分,该部分又创建一个仅包含标签并安装直接编辑策略的图形
我不知道如何实施第二个解决方案:-)
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 :-)