Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to detect node selection change in CN inside Editor(How to detect node selection change in CN inside Editor)
How to detect node selection change in CN inside Editor [message #550478] Fri, 30 July 2010 13:55 Go to next message
Janusz Dalecki is currently offline Janusz DaleckiFriend
Messages: 60
Registered: January 2010
Location: Sydney
Hi Everybody,
Is there a way to listen in my EditorPart derived class to selection change of the nodes of CommonNavigator which is my viewer I know there must be something like this but I have spent hours on internet looking for it without any result. Can somebody please point me into right direction?
Re: How to detect node selection change in CN inside Editor [message #552287 is a reply to message #550478] Wed, 11 August 2010 15:14 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Sure, get a pointer to the CN part, get the viewer, and add an ISelectionChangedListener to the viewer. Don't forget to remove it or you will have a memory leak:

// Used when the navigator selection changes
_navSelectionListener = new ISelectionChangedListener()
public void selectionChanged(SelectionChangedEvent event)
// react

IViewReference ref = getWorkbenchPage()
.findViewReference("CNF view id");

CommonNavigator cn = (CommonNavigator)ref.getPart(false);

CommonViewer viewer = cn.getCommonViewer();

Previous Topic:Eclipse flags ALL XML tags as invalid.
Next Topic:FormText lacks a getter for the text
Goto Forum:

Current Time: Thu Apr 26 17:44:41 GMT 2018

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

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