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: 56
Registered: January 2010
Location: Sydney
Member
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?
Regards,
Janusz
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);
return;

CommonViewer viewer = cn.getCommonViewer();
viewer.addSelectionChangedListener(_navSelectionListener);



Previous Topic:change text hover style
Next Topic:Can Project Explorer Filters actually hide things?
Goto Forum:
  


Current Time: Mon Dec 22 23:36:10 GMT 2014

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

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