String name1= ((IJavaElement) e1).getElementName(); String name2= ((IJavaElement) e2).getElementName();
String name1= getElementName(e1); String name2= getElementName(e2);
	public int compare(Viewer viewer, Object e1, Object e2) {		int cat1= category(e1);		int cat2= category(e2);		if (needsClasspathComparision(e1, cat1, e2, cat2)) {			IPackageFragmentRoot root1= getPackageFragmentRoot(e1);			IPackageFragmentRoot root2= getPackageFragmentRoot(e2);			if (root1 == null) {				if (root2 == null) {					return 0;				} else {					return 1;				}			} else if (root2 == null) {				return -1;			}			// check if not same to avoid expensive class path access			if (!root1.getPath().equals(root2.getPath())) {				int p1= getClassPathIndex(root1);				int p2= getClassPathIndex(root2);				if (p1 != p2) {					return p1 - p2;				}			}		}				if (cat1 != cat2)			return cat1 - cat2;		if (cat1 == PROJECTS || cat1 == RESOURCES || cat1 == RESOURCEFOLDERS || cat1 == STORAGE || cat1 == OTHERS) {			String name1= getNonJavaElementLabel(viewer, e1);			String name2= getNonJavaElementLabel(viewer, e2);			if (name1 != null && name2 != null) {				return getCollator().compare(name1, name2);			}			return 0; // can't compare		}		// only java elements from this point				if (e1 instanceof IMember) {			if (fMemberOrderCache.isSortByVisibility()) {				try {					int flags1= JdtFlags.getVisibilityCode((IMember) e1);					int flags2= JdtFlags.getVisibilityCode((IMember) e2);					int vis= fMemberOrderCache.getVisibilityIndex(flags1) - fMemberOrderCache.getVisibilityIndex(flags2);					if (vis != 0) {						return vis;					}				} catch (JavaModelException ignore) {				}			}		}				String name1= ((IJavaElement) e1).getElementName();		String name2= ((IJavaElement) e2).getElementName();				if (e1 instanceof IType) { // handle anonymous types			if (name1.length() == 0) {				if (name2.length() == 0) {					try {						return getCollator().compare(((IType) e1).getSuperclassName(), ((IType) e2).getSuperclassName());					} catch (JavaModelException e) {						return 0;					}				} else {					return 1;				}			} else if (name2.length() == 0) {				return -1;			}		}						int cmp= getCollator().compare(name1, name2);		if (cmp != 0) {			return cmp;		}				if (e1 instanceof IMethod) {			String[] params1= ((IMethod) e1).getParameterTypes();			String[] params2= ((IMethod) e2).getParameterTypes();			int len= Math.min(params1.length, params2.length);			for (int i = 0; i < len; i++) {				cmp= getCollator().compare(Signature.toString(params1[i]), Signature.toString(params2[i]));				if (cmp != 0) {					return cmp;				}			}			return params1.length - params2.length;		}		return 0;	}