Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 11 package org.eclipse.compare; 12 13 import org.eclipse.compare.internal.Utilities; 14 import org.eclipse.core.runtime.IAdaptable; 15 16 24 public abstract class CompareNavigator implements ICompareNavigator { 25 26 29 public boolean selectChange(boolean next) { 30 INavigatable[] navigators= getNavigatables(); 32 Object downStreamInput = null; 33 for (int i = navigators.length - 1; i >=0; i--) { 34 INavigatable navigatable = navigators[i]; 35 if (navigatable.getInput() == downStreamInput) { 36 continue; 38 } 39 if (navigatable.selectChange(next ? INavigatable.NEXT_CHANGE : INavigatable.PREVIOUS_CHANGE)) { 40 downStreamInput = navigatable.getInput(); 42 continue; 43 } 44 if (i + 1 < navigators.length && navigators[i+1] != null && navigators[i+1].getInput() != downStreamInput) { 46 navigators[i+1].selectChange(next ? INavigatable.FIRST_CHANGE : INavigatable.LAST_CHANGE); 49 } 50 return false; 51 } 52 53 return true; 54 } 55 56 protected abstract INavigatable[] getNavigatables(); 57 58 67 protected final INavigatable getNavigator(Object object) { 68 if (object == null) 69 return null; 70 Object data= Utilities.getAdapter(object, INavigatable.class); 71 if (data instanceof INavigatable) 72 return (INavigatable) data; 73 return null; 74 } 75 76 84 public boolean hasChange(boolean next) { 85 INavigatable[] navigators= getNavigatables(); 86 Object downStreamInput = null; 87 for (int i = navigators.length - 1; i >=0; i--) { 88 INavigatable navigatable = navigators[i]; 89 if (navigatable.getInput() == downStreamInput) { 90 continue; 92 } 93 if (navigatable.hasChange(next ? INavigatable.NEXT_CHANGE : INavigatable.PREVIOUS_CHANGE)) { 94 return true; 95 } 96 downStreamInput = navigatable.getInput(); 98 } 99 return false; 100 } 101 } 102
| Popular Tags
|