[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Problems with setting options in a MBSCustomPage
|
Wieant Nielander wrote:
I have developed a custom page (MBSCustomPage) that gets added to the C
Project Wizard. I am collecting some additional information that I am
then using to set options in the toolchain (compiler, linker etc). This
is done in the CustomPage Runnable that is called. I apply my changes to
the toolchain and then call:
ManagedBuildManager.saveBuildInfo(project, true);
to save these options.
When the project is built, I can see my options appear in the command
line and the project builds correctly. However, if I close Eclipse and
then reopen, my new settings have disappeared. I can confirm this by
looking in the .cproject file - my changes are not there.
So, it appears that my options are not being stored in the .cproject
file even though they were there in the 'in memory' version.
As an experiment, I added a button to the UI, whose action is to call:
ManagedBuildManager.saveBuildInfo(project, true);
If I press this button after my project has build, I see that sometimes
(but not every time), my settings ARE written to the .cproject.
Any clues as to what I might be doing wrong?
We have implemented our own property pages based on the CDT ones, and
setting options through ManagedBuildManager.setOption() seems to work
fine there, so I checked what is different from your approach and
apparantly ManagedBuildManager.saveBuildInfo() is not called, but
instead saving is done through CoreModel.getDefault().setProjectDescription()
Below is an extraction of this approach, perhaps you can give it a try.
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription des = mngr.getProjectDescription(getProject(), true /*writable description*/);
ICConfigurationDescription cfg = des.getActiveConfiguration();
IConfiguration config = ManagedBuildManager.getConfigurationForDescription(cfg);
<your> ManagedBuildManager.SetOption(config,config.GetToolChain()...)
...
CoreModel.getDefault().setProjectDescription(getProject(),des);
Regards,
Wieant
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
Hi Wieant,
Thanks for the help. I have just converted everything to use your
suggestion, and unfortunately it makes no difference.
One thing I didn't mention was that (in a different, independent plugin)
I am also storing my own information in the .cproject file, using this code:
ICStorageElement storage = des.getStorage(getPluginID(), false);
if (storage == null)
storage = des.getStorage(getPluginID(), true);
settings = storage.createChild(sPROJECT_STORAGE);
settings.setValue(value);
manager.setProjectDescription(project, des, true, null);
To check, I disabled my storage, and again it made no difference.
I'm completely stumped!
--
Subs