Skip to main content

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


I figured a way to set discovery options, but it's naughty.  I am using internal API:

/**
 * @param project
 * @param config AbstractToolChainConfiguration
 * @throws CoreException
 */
private void setDiscoveryOptions(IProject project, AbstractToolChainConfiguration config) throws CoreException {
        IScannerConfigBuilderInfo2 scm = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
        scm.setAutoDiscoveryEnabled(true);
        scm.setProviderRunCommand("specsFile", getGCCCommand(project, config));
        scm.save();
}

Can anyone suggest a better, public API method of accomplishing the same?

Thanks,
Chad


<cebarne2@xxxxxxxxxxxxxxxxxxx>
Sent by: cdt-dev-bounces@xxxxxxxxxxx

11/11/2005 11:24 AM

Please respond to
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

To
cdt-dev@xxxxxxxxxxx
cc
Subject
[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.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top