Question

I'm developing an Eclipse plugin. It creates a button in the Eclipse toolbar that launches a wizard. I need to add a view e.g. Package Explorer view, on a specific WizardPage.

How can I do this?

UPDATE:

Work with this:

import org.eclipse.cdt.core.model.CoreModel; 
...
checkboxTreeViewer.setContentProvider(new BaseWorkbenchContentProvider());
checkboxTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
treeViewer.setInput(CoreModel.create(ResourcesPlugin.getWorkspace().getRoot()))

But it show both project's src directory and Debug directory. How can I show only src directory?

Was it helpful?

Solution

You can't show a view (anything derived from ViewPart) in a wizard because it relies on the view infrastructure provided by Eclipse that is not available in a wizard.

You can create a TreeViewer and populate it with the files and folders in the workspace. The content provider, label provider and input would be something like this:

   treeViewer.setContentProvider(new WorkbenchContentProvider());
   treeViewer.setLabelProvider(new WorkbenchLabelProvider());
   treeViewer.setInput(ResourcesPlugin.getWorkspace());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top