Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Showing extra tree in navigator for my custom file types
Showing extra tree in navigator for my custom file types [message #500765] Sat, 28 November 2009 11:38 Go to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: November 2009
Junior Member
I am creating a custom project nature.

My project contains custom file types. Is it possible to make standard Project Explorer (or Package Explorer) show additional children for my custom file types? Something similar to what you get for *.java files. *.java files have a plus sign next to them and can be expanded and show the structure of the file content.

How can I do the same for my custom file type?

Thanks.
Re: Showing extra tree in navigator for my custom file types [message #500768 is a reply to message #500765] Sat, 28 November 2009 11:57 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
Yes, you can do this. Look at the documentation for the Common Navigator Framework (in the Platform Plugin Developers Guide).

Also the links in my signature.

You will essentially use the Navigator Content Extension point to point to a content provider class that will return the children of a resource, and those children can be your model objects.


Re: Showing extra tree in navigator for my custom file types [message #500770 is a reply to message #500768] Sat, 28 November 2009 12:11 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: November 2009
Junior Member
Thanks very much for quick reply.

I tried defining a navigatorContent this way:
  <extension
         point="org.eclipse.ui.navigator.navigatorContent">
         
      <navigatorContent 
            id="RIATest.navigator.propertiesContent" 
            name="Properties File Contents"
            contentProvider="riatest.navigator.PropertiesContentProvider"
            labelProvider="riatest.navigator.PropertiesLabelProvider" 
            activeByDefault="true"
            icon="img/logo16x16a.png"
            priority="highest" >
         <triggerPoints>
         	<or>
	            <and>
	               <test
	                     forcePluginActivation="true"
	                     property="org.eclipse.core.resources.extension"
	                     value="rtp"/>
	            </and>
			</or>
         </triggerPoints>
      </navigatorContent>
   </extension>


I expect that this will override content providing for any files that have rtp extension. This should change the icon and use riatest.navigator.PropertiesContentProvider. Am I correct?

Unfortunately nothing happens when I try the above. This has no effect.

What do I miss?
Re: Showing extra tree in navigator for my custom file types [message #500771 is a reply to message #500770] Sat, 28 November 2009 12:22 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: November 2009
Junior Member
UPDATE:

I added a viewerBinding like this:
   <extension
         point="org.eclipse.ui.navigator.viewer">
      <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
         <includes>
            <contentExtension pattern="RIATest.navigator.propertiesContent"/>
         </includes>
      </viewerContentBinding>
   </extension>


And now my content provider classes are properly called! Am I on the right track?

However there is still no custom icon Sad
Re: Showing extra tree in navigator for my custom file types [message #500784 is a reply to message #500771] Sat, 28 November 2009 17:15 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
Try changing "triggerPoints" to "enablement" in your navigator content extension.

And set a breakpoint in your label provider, is it being called?


Re: Showing extra tree in navigator for my custom file types [message #500900 is a reply to message #500784] Mon, 30 November 2009 08:42 Go to previous message
No real name is currently offline No real nameFriend
Messages: 4
Registered: November 2009
Junior Member
Yes, I have set breakpoints and can confirm that both label and content provider are being called and are effective (e.g. returning a different label works). I cannot see the custom icon though.

Thanks for the help. I will dig further and will post back if I need more help.
Previous Topic:Suppressing preference contributions
Next Topic:Maven ?
Goto Forum:
  


Current Time: Tue Mar 19 07:18:42 GMT 2024

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

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

Back to the top