Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » [SOLVED] How to synchronize a copy project in the background using JavaElementDeltas?
icon10.gif  [SOLVED] How to synchronize a copy project in the background using JavaElementDeltas? [message #647700] Fri, 07 January 2011 20:31 Go to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
People who are interested in the solution, please visit: http:// www.eclipse.org/forums/index.php?t=msg&th=203265&S=b 5d5c7bdcea0b480fec5983a64c3aa1c

Hi all,

Let's say that I have created a copy of a project (IProject) using IProject.copy(). I want this copy to be in sync with the original project as the user changes the original project.

Looking at the Eclipse API I have seen
JavaCore.addElementChangedListener(IElementChangedListener listener);

This is pretty interesting and works fine for getting all the changes done to the project as ElementChangedEvents. I can event get JavaElementDeltas (and I presume that Deltas represent the exact change between two versions of the project), however my problem is that I cannot find a way to apply these deltas to the project.

So my question(s):
1-) Is there a way to apply a JavaElementDelta to a project (IProject)? (I assume that if I apply all the deltas I got from the original project to the copy project, they will always be in sync)
2-) If yes to 1, is it possible to apply a JavaElementDelta generated by an IProject (let's say project1) to another IProject (project2, in my case the copy project)?
3-) Is there another way to do what I want to do (i.e., keep 2 projects in sync textually)? (as long as it is doable and uses Eclipse API, it doesn't matter if it is hard, easy, hacky or etc.)?

Thanks a lot in advance, regards,

[Updated on: Thu, 10 February 2011 11:41]

Report message to a moderator

Re: How to synchronize a copy project in the background using JavaElementDeltas? [message #647855 is a reply to message #647700] Mon, 10 January 2011 07:22 Go to previous messageGo to next message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 128
Registered: July 2009
Senior Member
I don't think JDT/Core provides a way to directly applying an IJavaElementDelta on a project or any other resource. Besides, IJavaElementDelta is a converted delta from the original IResourceDelta and will not have the complete delta. For instance, in the case of changes to the method body, it will only have a flag (F_FINE_GRAINED) indicating that there were fine grain changes and not the actual change information itself. So, it makes sense to work with the IResourceDelta itself - please refer to org.eclipse.core.resources.IResourceChangeListener. However, I am still not sure if the delta can be applied on another resource directly.

I would recommend you re-post (or move) this to the eclipse/platform section, which might help.
Re: How to synchronize a copy project in the background using JavaElementDeltas? [message #648110 is a reply to message #647855] Tue, 11 January 2011 09:21 Go to previous message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi, Thanks for the help. I have created another topic in the related forum. Do you know at least a way to apply the IResourceDelta itself to its origin project (i.e., the IProject created that delta)?
Previous Topic:How can I extend JDT's annotation validation mechanism?
Next Topic:Source code path repeatedly lost in debugger
Goto Forum:
  


Current Time: Tue Apr 23 10:24:54 GMT 2024

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

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

Back to the top