Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to properly "customize" a commonNavigator !!
How to properly "customize" a commonNavigator !! [message #540731] Thu, 17 June 2010 08:16 Go to next message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
I'm a beginner with Eclipse RCP and what I would like to do is to use the eclipse commonNavigator with a custom initial input.

So as explained in the forum I overrides the getInitialInput() method and provided my own content provider.

What I want is simple. I created three folders and I want to display in one of these folder all the existing projects from my workspace.

I've been searching for how to do that but I couldn't find it.

I know that I can display the workspace content with
Workspace workspace = ResourcesPlugin.getWorkspace();
return workspace.getRoot();


as an in initial input but I want to do that in a folder created in my content provider.
I'm sure i'ts really basic but I'm stuck on this and I really need help to find the good way to do that.

Thanks for the help.

Romain
Re: How to properly "customize" a commonNavigator !! [message #540735 is a reply to message #540731] Thu, 17 June 2010 08:30 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 will need to create your own model objects that the CNF can use to make the folders.

So create some root object, and then have a navigator content extension (NCE) reference that object as a trigger point and provide a content provider that returns your desired folders.

This root object is your initial input (that you specify when you override the CommonNavigator class).

For the folder where you want the workspace to occur, you will need another NCE to recognize that folder, and it specifies a content provider that returns the IProject objects (children of the IWorkspaceRoot).

HTH,

Francis


Re: How to properly "customize" a commonNavigator !! [message #540742 is a reply to message #540731] Thu, 17 June 2010 08:47 Go to previous messageGo to next message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
Many thanks for the really quick reply..

Could you be a little bit more specific about the last point :
For the folder where you want the workspace to occur, you will need another NCE to recognize that folder, and it specifies a content provider that returns the IProject objects (children of the IWorkspaceRoot).

Or could you give me an example because I didn't get it.

Should i create an other NCE and reference the folder(Object) as a trigger point ??

Cheers.
Romain

Re: How to properly "customize" a commonNavigator !! [message #540755 is a reply to message #540742] Thu, 17 June 2010 09:24 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
I don't think we have an example anywhere that I know of.

The key is you need to have your objects be recognizable through the triggerPoint expressions; one easy way to do this is use the class name of the object to trigger something.

So you can form a tree

RootClass
FolderClass (folder1)
FolderClass (folder2)
FolderHoldingProjectsClass (folder3)
IProject
IProject

So you can have a triggerPoint that recognizes FolgerHoldingProjectsClass and specifies a content provider that provides the IProject objects.

Just the same as your root triggerPoint specifies a content provider that provides the objects implementing FolderClass and FolderHoldingProjectsClass.

Does that make it more clear?


Re: How to properly "customize" a commonNavigator !! [message #540766 is a reply to message #540755] Thu, 17 June 2010 09:52 Go to previous messageGo to next message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
Yes it does.. I'm going to try in that way

Thanks a lot.
Romain
Re: How to properly "customize" a commonNavigator !! [message #540775 is a reply to message #540731] Thu, 17 June 2010 11:07 Go to previous messageGo to next message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
Ok it works and it's an easy understanding solution !!

I can display all my projects in the right folder....
with ResourcesPlugin.getWorkspace().getRoot().getProjects();
But it is normal that it displays the list of projects but not the content of them and not the icons corresponding of projects nature ??

Thanks.

Re: How to properly "customize" a commonNavigator !! [message #540837 is a reply to message #540775] Thu, 17 June 2010 13:09 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
Romain wrote on Thu, 17 June 2010 04:07
Ok it works and it's an easy understanding solution !!

I can display all my projects in the right folder....
with ResourcesPlugin.getWorkspace().getRoot().getProjects();
But it is normal that it displays the list of projects but not the content of them and not the icons corresponding of projects nature ??

Thanks.




Yes, because you are likely not using the NCEs from the org.eclipse.ui.navigator.resources plugin (which provides the Project Explorer). The PE is an implementation of the CN that has all of the resource stuff.

If you look at the documentation (see the link in my signature) I think it shows you how to pull these NCEs into your configuration. You can also look at the plugin.xml in the above plugin for how it does it.

However because your root is different than the root of the project explorer (which is the workspace root), I'm not certain that all of the project explorer NCEs will work correctly. Give it a try.


Re: How to properly "customize" a commonNavigator !! [message #541053 is a reply to message #540837] Fri, 18 June 2010 08:02 Go to previous messageGo to next message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
Hi Francis,

No it works pretty well actually because I'm using virtual folders to hold my projects.

I just have a problem of refresh when I create a new project or new elements in a project. I have to force do the refresh manually. I'm going to look at it.

Thanks a lot. Your help was really usefull.
Re: How to properly "customize" a commonNavigator !! [message #541131 is a reply to message #540731] Fri, 18 June 2010 12:51 Go to previous message
Romain  is currently offline Romain Friend
Messages: 8
Registered: June 2010
Junior Member
I've got another "basic" question.

Is it possible to easily get projects from another location than the workspace.

What I want to do is :

- All my projects from workspace in the folder ProjectsFromWorspace
- Other projects from an other location in the folder ProjecsFromLibrary

I know that I can't have two workspace in the same time and if a workspace is already set I can't release it.

But is there a way to do what I want or something close to it?

Thanks.
Previous Topic:How to Refresh a GUI (FormPage)?
Next Topic:Splash screen for P2-enabled RCP
Goto Forum:
  


Current Time: Fri Apr 19 13:19:27 GMT 2024

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

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

Back to the top