Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How do I programmatically change the Eclipse CDT tool settings for a file?

I have done this. The code is rather specific to our application, but the pseudo-code looks something like this:

IConfiguration config = projectConfigs[i];
IResourceConfiguration resourceConfig = null;
resourceConfig = config.getResourceConfiguration(path);
ITool[] tools = resourceConfig.getTools();
for (int j = 0; j < tools.length; j++) {
modified |= setOption(id, value, resourceConfig,
tools[j].getOptions(), tools[j], settingsMode);
}

"path" is the project relative file that you want to set the options for
This peice of code is looking for particular option id's across all applicable tools, but hopefully this will provide some help to get you going. Feel free to ask more question.

On 6 Dec 2013, at 18:48, Daryl Spitzer <daryl.spitzer@xxxxxxxxx> wrote:

Doug writes:

> What I would do is stick breakpoints in places and see how the UI does it.

I have been doing that. I set a breakpoint in org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.setOption(IResourceInfo, IHoldsOptions, IOption, String) and it triggers when I open the Properties dialog for a file, expand "C/C++ Build", select "Settings", and then "Miscellaneous" in the Tool Settings tab. I can see the arguments, and presumably if I can call setOption with the same arguments I'll get the same results in the .cproject file. But I haven't been able to figure out how to do that. Do you have any suggestions for how I figure out where those objects are created so I can set breakpoints there?

> I’m not sure anyone here these days knows the answer.

I'm sorry to hear that. I guess the engineers who wrote that code no longer work on CDT?

--
Daryl



On Fri, Dec 6, 2013 at 7:25 AM, Doug Schaefer <dschaefer@xxxxxxx> wrote:
I’m not sure anyone here these days knows the answer. What I would do is stick breakpoints in places and see how the UI does it.

Doug.

From: Daryl Spitzer <daryl.spitzer@xxxxxxxxx>
Reply-To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Date: Friday, December 6, 2013 at 1:08 AM
To: "cdt-dev@xxxxxxxxxxx" <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] How do I programmatically change the Eclipse CDT tool settings for a file?

I haven't received any answers on this mailing list or to my Stack Overflow question, but I've continued working on it and have made some progress.

To refresh your memory, 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 project.

I can cause the settings to appear in the .cproject file, but there are differences between the XML created as a result of my programmatic changes and the XML created when making the changes manually, that I believe is resulting in the programmatic changes not showing up in the "Other flags" field in the file's Properties dialog.

See my updated code and XML in http://stackoverflow.com/questions/20061538/ for details.

--
Daryl



On Sun, Dec 1, 2013 at 9:17 AM, Daryl Spitzer <daryl.spitzer@xxxxxxxxx> wrote:
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 project.

I can read the default settings and change them, but it appears I'm only temporarily changing the default settings. I don't see how to change the actual settings, and have them saved.


--
Daryl Spitzer



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top