Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Common Navigator showing expanded folders
Common Navigator showing expanded folders [message #334395] Fri, 06 February 2009 17:13 Go to next message
Mark Lovell is currently offline Mark LovellFriend
Messages: 13
Registered: July 2009
Junior Member
I am contributing to a common navigator from my plugin.xml

I would like to show different icons for an open "folder" and closed
"folder". By "folder" I mean things that have children as specified in the
content provider.

In the navigatorContent, I specify a labelProvider.

I thought that in my label provider's getImage() I could to check the
expanded state of the tree.

However, the label provider does not know about the tree that it is
connected to.

If I programmatically instanciate the label provider, I can pass the tree
to the constructor, however, when I am configuring it from the plugin.xml,
I assume the default constructor (i.e. no parameters) is used and so I
cannot pass in the tree.

Question: How do I show a different icon for open and closed folders, when
contributing to a common navigator using the plugin.xml file?

Thank you for your help
Re: Common Navigator showing expanded folders [message #334412 is a reply to message #334395] Sat, 07 February 2009 05:42 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 get the CommonViewer from the CommonNavigator.getCommonViewer().
This is a normal JFace TreeViewer, from there you can get to the tree.

You can get your CommonNavigator instance by view Id if necessary.

HTH,

Francis

Mark Lovell wrote:
> I am contributing to a common navigator from my plugin.xml
>
> I would like to show different icons for an open "folder" and closed
> "folder". By "folder" I mean things that have children as specified in
> the content provider.
>
> In the navigatorContent, I specify a labelProvider.
>
> I thought that in my label provider's getImage() I could to check the
> expanded state of the tree.
> However, the label provider does not know about the tree that it is
> connected to.
>
> If I programmatically instanciate the label provider, I can pass the
> tree to the constructor, however, when I am configuring it from the
> plugin.xml, I assume the default constructor (i.e. no parameters) is
> used and so I cannot pass in the tree.
>
> Question: How do I show a different icon for open and closed folders,
> when contributing to a common navigator using the plugin.xml file?
>
> Thank you for your help
>
>


--
Common Navigator Framework section in Platform Plugin Developer Guide
(Programmer's Guide)

http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm

http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Re: Common Navigator showing expanded folders [message #334463 is a reply to message #334412] Tue, 10 February 2009 17:49 Go to previous messageGo to next message
Mark Lovell is currently offline Mark LovellFriend
Messages: 13
Registered: July 2009
Junior Member
I am getting closer...

I tried
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView(viewID);

But under certain conditions I get
org.eclipse.ui.PartInitException: Warning: Detected recursive attempt by
part <my navigator view> to create itself (this is probably, but not
necessarily, a bug)

This happens when my navigator is behind another view (but I can see the
tab) when I click the tab to bring the view to the surface, I get this
error.

It appears that findView does more than simply return a pointer.

I can do it by calling getViewReferences(), iterating and getting the one
whose id matches the common navigator. But there should be a better way.

So.... Is there another way to just get a pointer to the view? It is kind
of unfortunate that I have to get the common navigator from the view id,
because it is exactly the common navigator that is calling my label
provider.


Help?
Re: Common Navigator showing expanded folders [message #334479 is a reply to message #334463] Wed, 11 February 2009 23:53 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Try this:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findViewReference().getView(false)

This gets the part only if it has been actually created, so you should
not get those errors of it being in the middle of creation.

Mark Lovell wrote:
> I am getting closer...
>
> I tried
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView(viewID);
>
>
> But under certain conditions I get org.eclipse.ui.PartInitException:
> Warning: Detected recursive attempt by part <my navigator view> to
> create itself (this is probably, but not necessarily, a bug)
>
> This happens when my navigator is behind another view (but I can see the
> tab) when I click the tab to bring the view to the surface, I get this
> error.
>
> It appears that findView does more than simply return a pointer.
>
> I can do it by calling getViewReferences(), iterating and getting the
> one whose id matches the common navigator. But there should be a better
> way.
>
> So.... Is there another way to just get a pointer to the view? It is
> kind of unfortunate that I have to get the common navigator from the
> view id, because it is exactly the common navigator that is calling my
> label provider.
>
>
> Help?
>
>
>
>


--
Common Navigator Framework section in Platform Plugin Developer Guide
(Programmer's Guide)

http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm

http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Previous Topic:ant editor freezes in 3.4.1 (M20080911-1700)
Next Topic:Indention when using images in TreeViewer
Goto Forum:
  


Current Time: Thu Dec 26 20:01:36 GMT 2024

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

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

Back to the top