Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Compare] Showing differences in a Comparison object?
[Compare] Showing differences in a Comparison object? [message #988615] Fri, 30 November 2012 17:23 Go to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi all,

I'm one of the developers of the Epsilon project. We're running into some issues with EMF Compare 2.x while testing Epsilon against Kepler M3. We'd appreciate it if someone could help us a bit Smile.

We use EMF Compare as part of the EUnit unit testing framework bundled with Epsilon. It has some assertions that allow testers to check whether two models are equal ("assertEqualModels"). We rely on EMF Compare to compare EMF models and show their differences.

With EMF Compare 1.x, we used the standard services to create a ComparisonResourceSetSnapshot. If there were any differences, we showed them to the user by wrapping them in a ModelCompareEditorInput object and opening it through the CompareUI#openCompareEditor method. We had to tweak things a bit to handle some corner cases, but otherwise it was reasonably simple to do.

Since EMF Compare 2.x has changed things quite a bit, we've started rewriting the integration code. Comparing models seems even easier now than before: we produce a Comparison object and check if any differences have been reported. However, we're a bit stumped on how to convert that into a CompareEditorInput so we can pass it to CompareUI. ModelCompareEditorInput does not exist anymore, and we can't rely on the ResourceCompareInput class in the internal API of Eclipse Compare, as it requires using IResource objects. Due to technical constraints, the compared models may not be in the workspace.

Is there any way we can show the differences in the Comparison object? Do we need to use ResourceCompareInput and ensure compared models are in the workspace? Should we implement our own CompareEditorInput class?

Thanks in advance,
Antonio
Re: [Compare] Showing differences in a Comparison object? [message #988786 is a reply to message #988615] Mon, 03 December 2012 08:23 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Antonio,

The wiki is mostly outdated (slowly working on that aspect), but this should help you with the opening of a compare editor : http://wiki.eclipse.org/EMF_Compare/How_To_Open_Compare_Dialog_With_Comparison .

This was initially written to allow users to open a compare dialogs, but should also be useable for compare editors.

Please let us know if this page does not hold enough information Smile.

Laurent Goubet
Obeo
Re: [Compare] Showing differences in a Comparison object? [message #988796 is a reply to message #988786] Mon, 03 December 2012 09:02 Go to previous messageGo to next message
Mikael Barbero is currently offline Mikael BarberoFriend
Messages: 55
Registered: July 2009
Member
Hi Antonio,

I fear that the wiki page Laurent pointed you to is already a bit outdated. Sorry about that.

I recently made some code to ease this kind of integration. Please have a look to org.eclipse.emf.compare.ide.ui plug-in, class org.eclipse.emf.compare.ide.ui.internal.handler.CompareInDialog (esp. its super abstract class) to see how it works).

You will see that EMF Compare 2 now provide a CompareEditorInput subclass called EMFCompareEditorInput.

Please let us know if this is enough for you.

Best regards,

Mikael Barbero
Obeo


Best regards,

Mikael Barbero
Obeo
Re: [Compare] Showing differences in a Comparison object? [message #988831 is a reply to message #988796] Mon, 03 December 2012 11:28 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Mikael,

Thanks! These changes were done after M3, right? Looking at the latest sources from git, EMFCompareEditorInput is very close to what we need. There's a few isues, though:

  • The constructor takes a few arguments that are only used to perform a comparison in the prepareInput method. There seems to be a FIXME related to that in the prepareInput method. Is there any way we could directly pass it the Comparison object? Otherwise, we'd be comparing the models twice: once to check the assertEquals assertion, and again for showing the differences.

  • The constructor also takes an editing domain and an adapter factory, just like the createCompareEditorInput protected static method in the AbstractCompareHandler class. Looking at CompareInNewEditor#execute, the adapter factory can be easily created, but the editing domain seems trickier: AbstractCompareHandler#createEMFCompareEditingDomain appears to do the job, but it is private.


In summary, I think we'd be fine if EMFCompareEditorInput optionally accepted a precomputed Comparison object instead of computing on the fly and AbstractCompareHandler#createEMFCompareEditingDomain were easier to access. We could create the instance then and pass it over to CompareUI as we did before. Would these changes be OK?

Best regards,
Antonio
Re: [Compare] Showing differences in a Comparison object? [message #988858 is a reply to message #988831] Mon, 03 December 2012 13:34 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Antonio,

These changes were pushed very recently to the code base, and we are actively working on making all parts work well together. What you suggest here seem like good enhancements to the compare editor input since we'll eventually have to support this kind of use cases (thus the FIXME Razz).

Please raise a bug against EMF Compare describing the enhancements you need (or even better, a patch with the proposed changes). We'll try and make these changes before Kepler M4 (due friday the 21st).

Laurent Goubet
Obeo
Re: [Compare] Showing differences in a Comparison object? [message #989152 is a reply to message #988858] Tue, 04 December 2012 21:24 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Laurent,

I've raised a bug with a rough but small patch that does the job:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=395757

It would be great if we could have it fixed by M4 Smile.

Best regards,
Antonio
Previous Topic:[CDO] launch error with offline example
Next Topic:[CDO] How to know if a view is in audit mode
Goto Forum:
  


Current Time: Fri Apr 19 01:49:44 GMT 2024

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

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

Back to the top