Java Code Examples for org.eclipse.jdt.internal.corext.util.Strings#isLowerCase()

The following examples show how to use org.eclipse.jdt.internal.corext.util.Strings#isLowerCase() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeInfoViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int compareName(String leftString, String rightString) {
	int result= leftString.compareToIgnoreCase(rightString);
	if (result != 0 || rightString.length() == 0) {
		return result;
	} else if (Strings.isLowerCase(leftString.charAt(0)) &&
		!Strings.isLowerCase(rightString.charAt(0))) {
    		return +1;
	} else if (Strings.isLowerCase(rightString.charAt(0)) &&
    		!Strings.isLowerCase(leftString.charAt(0))) {
    		return -1;
	} else {
		return leftString.compareTo(rightString);
	}
}
 
Example 2
Source File: OrganizeImportsOperation.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Tries to find the given type name and add it to the import structure.
 * @param ref the name node
 */
public void add(SimpleName ref) {
	String typeName= ref.getIdentifier();

	if (fImportsAdded.contains(typeName)) {
		return;
	}

	IBinding binding= ref.resolveBinding();
	if (binding != null) {
		if (binding.getKind() != IBinding.TYPE) {
			return;
		}
		ITypeBinding typeBinding= (ITypeBinding) binding;
		if (typeBinding.isArray()) {
			typeBinding= typeBinding.getElementType();
		}
		typeBinding= typeBinding.getTypeDeclaration();
		if (!typeBinding.isRecovered()) {
			if (needsImport(typeBinding, ref)) {
				fImpStructure.addImport(typeBinding);
				fImportsAdded.add(typeName);
			}
			return;
		}
	} else {
		if (fDoIgnoreLowerCaseNames && typeName.length() > 0) {
			char ch= typeName.charAt(0);
			if (Strings.isLowerCase(ch) && Character.isLetter(ch)) {
				return;
			}
		}
	}
	fImportsAdded.add(typeName);
	fUnresolvedTypes.put(typeName, new UnresolvedTypeData(ref));
}
 
Example 3
Source File: FilteredTypesSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int compareName(String leftString, String rightString) {
	int result= leftString.compareToIgnoreCase(rightString);
	if (result != 0 || rightString.length() == 0) {
		return result;
	} else if (Strings.isLowerCase(leftString.charAt(0)) && !Strings.isLowerCase(rightString.charAt(0))) {
		return +1;
	} else if (Strings.isLowerCase(rightString.charAt(0)) && !Strings.isLowerCase(leftString.charAt(0))) {
		return -1;
	} else {
		return leftString.compareTo(rightString);
	}
}