Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Showing remote changes on the left
Showing remote changes on the left [message #1746517] Mon, 31 October 2016 14:14 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi,

Is it possible to configure EMF Compare to show remote changes on the left and local changes on the right?

I am extending CompareEditorInput in my application, so I have some level of control over the editor's appearance. However, I can't seem to find the place in the EMF Compare code where the assumption that remote changes should always be displayed on the right is made.

Some context: I want to do this in an application that only uses EMF Compare to resolve stash apply conflicts. In this case, the stashed local modifications appear in the right-side editor in EMF Compare, while any pulled remote changes appear in the left-side editor, which might be counter-intuitive to users.

Thanks in advance!

Vlad
Re: Showing remote changes on the left [message #1746630 is a reply to message #1746517] Wed, 02 November 2016 09:34 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

That is not configurable through normal means as we just show the left and right (as defined by the EMFCompareConfiguration) on their respective sides. You might switch the side from there, but I don't know how much of an impact that might have on all the other assumptions that are made throughout the UI and core of EMF Compare. Your best bet would be to really switch the sides completely by using the "remote" as left and local as right when you actually call for the comparison in your case I think.

Laurent Goubet
Obeo
Re: Showing remote changes on the left [message #1746721 is a reply to message #1746630] Thu, 03 November 2016 16:56 Go to previous messageGo to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi Laurent,

Thank you for the suggestion. That is also what I tried, but for some reason it's not working as I would expect.

Specifically, I tried to implement my own GitResourceVariantTreeProvider by extending DirCacheResourceVariantTreeProvider. Here's what my extension looks like:

public class MyResourceVariantTreeProvider extends DirCacheResourceVariantTreeProvider {

  public MyResourceVariantTreeProvider(Repository repository, boolean useWorkspace) throws IOException {
    super(repository, useWorkspace);
  }

  @Override
  public IResourceVariantTree getRemoteTree() {
    return super.getSourceTree();
  }

  @Override
  public IResourceVariantTree getSourceTree() {
    return super.getRemoteTree();
  }

}


However, when I replace DirCacheResourceVariantTreeProvider with my implementation, the Compare Editor always shows my conflicts as pseudo-conflicts, listing the remote changes on both the left and the right side. I am using MyResourceVariantTreeProvider to identify conflicts in CompareEditorInput.prepareInput. Do you think this is a viable approach in principle?

Cheers,
Vlad
Re: Showing remote changes on the left [message #1746915 is a reply to message #1746721] Mon, 07 November 2016 16:21 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

To be honest, I don't think it's a viable approach in general since you can't really control when you'll be switching the sides and when you will not. For example, in this particular case, I'm pretty sure we're using the actual workspace version (the IResource instances) for the left side, regardless of what "getSourceTree" sends. You'd have to be comparing two branches together (or two remote revisions) to avoid that.

What I was suggesting earlier is to actually send EMFCompare the data you want it to compare for each side instead of relying on the default team actions (Compare With > Each Other) since that is the only way I think viable if your goal is to completely switch the sides since that's the only way you'd be completely in control of what's happening behind the scene.

Laurent Goubet
Obeo
Re: Showing remote changes on the left [message #1747023 is a reply to message #1746915] Tue, 08 November 2016 15:39 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Vlad,

Just so you know, Oxygen M2 brings in that exact feature in the form of a new action in the toolbar. You might want to switch to Oxygen and avoid developping anything on this?

Note that I've noticed a cosmetic bug with EMF Compare that prevents that particular button to show properly, it will be fixed in the next nightly.

[edit: doesn't seem like it's fully functional for EMF Compare, but it's at least a better start to implementthis feature on your side]

Laurent Goubet
Obeo

[Updated on: Tue, 08 November 2016 16:38]

Report message to a moderator

Re: Showing remote changes on the left [message #1747091 is a reply to message #1747023] Wed, 09 November 2016 10:32 Go to previous message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi Laurent,

Thank you for the support and suggestions. For now, my solution is to just show appropriate labels above the two editors (i.e. changing the label above the left side to "Remote" and the label above the right side to "Local").

I really appreciate the tip regarding this feature in Oxygen. I think my strategy will be to wait until a stable version of this feature is released next year and see if I can adapt to my use case.

Cheers,
Vlad
Previous Topic:Implementing own viewer for EMF Compare
Next Topic:SaveComparisonModelAction enablement
Goto Forum:
  


Current Time: Sat Apr 27 03:28:49 GMT 2024

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

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

Back to the top