Preserving Permanent Property Properties in Version Control

I have a plugin that adds summary information to project resources through the eclipse persistent property mechanism. Now these projects are stored in version control systems such as SVN and GIT.

Permanent properties will not be checked, as they are stored in the metadata of the workspace, and not inside the project itself.

%workspace%\.metadata\.plugins\org.eclipse.core.resources\.projects\%projectname%\.indexes

  • Is there a way to save these properties in a project and manage them using version control?
  • If not, has anyone tried using this solution?

Here the question arose:

Eclipse: saving information in a .project file

and the answer is useful if you want to save information about the scope of the project, which does not apply to individual resources. But I need to connect the information with folders and files and save this information inside the location of the project file system.

0
eclipse eclipse-plugin eclipse-rcp
source share
2 answers

You can include the resource path in the "key" part of the project area priority value. So:

 preferences.putString("/path/to/file/keyword", value); 
0
source share

I know this is a rather old question, but it appears as one of the best matches when searching for "Resource Dependent on an Eclipse Project". (Looking for this, obviously, I myself was looking for a solution.)

Eclipse provides options related to the ProjectScope scope. These settings are saved in files in /<project>/.settings and can be easily added to version control. If you have, for example, set the encoding for a file in your project, you will find org.eclipse.core.resources.prefs in this directory and you will see how the resource plugin (which supports this file) uses a specific scheme to combine the property name and the resource name in the preference key.

Using this as a basis, I implemented a special solution for storing "persistent resource properties in version control" (resource properties with the project scope "aka"). You can see it here . Creating a key and saving properties as settings is simple and easy. In addition, my custom solution monitors file deletion and deletes properties to prevent them from “popping up” if you later create a file with the same name again. It also tracks movements / renames and saves properties associated with the moved / renamed file. Please note that it does not intentionally copy related properties if the file is copied, because this is not the intended behavior for my use case.

It works, but, as usual, with such a complex environment as the Eclipse platform, I probably did not consider every problem. When I have time, I will dig out the source code of the resource plugin and see how to do it correctly. Meanwhile, it works well enough for me.

0
source share

All Articles