It depends the kind of modification you are after.
For instance, adding a project is best illustrated by this thread.
String theProjName = "Test";
String theLocation = "/some/test/project";
try {
IWorkspaceRoot theRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject theProject = theRoot.getProject(theProjName);
IProjectDescription theDesc = theProject.getWorkspace().newProjectDescription(theProjName);
theDesc.setLocation(new Path(theLocation));
theProject.create(theDesc, new NullProgressMonitor());
if (theProject.exists()) {
theProject.open(new NullProgressMonitor());
}
} catch (CoreException err) {
err.printStackTrace();
}
You could also want to open an editor:
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
if (dw != null) {
IWorkbenchPage page = dw.getActivePage();
if (page != null) {
IDE.openEditor(page, file, true);
}
}
} catch (PartInitException e) {
}
More generally, eclipse.dev.org can be a good source for pointers on that topic.
Since 2004, CDT has options you can modify through the Preference Setting Store (ICSettingsStorage
). May be that can help.
Regarding the Indexer, beware of the Discovery Preferences.
I am not sure there is an Indexer API, but you may look at the sources for further clues.