简体   繁体   中英

How to get clicked object in eclipse plugin development using RCP

I am new to plugin development using eclipse with RCP and 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.

Eclipse does not provide a general API to determine what happened to cause the selection. Some individual parts may provide a specialized API but this is not common.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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