直接编辑 eclipse gef 中选定的标签

发布于 2024-12-04 09:42:50 字数 350 浏览 1 评论 0原文

我在一个图中有两个标签。默认情况下,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唐婉 2024-12-11 09:42:51

你可以尝试阅读这篇文章:直接编辑是主题之一
此外,是关于 GEF 开发的另一个有趣的资源

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

懵少女 2024-12-11 09:42:51

我从来没有这样做过,但我的猜测是,要么您必须为每个标签创建一个 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 :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文