I\'ve added a button in the context menu to execute only when you right click in the Project Explorer window. I want to be able to grab each project in the Project Explorer wind
Use the selection data from the selection provider:
IStructuredSelection sel =
(IStructuredSelection)viewpart.getSite().getSelectionProvider().getSelection();
Object selObj = sel.getFirstElement();
IProject project =
(IProject)Platform.getAdapterManager().getAdapter(selObj, IProject.class);
... might return null if selection is not the project
String name = project.getName();
IPath location = project.getLocation();
To get all the projects use:
IWorkspace workspace = ResourcesPlugin.getPlugin().getWorkspace();
IProject [] projects = workspace.getRoot().getProjects();