Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Project close and rename operations
icon9.gif  Project close and rename operations [message #552216] Wed, 11 August 2010 10:21 Go to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
Hi,

I have a problem regarding saving some custom data in a project file before it is closed or renamed. I am using Eclipse 3.3.1.1.

I have my own project natures and for my projects, I use a file within the project to save information related to project settings. Many settings are handled through the properties view. Before a project is closed 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 strangely the ResourcesPlugin.getWorkspace().isTreeLocked() equals false and I can make modifications at that time. But I do not get the save notification when a project is being moved (renamed).

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.

Regards,
Waqas

[Updated on: Thu, 12 August 2010 10:04]

Report message to a moderator

Re: Project close and rename operations [message #552278 is a reply to message #552216] Wed, 11 August 2010 14:55 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
I don't do the actual saving in the listener, I spin a job to do the work. You really don't want to do much in any resource change listener for performance reasons and of course the locking.

Re: Project close and rename operations [message #552418 is a reply to message #552278] Thu, 12 August 2010 07:54 Go to previous messageGo to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
I am sorry but I did not understand how that would solve my problem? How shall I be able to save any data in a project before it gets closed or deleted? By the time my save job runs the project would be inaccessible.
Re: Project close and rename operations [message #552425 is a reply to message #552418] Thu, 12 August 2010 08:16 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Sorry, good question, I imagine there is a way but I don't know it off the top of my head. Sorry I'm useless here.

icon4.gif  Re: Project close and rename operations [message #552747 is a reply to message #552425] Fri, 13 August 2010 11:18 Go to previous messageGo to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
Anyone out there who might have a clue on this?
Re: Project close and rename operations [message #552794 is a reply to message #552747] Fri, 13 August 2010 14:32 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Look at the Saveable (ISaveableSource, Saveable) stuff, I think that will do what you want.

Re: Project close and rename operations [message #553386 is a reply to message #552794] Tue, 17 August 2010 11:37 Go to previous messageGo to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
ISaveablesSource etc are not particularly helpful to me. I do not wish to save data for a particular workbench part. My objective is to save project related data in a project file.

Somewhat like a .project file in all eclipse projects. Although .project is saved instantly on project modifications but consider that there are properties that are edited via properties view or project property dialogs. In such a case it would be desirable that project data is saved later when save participant kicks in or before the project is closed or deleted or renamed.

Perhaps I should start a new thread. Maybe everyone seems to think that this one has its problems solved.
Re: Project close and rename operations [message #553464 is a reply to message #553386] Tue, 17 August 2010 15:40 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Yes, I recommend starting a new thread.

Previous Topic:plugin installation monitoring
Next Topic:JDT CompilationUnitEditor within MultiEditor - no highlighting
Goto Forum:
  


Current Time: Fri Apr 26 17:52:28 GMT 2024

Powered by FUDForum. Page generated in 0.04089 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top