Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Creating a tree....not from root
Creating a tree....not from root [message #457145] Sun, 19 June 2005 00:38 Go to next message
Marko is currently offline MarkoFriend
Messages: 1
Registered: July 2009
Junior Member
I'm looking through the list of plugins looking for the code that is used
to create the "Navigator" view, but I can't seem to find it. I'm trying
to create a view (plugin) that shows a tree structure...just like in the
Navigator view. I have found several examples on the internet and in
books...and I have implemented them, but all of these examples are either
trees in which the nodes are manually specified (i.e. Parent1 - Child1 -
Leaf1....etc), and the other examples are trees which start from the roots
(i.e. C:/, D:/, etc).

I want to create a tree which will show the folder structure starting from
a specified location (C:/eclipse/workbench/MyFolder) rather than from the
root. It seems that this is how the package explorer creates its tree
structure, so I'm trying to find the code for the navigator view to get an
idea of how to do what I'm trying to do, or any code that will help me
accomplish this for that matter.

I hope I'm posting this in the right group. Thanks for any help.
Re: Creating a tree....not from root [message #457153 is a reply to message #457145] Mon, 20 June 2005 07:47 Go to previous message
Philipp is currently offline PhilippFriend
Messages: 49
Registered: July 2009
Member
This is a multipart message in MIME format.
--=_alternative 002AD507C1257026_=
Content-Type: text/plain; charset="US-ASCII"

Hey Marko,

The navigator uses a treeviewer. If you are not familiar with tree viewers
have a look here first
http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArti cle.htm
The treeviewer can display a hierarchical structure using a content
provider. The input model for the navigator view is an instance of
IWorkspace.

For your case: If you want to display a folder structure that is located
in your workspace you can use the eclipse resource model as input model.
You would feed your treeviewer with the IResource you want to start from
(the folder or project). Your content provider would need to know how to
retrieve the children of a folder or project. Thats all.

If the folder structure you want to display is not located in your
workspace (or not part of it). You would have to build up a model yourself
containing the folder structure and than implement a content provider that
can handle that model.

If you still want to have a look at the navigator implementation look at
org.eclipse.ui.views.navigator.

Hope that helps.

-Philipp

>I'm looking through the list of plugins looking for the code that is used

>to create the "Navigator" view, but I can't seem to find it. I'm trying
>to create a view (plugin) that shows a tree structure...just like in the
>Navigator view. I have found several examples on the internet and in
>books...and I have implemented them, but all of these examples are either

>trees in which the nodes are manually specified (i.e. Parent1 - Child1 -
>Leaf1....etc), and the other examples are trees which start from the
roots
>(i.e. C:/, D:/, etc).

>I want to create a tree which will show the folder structure starting
from
>a specified location (C:/eclipse/workbench/MyFolder) rather than from the

>root. It seems that this is how the package explorer creates its tree
>structure, so I'm trying to find the code for the navigator view to get
an
>idea of how to do what I'm trying to do, or any code that will help me
>accomplish this for that matter.

>I hope I'm posting this in the right group. Thanks for any help.
--=_alternative 002AD507C1257026_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2><tt>Hey Marko,</tt></font>
<br>
<br><font size=2><tt>The navigator uses a treeviewer. If you are not familiar
with tree viewers have a look here first http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArti cle.htm</tt></font>
<br><font size=2><tt>The treeviewer can display a hierarchical structure
using a content provider. The input model for the navigator view is an
instance of IWorkspace. </tt></font>
<br>
<br><font size=2><tt>For your case: If you want to display a folder structure
that is located in your workspace you can use the eclipse resource model
as input model. You would feed your treeviewer with the IResource you want
to start from (the folder or project). Your content provider would need
to know how to retrieve the children of a folder or project. Thats all.
</tt></font>
<br>
<br><font size=2><tt>If the folder structure you want to display is not
located in your workspace (or not part of it). You would have to build
up a model yourself containing the folder structure and than implement
a content provider that can handle that model. </tt></font>
<br>
<br><font size=2><tt>If you still want to have a look at the navigator
implementation look at org.eclipse.ui.views.navigator. </tt></font>
<br>
<br><font size=2><tt>Hope that helps.</tt></font>
<br>
<br><font size=2><tt>-Philipp</tt></font>
<br>
<br><font size=2><tt>&gt;I'm looking through the list of plugins looking
for the code that is used <br>
&gt;to create the &quot;Navigator&quot; view, but I can't seem to find
it. &nbsp;I'm trying <br>
&gt;to create a view (plugin) that shows a tree structure...just like in
the <br>
&gt;Navigator view. &nbsp;I have found several examples on the internet
and in <br>
&gt;books...and I have implemented them, but all of these examples are
either <br>
&gt;trees in which the nodes are manually specified (i.e. Parent1 - Child1
- <br>
&gt;Leaf1....etc), and the other examples are trees which start from the
roots <br>
&gt;(i.e. C:/, D:/, etc).<br>
<br>
&gt;I want to create a tree which will show the folder structure starting
from <br>
&gt;a specified location (C:/eclipse/workbench/MyFolder) rather than from
the <br>
&gt;root. &nbsp;It seems that this is how the package explorer creates
its tree <br>
&gt;structure, so I'm trying to find the code for the navigator view to
get an <br>
&gt;idea of how to do what I'm trying to do, or any code that will help
me <br>
&gt;accomplish this for that matter.<br>
<br>
&gt;I hope I'm posting this in the right group. &nbsp;Thanks for any help.</tt></font>
--=_alternative 002AD507C1257026_=--
Previous Topic:drawing a selection frame in a composite
Next Topic:Problem with posting key events
Goto Forum:
  


Current Time: Thu Apr 25 05:18:20 GMT 2024

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

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

Back to the top