Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Programmatically set Discovery Options


I've been creating a simplified project wizard for our users.  It basically only asks for the name of the project.  All the other settings are meant to be automatic.  I'm mostly there, just a few wrinkles left.

For one, I want to be able to set the discovery options programmatically when I create the project.  For instance, I want to:

ENABLE: Automatic Discovery of Paths and Symbols
ENABLE: Generate scanner info command

and populate the "Compiler invocation command" with a valid gcc path.

Defaults for the rest of that page are fine.

How can I do that?  My code for creating the project can be seen in the following snippet:

//create project
CCorePlugin.getDefault().createCProject(description, projectHandle, monitor,MakeCorePlugin.MAKE_PROJECT_ID);
MakeProjectNature.addNature(projectHandle, monitor);
ScannerConfigNature.addScannerConfigNature(projectHandle);

//set binary parsers
ICDescriptorOperation op = new ICDescriptorOperation() {
        public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
                descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
                descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, PluginConstants.BINARY_PARSER_PE);
                monitor.worked(1);
                descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, PluginConstants.BINARY_PARSER_CYGPE);
                monitor.worked(1);
        }
};
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(projectHandle, op, monitor);

//create discovered paths container
createDiscoveredPathContainer(projectHandle, monitor);                        

//open project
projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000));


Thanks,

Chad Barnes
Rockwell Collins, Inc.

Back to the top