Eclipse 中有 Activity 编辑器或最顶层编辑器的概念吗?
我编写了一个 View ,希望它显示有关 Activity 编辑器的一些数据。
目前我正在使用选择服务,而编辑器正在提供选择信息。不幸的是,这样我就无法区分编辑器是否被取消选择或关闭。因此,即使在关闭后,我也会显示最后选择的编辑器信息。
最佳答案
使用 IPartListener
(或 IPartListener2
)来了解 Activity 部件的所有更改。
IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
service.addPartListener(listener);
IPartService
还有一个 getActivePart()
方法 - Activity 部分可以是 View 也可以是编辑器。
以上假设是 Eclipse 3.x 风格的 RCP,Eclipse e4 有所不同。
关于java - 如何在 Eclipse RCP 中监听/确定 Activity/最顶层编辑器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21731072/