views:

33

answers:

1

In my Eclipse plugin application I have a wizard to create a new file. In this wizard I need to display a tree of the Workspace projects, their packages and source files, similar to the Package Explorer, so that the user can select the items that are relevant to my particular editor. They won't be edited in the editor itself, but they provide some context for my editor.

An example of what I need: new file wizard

The more the dialog looks like the package explorer the better. I'm really not sure how to approach this problem.

+1  A: 

If you need something similar to what you get in JDT, I suggest looking at the JDT code. You can use the plugin spy (included in Eclipse PDE starting with 3.4, ALT+SHIFT+F1) to find out which class and plugin is providing the view and start from there.

zvikico
+1 for suggesting Plug-in Spy, it's a great way to peek into the internals of Eclipse. As far as the actual implementation goes, it seems to be much easier to emulate the looks of the Package Explorer view with a simple TreeViewer and approporiate content and label providers. It might be useful to have a brief look at the code, but I would suggest starting from scratch and keeping it as simple as you can. For example you can easily reuse the various icons from the Package Explorer to make it look familiar to your users.
Zsolt Török