检索 Eclipse GEF 中的选择点

发布于 2024-12-28 15:23:53 字数 327 浏览 4 评论 0原文

我有一个 Eclipse GEF 编辑器(从 Shapes 示例开始),其中包含二元组编辑部分(扩展 AbstractGraphicalEditPart)。我正在实现将对象从编辑器实例复制粘贴到编辑器实例。

在粘贴操作(扩展SelectionAction并实现ISelectionChangedListener)中,是否可以确定选择点?

仅当有人单击图表图形的开放区域后,才会启用“粘贴”操作。粘贴操作收到“selectionChanged(SelectionChangedEvent event)”回调,但我无法从 event.source 中找出用户单击的位置......

有任何线索吗?

I have an Eclipse GEF editor (started with the Shapes example) that includes a digram edit part (extends AbstractGraphicalEditPart). I'm implementing copy n paste of objects from editor instance to editor instance.

In the paste action (which extends SelectionAction and implements ISelectionChangedListener), is it possible to determine the point of selection?

The 'paste' action is only enabled after someone clicks in an open area of the diagram figure. The paste action receives a 'selectionChanged(SelectionChangedEvent event)' callback but I can't figure out from the event.source where the user clicked....

Any clues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

野心澎湃 2025-01-04 15:23:53

仅当存在活动编辑器时(单击编辑器后),操作才处于活动状态是合乎逻辑的,但我认为不可能获取鼠标单击的位置。从事件中,您可以提取模型中被选择的元素,但不能提取特定位置。

您可以通过监听draw2d屋顶图形并始终存储用户最后一次单击的位置来解决这个问题——开销很小,但可以解决问题。

It is logical for the action to be active only when there is an active editor (after a click on it), but I don't think it is possible to get the location of the mouse click. From the event you can extract what elements of your model are selected, but not a specific location.

You could work around this by listening to your draw2d roof figure, and always storing the location of the user's last click - small overhead, but would solve the problem.

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