| Saving project data before a project is closed or deleted [message #553699]
||Wed, 18 August 2010 10:12
| Waqas Ilyas
Registered: July 2009
I have a problem regarding saving some custom data in a project file before it is closed or deleted. I am using Eclipse 184.108.40.206.
I have my own project natures and for my projects, I use a file within the project to save information related to project settings (much like .project file). Many settings are handled through the properties view and also when files are added or deleted from the project. So I cannot save the data in RAM at the time of modification to file. Before a project is closed/deleted I need to save the data in ram to that file.
For this I have added save participants to the workspace, so that my data gets periodically saved and additionally I have added listeners to resource change events so that I can save my data just before a project is closed/deleted.
The problem is that when I get resource change events for a project that is being deleted or closed (IResourceChangeEvent.PRE_CLOSE, IResourceChangeEvent.PRE_DELETE), the resource tree is locked for any modifications. I therefore am unable to make any changes to the project. Any suggestions?
In case of closing a project my save participant does get notification and I can save at that time. But I do not get the save notification when a project is being moved (renamed) or closed.
I presume that this is a common requirement that users of Eclipse who create their own project natures need to save project settings to a file within the project. What would be the preferred way to achieve that? Save the file as soon as settings are changed via property dialogs or property view? What is then the purpose of a save participant.
Powered by FUDForum
. Page generated in 0.33798 seconds