Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-core-dev] IProject help

> 
> Hi,
> 
> I hope that someone can point me in the right direction.
> 
> I have been assigned the task of programatically launching Eclipse (with
> the CDT plugin active) and automatically creating a standard C project
> that points to an existing directory containing a Makefile and C files.
> 
> To accomplish the above, my current plan is to write a new plugin that
> performs the same steps as a CDT Wizard, except the specifics for a
> project will not be prompted from the user, but instead will be supplied
> by a configuration file.
> 
> I am using the following:
> 
>   eclipse-SDK-3.0.1-win32.zip
>     (Eclipse Platform Version: 3.0.1 Build id: 200409161125)
>   org.eclipse.cdt.sdk-2.1.0-win32.x86.zip
> 
> 
> The createCProject() method requires several parameters, one of which is
> 
>    public IProject createCProject(
>         final IProjectDescription description,
>         final IProject projectHandle,
>         IProgressMonitor monitor,
>         final String projectID)
>         throws CoreException, OperationCanceledException {
> 
> My current roadblock is with the "projectHandle" parameter.  My plan is
> to instantiate the class WizardNewProjectCreationPage (but not make it
> visible) and call its getProjectHandle() method.
> 
> However, WizardNewProjectCreationPage is in org.eclipse.ui.dialogs, and
> I didn't seem to get that jar file with the software I downloaded.  So I
> continue to look...
> 

It should be in ide.jar part of org.eclipse.ui.ide plugin.

> 
> Could someone please comment on whether this overall approach is reasonable
> and correct to accomplish the goal set before me?  If there is another,
> better way to do this, I would appreciate to know about it.
> 

If you do not need any UI why use the WizardPage classes, a project handle is easy
to create:

	IProject getProjectHandle(String name) {
	        return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
	}




Back to the top