Skip to main content

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

Ccing cdt-dev:
> -----Original Message-----
> From: cherrychan1984@xxxxxxxxxxx [mailto:cherrychan1984@xxxxxxxxxxx] 
> Sent: 05 April 2007 08:01
> To: Robert Norton
> Subject: RE: Programmatically Create CDT Project
> 
> Could you give a detail solution?
> In my plugin project, i also need to programmatically create 
> a C++ Project....
> but, CCorePlugin.getDefault() returns null...what's the problem?

Which version of the CDT are you using?

I wouldn't expect this ever to return null, though looking at the code
it would seem that CCorePlugin.getDefault() will return null if
CCorePlugin has never been instantiated. Is the CDT plugin being loaded?

Cheers,

Robert

> Sherry
> 
> Robert Norton-4 wrote:
> > 
> > I think I've found the solution:
> >  
> > If I check the existing .project, .cdtproject and .settings 
> into CVS 
> > then they are automatically detected and everything is groovy. This 
> > has the added advantage of putting the project metadata 
> under version 
> > control.
> >  
> > Robert
> > 
> > 
> > ________________________________
> > 
> > 	From: cdt-dev-bounces@xxxxxxxxxxx
> > [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Robert Norton
> > 	Sent: 21 December 2006 14:42
> > 	To: cdt-dev@xxxxxxxxxxx
> > 	Subject: [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 
> > <https://bugs.eclipse.org/bugs/show_bug.cgi?id=153408> ). 
> 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
> > 
> > 
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> > 
> > 
> Quoted from: 
> http://www.nabble.com/Programmatically-Create-CDT-Project-tf28
> 65890.html#a8012203
> 
> 
> 



Back to the top