EMF compare implementation of INavigatable.hasChange() [message #1750244] |
Mon, 19 December 2016 09:32 |
Conor O'Mahony 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 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?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03607 seconds