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 09:55 Go to next message
Janusz Dalecki is currently offline Janusz Dalecki
Messages: 55
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 11:14 Go to previous message
Francis Upton IV is currently offline Francis Upton IV
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: Fri Aug 22 03:59:54 EDT 2014

Powered by FUDForum. Page generated in 0.04831 seconds