Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » EMF compare implementation of INavigatable.hasChange()(EMF compare implementation of INavigatable.hasChange())
EMF compare implementation of INavigatable.hasChange() [message #1750244] Mon, 19 December 2016 09:32 Go to next message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 27
Registered: August 2016
Junior Member
Hi,

In our application we have a number of different compares, using the eclipse compare UI.
When we are using "Previous" and "Next" buttons to navigate the differences, and there is no "Next" difference, we pop a dialog to say "You have reached the last difference".

For EMF compare I looked at the SelectNextDiffAction class, to see if I could produce this behaviour and add a message dialog here to do the same, with something like -

	public void run() {
		// Select next diff
		navigatable.selectChange(INavigatable.NEXT_CHANGE);
	
		if (!navigatable.hasChange(INavigatable.NEXT_CHANGE)) {
			Display display = Display.getCurrent();
			if (display != null) {
				MessageDialog.openInformation(display.getActiveShell(),
						CompareMessages.CompareNavigator_atEnd_title,
						CompareMessages.CompareNavigator_atEnd_message);
			}
		}
	}


However
navigatable.hasChange()
does not seem to work as expected, and debugging the code I think there may be a small defect?

Changing
	public boolean hasChange(int changeFlag) {
		TreeItem[] selection = viewer.getTree().getItems();
		...


to

	public boolean hasChange(int changeFlag) {
		TreeItem[] selection = viewer.getTree().getSelection();
		...


seems to fix the issue, as now the method works off the currently selected difference, and then returns false correctly if we are looking for the next difference and we are already at the end.

I'm just wondering if someone can confirm that this is the desired behaviour?
Re: EMF compare implementation of INavigatable.hasChange() [message #1750455 is a reply to message #1750244] Wed, 21 December 2016 09:00 Go to previous messageGo to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Conor,

thanks! I haven't tested it in detail, but looking into the code, it seems like there is a defect in oee.compare.ide.ui.internal.structuremergeviewer.Navigatable.hasChange(int) and your suggested fix appears to be correct.

Can you please open a bug report on that and submit a patch?

Thanks and 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/
Re: EMF compare implementation of INavigatable.hasChange() [message #1751179 is a reply to message #1750455] Thu, 05 January 2017 13:01 Go to previous messageGo to next message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 27
Registered: August 2016
Junior Member
Hi Philip - defect logged here - https://bugs.eclipse.org/bugs/show_bug.cgi?id=509975
Re: EMF compare implementation of INavigatable.hasChange() [message #1751345 is a reply to message #1751179] Mon, 09 January 2017 08:42 Go to previous message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Conor,

great, thanks a lot!

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/
Previous Topic:Automatically accept all non-conflicting changes
Next Topic:Adding extra nodes to the Content Merge Viewer
Goto Forum:
  


Current Time: Wed Apr 24 13:56:50 GMT 2024

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

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

Back to the top