Reputation: 449
I develop my first plugin - 2 questions:
I'm using ContainerSelectionDialog dialog in my eclipse plugin to give my user the option to choose project. but it show me the project and the folder in them, I want to show the user only the project with out option to expend the project and choose folder, how can I do it?
when user select my wizard (new->other->myWizard) i want to know which project in the packageexplorer it select ( like you have in new class that it know which project is selectd)
Thanks!!
Upvotes: 1
Views: 813
Reputation: 33034
You can use a org.eclipse.ui.dialogs.ElementListSelectionDialog
and call setElements()
on it. The data you pass to setElements()
should be an array of IProject
instances; one way to obtain that is via org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getProjects()
Note A: IWorkspaceRoot.getProjects()
will return all projects, including closed ones, so depending on your needs you may want to filter that list before passing it to the dialog (look at IProject.isAccessible()
)
Note B: You can use org.eclipse.ui.model.WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider()
for the dialog's labelProvider.
Upvotes: 4