Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » selectionchanged on CommonNavigator
selectionchanged on CommonNavigator [message #326802] Tue, 01 April 2008 10:26 Go to next message
Eclipse UserFriend
Originally posted by: colin.ninian-owen.com

I need to call my own action every time a project is selected in the navigator view - in-fact my own view extended from CommonNavigator. Can someone please suggest the best approach?
Re: selectionchanged on CommonNavigator [message #326813 is a reply to message #326802] Tue, 01 April 2008 12:03 Go to previous messageGo to next message
Eclipse UserFriend
You can register a selection changed listener on the CommonViewer that's
associated with the CommonNavigator.

Just call getCommonViewer() on the CN.

colin wrote:
> I need to call my own action every time a project is selected in the navigator view - in-fact my own view extended from CommonNavigator. Can someone please suggest the best approach?
Re: selectionchanged on CommonNavigator [message #326859 is a reply to message #326813] Wed, 02 April 2008 05:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: colin.ninian-owen.com

I suppose then I would need to sub-class CommonNavigator (myNavigator->CommonNavigator) and reference that from my viewer extension instead...

<extension
point="org.eclipse.ui.views">
<view
class="myNavigator"
etc../>
</extension>

then I can register the selection changed listener in the constructor? The Eclipse documentation says CommonNavigator is not intended to be sub-classed!

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/ui/navigator/Comm onNavigator.html
Re: selectionchanged on CommonNavigator [message #326861 is a reply to message #326802] Wed, 02 April 2008 05:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: colin.ninian-owen.com

Sorry, I notice the syntax of the xml and url to CommonNavigator didnt post correctly - but you get my drift!
Re: selectionchanged on CommonNavigator [message #326883 is a reply to message #326859] Wed, 02 April 2008 11:20 Go to previous messageGo to next message
Eclipse UserFriend
no you don't need to subclass the CN, just get the viewer by calling
getCommonViewer() on the CN once it has been created.

(no worries with your XML, I get the idea)

colin wrote:
> I suppose then I would need to sub-class CommonNavigator (myNavigator->CommonNavigator) and reference that from my viewer extension instead...
>
> <extension
> point="org.eclipse.ui.views">
> <view
> class="myNavigator"
> etc../>
> </extension>
>
> then I can register the selection changed listener in the constructor? The Eclipse documentation says CommonNavigator is not intended to be sub-classed!
>
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/ui/navigator/Comm onNavigator.html
Re: selectionchanged on CommonNavigator [message #326997 is a reply to message #326883] Fri, 04 April 2008 06:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: colin.ninian-owen.com

Thanks for the info. but how do I get the CommonNavigator instance?
Re: selectionchanged on CommonNavigator [message #327027 is a reply to message #326997] Sun, 06 April 2008 10:44 Go to previous message
Eclipse UserFriend
You can obtain it by looking into the workbench the workbench window and
obtain the view by the name you gave it or its default name. The CN is
actually a view part. Once you obtain the view, cast it to get the the
getCommonViewer method.

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView( "yourCNFViewName")


This works from nearly anywhere in the application. If the CN is always
around, stick it into a singleton that you know where to find easily but
I always dynamically get it.



colin wrote:
> Thanks for the info. but how do I get the CommonNavigator instance?
Previous Topic:Common Navigator for Workbench Resources - Refreshing View
Next Topic:Terminate paused console output of a batch file called as external tool
Goto Forum:
  


Current Time: Sun Mar 16 19:38:30 EDT 2025

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

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

Back to the top