| Delaying resource modifications to prevent "resource tree is locked" exception [message #332195] | 
Thu, 09 October 2008 07:27   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi. 
 
I have my own implementation of IResourceChangeListener, which recognizes  
when file was moved and then makes some modifications to i's content. But  
when I try to save this modified content to file using IFile.setContent(),  
i get the following exception: 
 
org.eclipse.core.internal.resources.ResourceException: The resource tree  
is locked for modifications. 
	at  
 org.eclipse.core.internal.resources.WorkManager.checkIn(Work Manager.java:115) 
	at  
 org.eclipse.core.internal.resources.Workspace.prepareOperati on(Workspace.java:1747) 
	at  org.eclipse.core.internal.resources.File.setContents(File.ja va:364) 
	at  org.eclipse.core.internal.resources.File.setContents(File.ja va:469) 
 
I understand that I cannot modify file's content while processing resource  
delta. So I need someway to delay this modifaction. Is there a standart  
way to do this (maybe some queue, which accepts runnables, and then exutes  
them in batch after processing whole resource delta and unlocking resource  
tree) or I have to write my own implementation for this operation? 
 
Thanks.
 |  
 |  
  | 
 | 
Powered by 
FUDForum. Page generated in 0.53077 seconds