Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Programmatically Create CDT Project

Dear All,
 
I am trying to integrate our (slightly quirky) build system with the CDT via a NewWizard. This involves invoking a script to check out source and create a build tree based on settings supplied in the wizard. At the end of this process I need to create a CDT project (actually more than one in order to work around this bug). I'm able to create something resembling a CDT project using the following:
 
  IProject newProjectHandle =  ResourcesPlugin.getWorkspace().getRoot().getProject(name);
  IWorkspace workspace = ResourcesPlugin.getWorkspace();
  IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
  description.setLocation(new Path(fullRoot));
  CCorePlugin.getDefault().createCProject(description, newProjectHandle, monitor, MakeCorePlugin.MAKE_PROJECT_ID);
  MakeProjectNature.addNature(newProjectHandle, new SubProgressMonitor(monitor, 1));
  ScannerConfigNature.addScannerConfigNature(newProjectHandle);
 
The problem is that this doesn't configure all the default settings (Indexer, Discovery Options...) etc. correctly and the code which does this in the NewCProjectWizard is rather involved and also inextricably linked with the GUI. Is there any way to achieve this without having to tease apart the NewCProjectWizard and copy and paste the code? If programmatically creating projects is something that other people have a need for then perhaps it would be worth factoring out?
 
Merry Christmas!
 
Robert

Back to the top