Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » selectionChanged event not triggered after opening EditPart from TreeView
selectionChanged event not triggered after opening EditPart from TreeView [message #1709861] Thu, 01 October 2015 14:18 Go to next message
yev xxxxx is currently offline yev xxxxxFriend
Messages: 17
Registered: July 2014
Junior Member
I have a TreeView with some items, with a popup menu attached.

The menu is implemented by extending org.eclipse.jface.action.Action menu should open editpart.

class MenuItemAction extends Action implements ISelectionListener,IWorkbenchAction{
      ...
     public MenuItemAction (IWorkbenchWindow window){
       workbenchWindow = window;
       workbenchWindow .getSelectionService().addSelectionListener(this);
     }

     public void run() {
       ...
       IWorkbenchPage page = workbenchWindow.getActivePage();
       page.openEditor(...)
       ...
     }

     public void selectionChanged(IWorkbenchPart part, ISelection selection) {  
      ...
     }

}


My problem is as following:

When user clicks on menu items (without clicking on a popup), selectionChanged event is fired accordingly, but when he clicks on popup and editor is opened, then, when he tries to click on tree menu items, selectionChanged event is not triggered anymore.

The workaround is to move focus from treeview to some other part and then click on treeview again.
Re: selectionChanged event not triggered after opening EditPart from TreeView [message #1710117 is a reply to message #1709861] Sun, 04 October 2015 15:10 Go to previous message
yev xxxxx is currently offline yev xxxxxFriend
Messages: 17
Registered: July 2014
Junior Member
I believe the problem is that the SelectionSrvice(active part) is moved to editor and not staying in the viewpart.
I tried to set focus back to view part after opening the editor, but it didn't help.

The only workaroung that I could think of was obtain the selection of the viewpart (tree) directly , and I do it in run() method above.

 IViewPart part =workbenchWindow.getActivePage().findView("viewID");
 ISelection theSelection = part.getSite().getSelectionProvider().getSelection();


But I don't like such approach.

[Updated on: Sun, 04 October 2015 21:57]

Report message to a moderator

Previous Topic:TableViewer.setInput does not update the table
Next Topic:SWT Drop Target Problem on Linux
Goto Forum:
  


Current Time: Thu Mar 28 08:19:07 GMT 2024

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

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

Back to the top