Common Navigator showing expanded folders [message #334395] |
Fri, 06 February 2009 12:13  |
Eclipse User |
|
|
|
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 00:42   |
Eclipse User |
|
|
|
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 #334479 is a reply to message #334463] |
Wed, 11 February 2009 18:53  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.05987 seconds