Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CExternalSettingsProvider how does it work?

Hi have the following code in my project:

package cdt_plugin_1;

import org.eclipse.cdt.core.settings.model.CExternalSetting;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.extension.CExternalSettingProvider;
import org.eclipse.core.resources.IProject;

public class MyExternalSettingsProvider extends CExternalSettingProvider {

    public MyExternalSettingsProvider () {
    }

    @Override
    public CExternalSetting[] getSettings(IProject arg0, ICConfigurationDescription arg1) {
        return new CExternalSetting[] {
                new CExternalSetting(null, null, null,
                    new ICSettingEntry[] {
                        new CIncludePathEntry("/home/mauve/Desktop/smurf", 0) // dir which contains coolfile.h
                    })
        };
    }
}

After starting a debug session with the plugin, I create a C++ project with the following source file:

// main.cpp
#include <coolfile.h> // defines COOLSTRING
#include <iostream>

int main (int argc, char* argv[])
{
  std::cout << "Smurf: " << COOLSTRING << std::endl;
  return 0;
}

However this does of course not compile as my plugin is never being called (breakpoint not hit).

If anyone could please enlightenment me on how I "enable" my ExternalSettingsProvider?

My plugin.xml contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
   <extension
         id="MyExtSettingsProvider"
         name="myCoolSettingsProvider"
         point="org.eclipse.cdt.core.externalSettingsProvider">
         <provider
             class="cdt_plugin_1.MyExternalSettingsProvider">
         </provider>
   </extension>
</plugin>


With kind regards,

Mikael Olenfalk


Back to the top