How do I programmatically change the Eclipse CDT tool settings for a file?

前端 未结 2 480
醉酒成梦
醉酒成梦 2021-02-06 10:23

I want to programmatically (from a plugin) change the \"Other flags\" field in the Miscellaneous settings in the Tool Settings tab for an individual file in a CDT managed build

2条回答
  •  粉色の甜心
    2021-02-06 11:00

    Generally you can set an option to different objects, i.e. a configuration (if you want the option to apply to all files of a given type in a configuration) or a resource (if you want the option to apply only to the files in a folder or to a single file).

    setOption() has multiple prototypes; it looks like you used the one that applies to a file resource.

    In my GNU ARM Eclipse Plug-in I successfully used another version:

    setOption(IConfiguration config, IHoldsOptions holder, IOption option, String value)
    

    You can see an example in this file, line 583.

    I guess this will work in your case too.

提交回复
热议问题