Skip to main content


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 22:36
Eric Jain is currently offline Eric JainFriend
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: Thu Sep 26 22:45:10 GMT 2024

Powered by FUDForum. Page generated in 0.03105 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top