views:

167

answers:

0

I would like to add another C/C++ code style profile as default to our branded eclipse distribution. Does anyone know how to do that?

So instead of instructing the users to import the profile xml-file, I would like it to already be in the code style -> profiles list along with the built-in profiles (Windows->Preferences->C/C++->Code Style) once eclipse is started.

Could I achieve this by somehow specifying the xml-file in the plugin_customization.ini of the eclipse distribution product? (Something involving org.eclipse.cdt.ui/org.eclipse.cdt.ui.formatterprofiles?)

I've tried looking at the org.eclipse.cdt.ui plugin source code, and I see this in the 'addBuiltinProfiles'-method in 'FormatterProfileManager.java': First the built-in profiles are added, and then

// Add the Profiles which are at default scope and hence are contributed by a product.
 try {
     List<Profile> defaultProfiles= new FormatterProfileStore(profileVersioner).readProfiles(new DefaultScope());
     if (defaultProfiles != null) {
      Map<String, Profile> profMap= new LinkedHashMap<String, Profile>();
      // Add the already loaded / created profiles to a map 
      for (Profile p : profiles)
       profMap.put(p.getID(), p);

      // Default profiles override any colliding profiles already in the list
   for (Profile p : defaultProfiles)
    profMap.put(p.getID(), new BuiltInProfile(p.getName(), p.getName(), p.getSettings(), 2,   profileVersioner.getCurrentVersion(), profileVersioner.getProfileKind()));
   profiles= new ArrayList<Profile>(profMap.values());
     }
 } catch (CoreException e) {
  CUIPlugin.log(e);
 }

This seems to me like the code that would add a profile in the way I am looking for, but maybe it's just code for adding the already imported profiles?

Can I get a new profile added in the 'built-in' list by default, without first manually having imported it, and without having to modify CDT?

Any help would be really appreciated!

Cheers, KK