Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Create TreeViewer using Workspace Content
icon5.gif  Create TreeViewer using Workspace Content [message #989063] Tue, 04 December 2012 08:47 Go to next message
Eclipse UserFriend
How can i set the content of TreeViewer, using informations from a workspace?

Load files, projects and etc from the workspace on the treeviewer?

Thanks
Re: Create TreeViewer using Workspace Content [message #989141 is a reply to message #989063] Tue, 04 December 2012 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Get the workspace root:
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();


Get the projects:
IProject [] projects = root.getProjects()
viewer.setInput(projects)


Create your viewer, content provider, and label provider. You can set the input to the viewer as the array of projects or the workspace root.

Your content/label provider will need to use instanceof to determine the type of object you are currently working with, cast it, then return the respective property value.

You could also check out the common navigator framework.

[Updated on: Tue, 04 December 2012 14:16] by Moderator

Re: Create TreeViewer using Workspace Content [message #989347 is a reply to message #989063] Wed, 05 December 2012 13:38 Go to previous messageGo to next message
Eclipse UserFriend
And how can I select a workspace and create custom projects for my RCP application? Thank you.
Re: Create TreeViewer using Workspace Content [message #989798 is a reply to message #989347] Fri, 07 December 2012 15:53 Go to previous message
Eclipse UserFriend
You will need to add the resources bundle to the project's dependencies list. As well to the launch configuration, along with it's dependencies.

You can get the workspace location by calling:
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
root.getLocation()


In RCP, you can get the default location by calling:
Platform.getLocation() or Platform.getInstanceLocation().


You can change the default location by specifying the -data or osgi.instance.area system propery.

Happy hunting.
Previous Topic:Can we compare two jface treeviewers model data using org.eclipse.compare
Next Topic:Contributed adapter not available
Goto Forum:
  


Current Time: Wed Jul 23 08:18:47 EDT 2025

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

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

Back to the top