Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » selectionchanged on CommonNavigator
selectionchanged on CommonNavigator [message #326802] Tue, 01 April 2008 14: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 16:03 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
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 09: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 09: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 15:20 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
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 10: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 14:44 Go to previous message
No real name is currently offline No real nameFriend
Messages: 113
Registered: July 2009
Senior Member
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: Thu Jun 27 20:18:11 GMT 2024

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

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

Back to the top