简体   繁体   English

如何使用RCP在Eclipse插件开发中获取点击的对象

[英]How to get clicked object in eclipse plugin development using RCP

I am new to plugin development using eclipse with RCP and Java. 我是使用Eclipse与RCP和Java进行插件开发的新手。 I am developing a plugin for a email Client software. 我正在开发电子邮件客户端软件的插件。

I am trying to find users clicks on target platform, whether it is clicked on texts or hyperlinks using my plugin code. 我试图找到用户在目标平台上的点击,无论是使用我的插件代码点击文本还是超链接。

As of now, I am getting the clicked object as follows, 到目前为止,我得到的点击对象如下

    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                            .getActivePage().getActivePart()

    ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
                System.out.println(selection .toString());

But this shows only same thing for all the clicks even though it is text or links. 但这对所有点击都只显示相同的内容,即使它是文本或链接。

Can anyone assist here on how to differentiate these. 任何人都可以在这里协助如何区分这些。

Thanks in advance. 提前致谢。

The selection returned by the part selection provider gives you the selected object in whatever model the current part is using. 零件选择提供程序返回的选择为您提供了当前零件使用的任何模型中的所选对象。 So if the part is showing a list of files the selection might be the file. 因此,如果零件显示文件列表,则选择的可能是文件。

The selection does not tell you anything about the UI the part is using or what caused the selection to happen. 选择不会告诉您有关零件正在使用的UI或导致选择发生的原因的任何信息。

Eclipse does not provide a general API to determine what happened to cause the selection. Eclipse没有提供通用的API来确定发生什么导致选择。 Some individual parts may provide a specialized API but this is not common. 一些单独的部分可能会提供专门的API,但这并不常见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM