Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Problems with ExternalSettingsProvider usage

Hello guys,
Does anybody have some experience with the usage of the ExternalSettingsProvider extension point?
We are currently using CDT 6.0.2.

I have done the following things:

-I have registered an ExternalSettingProvider class
-In an example command I set the providers on the project, and when I execute the command the 2nd time I call the updateExternalSettingsProviders

Class ExternalSettingsProvider:
  public CExternalSetting[] getSettings(final IProject prj, final ICConfigurationDescription cfg) {
    // Create an example macro
    String value = new SimpleDateFormat("ssSSS").format(new Date());

    CExternalSetting setting =
        new CExternalSetting(new String[] { "org.eclipse.cdt.core.gcc", "org.eclipse.cdt.core.g++" }, new String[] {
            "org.eclipse.cdt.core.cSource", "org.eclipse.cdt.core.asmSource" }, null,
            new ICSettingEntry[] { new CMacroEntry("EXAMPLE_MACRO", value, ICSettingEntry.MACRO) });
    System.err.println("CExternalSettingProvider.getSettings() - " + value);
    return new CExternalSetting[] { setting };

Command code to register/update the ExternalSettingsProvider
          ICConfigurationDescription activeConfiguration = null;
          String[] ids = new String[] { "bdom.cdt.settings.provider" };
          IProject prj = (IProject) obj;
          if (!set) {
            set = true;

            ICProjectDescription cProjectDescr = CCorePlugin.getDefault().getProjectDescription(prj, true);
            activeConfiguration = cProjectDescr.getActiveConfiguration();

            try {
              CoreModel.getDefault().setProjectDescription(prj, cProjectDescr, true, new NullProgressMonitor());
            catch (CoreException e) {
              // TODO Auto-generated catch block
          else {

            ICProjectDescription projectDescription2 = CCorePlugin.getDefault().getProjectDescription(prj, true);
            activeConfiguration = projectDescription2.getActiveConfiguration();
            try {
              CoreModel.getDefault().setProjectDescription(prj, projectDescription2, true, new NullProgressMonitor());
            catch (CoreException e) {
              // TODO Auto-generated catch block

Problems with this implementation
The example macro is set properly when the external settings provider is called the first time. But when it is called the 2nd time the changed macro value is not visible in the project properties. In the .cproject file though the new macro value is stored somehow.

Does anybody has a clue on what I am doing wrong?

Greets Marko

Back to the top