Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Merging file deletions in multi-file model
Merging file deletions in multi-file model [message #1750359] Tue, 20 December 2016 10:52 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi,

I am using EMF Compare to handle model merging in my own EMF-based application. One problem that I am encountering is caused by the fact that my application serializes models in multiple files. This means that by deleting certain EObjects, it is possible that entire model files are removed from the file system.

My first impression is that EMF Compare cannot handle this case "out of the box", and may require some customization.

The behavior I am observing depends on whether the deletion is performed in the local or in the remote model. When deleting a file in the local model and making a change to that same file in the remote model, the compare editor does not start, reporting in a pop-up message that "There are no differences between the selected inputs".

I think at least some of this behavior could be due to my extension to CompareEditorInput. However, I'd like to ask if this type of conflict is currently supported by EMF Compare. For instance, is the RecursiveModelMerger designed to support this use case?

Cheers,
Vlad
Re: Merging file deletions in multi-file model [message #1750452 is a reply to message #1750359] Wed, 21 December 2016 08:49 Go to previous messageGo to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Vlad,

EMF Compare supports multi-file models, including moves across model files, deletions of model files on the local or remote side, etc. (see ResourceAttachmentChange). But so for, I only used this multi-file functionality together with EGit and the recursive model merge strategy in the EGit preferences. The model resolution preference should then be set accordingly, depending on how your models are structured. E.g., whether all connected models are in one project (project scope) or are distributed across multiple projects (workspace scope), etc.

I have never tried to support this use case outside of EGit. It should be doable, but may require some additional implementation. You might also want to have a look at the EMFResourceMappingMerger, which implements the multi-file merge based on the the Eclipse Team API.

Best wishes,

Philip

--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/

[Updated on: Wed, 21 December 2016 08:50]

Report message to a moderator

Re: Merging file deletions in multi-file model [message #1750460 is a reply to message #1750452] Wed, 21 December 2016 10:10 Go to previous messageGo to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi Philip,

Thank you for the quick answer. I'm happy to hear the multi-file scenario is considered in EMF Compare. This means I just have to find our what is wrong with my implementation that is causing it to fail.

I also have two follow-up questions to your message:

1. What is the relationship between the EMFResourceMappingMerger and the RecursiveModelMerger classes? I am currently using the RecursiveModelMerger to detect if there are any conflicts (I only want to start the comparison editor if conflicts are detected). But it seems like the comparison editor somehow invokes the EMFResourceMappingMerger by default.

2. What do you mean when you say "the model resolution preference should then be set accordingly"? Is there a set of model resolution preferences that can be configured?

Best regards,
Vlad
Re: Merging file deletions in multi-file model [message #1750926 is a reply to message #1750460] Mon, 02 January 2017 09:42 Go to previous messageGo to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Vlad,

Quote:
1. What is the relationship between the EMFResourceMappingMerger and the RecursiveModelMerger classes? I am currently using the RecursiveModelMerger to detect if there are any conflicts (I only want to start the comparison editor if conflicts are detected). But it seems like the comparison editor somehow invokes the EMFResourceMappingMerger by default.


The recursive model merger considers "model providers" (org.eclipse.emf.compare.model.provider) during the merge and EMF Compare registers a model provider for EMF models (EMFModelProvider). For merging "models" provided by such providers, the provider is adapted to a IResourceMappingMerger. EMFModelProvider adapts to EMFResourceMappingMerger. Thus, EMFResourceMappingMerger is responsible for merging EMF models as provided by the EMFModelProvider through the extension org.eclipse.emf.compare.model.provider.

Quote:
2. What do you mean when you say "the model resolution preference should then be set accordingly"? Is there a set of model resolution preferences that can be configured?


Yes, please look at EMF Compare -> Resolution Strategy, where you can configure the scope of the model resolution. This model resolution will be considered when resolving the connected model resources provided by the EMFModelProvider.

Hope that helps,

Philip

--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: Merging file deletions in multi-file model [message #1752586 is a reply to message #1750926] Wed, 25 January 2017 10:56 Go to previous message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi Philip,

Thank you very much for the previous answer.

Related to that, I have an additional question. I have implemented a custom merger extending org.eclipse.emf.compare.egit.internal.merge.RecursiveModelMerger. This merger is instantiated by a custom merge strategy extending org.eclipse.emf.compare.egit.internal.merge.StrategyRecursiveModel.

How can I programmatically configure EMF Compare to use my custom merger instead of the one it uses by default? I checked the developer documentation, but the section describing how to provide custom mergers is still under construction.

Thank you in advance!

Vlad
Previous Topic:Left and Right panels disposed during conflict resolution
Next Topic:Model merger not found
Goto Forum:
  


Current Time: Wed Apr 24 22:41:49 GMT 2024

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

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

Back to the top