Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Getting wrong selection, sometimes
Getting wrong selection, sometimes [message #336568] Tue, 23 June 2009 18:36
Eric Jain is currently offline Eric Jain
Messages: 266
Registered: July 2009
Senior Member
I have simple view that consists of a TableViewer with the following
double-click listener:

IHandlerService handlerService = (IHandlerService)
getSite().getService(IHandlerService.class);
handlerService.executeCommand(TestHandler.ID, null);

The handler is registered in the plugin.xml and contains the following
code:

public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPage page = HandlerUtil
.getActiveWorkbenchWindow(event).getActivePage();
ISelection = page.getActivePart().getSite()
.getSelectionProvider().getSelection();
...
}

This works fine most of the time. But sometimes the ISelection ends up
being a reference to the IEditorInput of an open editor, rather than the
selection in the view! So it seems that double-clicking an element in a
view does not make the view active immediately. Bug? Or is there a way
right now to write this code without requiring the handlers to store the
part ID of the view explicitly?
Previous Topic:something better than java.lang.Runtime.exec()
Next Topic:EditorPart.init() question
Goto Forum:
  


Current Time: Sat Apr 19 05:54:39 EDT 2014

Powered by FUDForum. Page generated in 0.02815 seconds