Reputation: 109
I am developing CDT plug-in for Eclipse IDE and I need to track plug-in version which C projects were created with to track compatibility issues. I need to write the CDT plug-in version to .cproject
file for this.
I have already tried such code:
IProject project = ...;
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
// change things in the buildInfo
ManagedBuildManager.saveBuildInfo(project, true);
But I have not found the right way to use it.
I have already tried to use CProject
extension point, but the interface ICOwner
which it requires to implement is deprecated and I did not found an alternative.
I found another similar question, but the answer seems to be UI-related (at least I couldn't find getResDesc()
method).
Also want to clarify that it is not about changing existing option from .cproject
file, it is about adding new one.
How do I write the CDT plug-in version to .cproject
file?
Upvotes: 1
Views: 119
Reputation: 7970
You can solve this by writing to the project scoped preference store. This stores preferences in the .settings/*.prefs file.
A quick primer from the docs:
IScopeContext projectScope = new ProjectScope(MyProject);
Preferences projectNode = projectScope.getNode("com.example.myplugin");
However there are a lot of other API choices around preferences so a further discussion on that may be best for another question.
Upvotes: 2