Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Strange SelectionService behaviour
Strange SelectionService behaviour [message #754857] Fri, 04 November 2011 16:27 Go to next message
Florian Wieland is currently offline Florian WielandFriend
Messages: 6
Registered: April 2011
Junior Member
Hello,

I am encountering a strange behaviour of the selection service in my eclipse view/editor. The following code ist taken from my comand handler to open an editor when double clicking in the treeviewer of my view.
//getSelection via SelectionService
IWorkbenchWindow w =  HandlerUtil.getActiveWorkbenchWindow(event);
ISelectionService sels = w.getSelectionService();
ISelection s =  sels.getSelection();
if (s!=null && !s.isEmpty() && s instanceof IStructuredSelection && ((IStructuredSelection)s).getFirstElement() instanceof Event){
...
}


An here comes the funny thing: "s" is sometimes null after processing the line. To doubleclick and open the first editor works always fine. To open a second editor via another double click results in "s" beeing null. When I start the debugger and set a breakpoint befor the "if", everything works fine. When I do the same thing without breakpoint even in the debugger mode the selection service returns null again.

Is there annyone out there with an idea to help me?

Greetings Florian
Re: Strange SelectionService behaviour [message #756821 is a reply to message #754857] Tue, 15 November 2011 09:43 Go to previous message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 250
Registered: July 2009
Location: Graz, Austria
Senior Member
have you tried using

HandlerUtil.getCurrentSelection(event);


to get your selection?
Previous Topic:How to add PHP development to Eclipse already setup for Java & Androkd?
Next Topic:Eclipse 3.7 Export Wizard problems
Goto Forum:
  


Current Time: Thu Mar 28 12:07:03 GMT 2024

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

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

Back to the top