Example usage for org.eclipse.jdt.internal.core.util Util equalsIgnoreJavaLikeExtension

List of usage examples for org.eclipse.jdt.internal.core.util Util equalsIgnoreJavaLikeExtension

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.util Util equalsIgnoreJavaLikeExtension.

Prototype

public static boolean equalsIgnoreJavaLikeExtension(String fileName, String string) 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.NameLookup.java

License:Open Source License

private ICompilationUnit findCompilationUnit(String[] pkgName, String cuName, PackageFragmentRoot root) {
    if (!root.isArchive()) {
        IPackageFragment pkg = root.getPackageFragment(pkgName);
        try {/*from   www  . j a  va 2  s  .c om*/
            ICompilationUnit[] cus = pkg.getCompilationUnits();
            for (int j = 0, length = cus.length; j < length; j++) {
                ICompilationUnit cu = cus[j];
                if (Util.equalsIgnoreJavaLikeExtension(cu.getElementName(), cuName))
                    return cu;
            }
        } catch (JavaModelException e) {
            // pkg does not exist
            // -> try next package
        }
    }
    return null;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.NameLookup.java

License:Open Source License

/**
 * Returns true if the given cu's name matches the
 * specified <code>searchName</code>, otherwise false.
 * <p/>/*from  www  .  java2s . c  o  m*/
 * <p>The <code>partialMatch</code> argument indicates partial matches
 * should be considered.
 * NOTE: in partialMatch mode, the case will be ignored, and the searchName must already have
 * been lowercased.
 */
protected boolean nameMatches(String searchName, ICompilationUnit cu, boolean partialMatch) {
    if (partialMatch) {
        // partial matches are used in completion mode, thus case insensitive mode
        return cu.getElementName().toLowerCase().startsWith(searchName);
    } else {
        return Util.equalsIgnoreJavaLikeExtension(cu.getElementName(), searchName);
    }
}