1 11 package org.eclipse.jdt.internal.debug.ui.jres; 12 13 import org.eclipse.jdt.launching.IVMInstall; 14 import org.eclipse.jdt.launching.environments.IExecutionEnvironment; 15 import org.eclipse.jface.viewers.Viewer; 16 import org.eclipse.jface.viewers.ViewerSorter; 17 18 23 public class JREsEnvironmentSorter extends ViewerSorter { 24 25 IExecutionEnvironment fEnvironment; 26 27 30 public int category(Object element) { 31 if (fEnvironment == null) { 32 return super.category(element); 33 } else { 34 if (fEnvironment.isStrictlyCompatible((IVMInstall) element)) { 35 return 0; 36 } else { 37 return 1; 38 } 39 } 40 } 41 42 45 public int compare(Viewer viewer, Object e1, Object e2) { 46 fEnvironment = (IExecutionEnvironment) viewer.getInput(); 47 int result = super.compare(viewer, e1, e2); 48 fEnvironment = null; 49 return result; 50 } 51 52 } 53 | Popular Tags |