java - how to migrate the selection provider in e4 -
I am migrating eclips views to use the e4 framework, we currently use Compatibility Mode In use.
In most of the scenes I am setting up a site selection provider:
site.setSelectionProvider (tree viewer);
In different handlers, I use the code to select:
IWorkbench Site site = handlerUtil.getActiveSite (event); ISelectionProvider selection provider = site.getSelectionProvider (); Select Selection = Selection Provider .get ();
Some handlers also use the select provider and if this viewer works with it eg. Context, Expand ...
ISelectionProvider SelectionProvider = ActiveSite. Setting Selection Provider (); If (structured viewer for example of selection provider) {...}
Wiki explains how to handle new selections in E4.
In an E4 handler you use something like this:
@Execute void execute (@ nominated (IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection {...}
to get active selection.
< P> If you want to see the active part you can use it: @Execute void execute (@ named (IServiceConstants.ACTIVE_PART) MP art activePart) {object = activePart.getObject ( ); // 'Object' is the class that you defined for part in Application.e4xmi}
Comments
Post a Comment