Example usage for org.eclipse.jdt.internal.core.builder ReferenceCollection internQualifiedNames

List of usage examples for org.eclipse.jdt.internal.core.builder ReferenceCollection internQualifiedNames

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.builder ReferenceCollection internQualifiedNames.

Prototype

public static char[][][] internQualifiedNames(char[][][] qualifiedNames, boolean keepWellKnown) 

Source Link

Document

Use a flyweight cache for the char arrays to avoid duplicated arrays with the same contents.

Usage

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

License:Open Source License

private char[][][] getQualifiedNames(ObjectVector types) {
    final int size = types.size;
    char[][][] focusQualifiedNames = null;
    IJavaElement javaElement = this.pattern.focus;
    int index = 0;
    while (javaElement != null && !(javaElement instanceof ITypeRoot)) {
        javaElement = javaElement.getParent();
    }// ww  w .j a  v a 2s. c  o m
    if (javaElement != null) {
        IType primaryType = ((ITypeRoot) javaElement).findPrimaryType();
        if (primaryType != null) {
            focusQualifiedNames = new char[size + 1][][];
            focusQualifiedNames[index++] = CharOperation.splitOn('.',
                    primaryType.getFullyQualifiedName().toCharArray());
        }
    }
    if (focusQualifiedNames == null) {
        focusQualifiedNames = new char[size][][];
    }
    for (int i = 0; i < size; i++) {
        focusQualifiedNames[index++] = CharOperation.splitOn('.',
                ((IType) (types.elementAt(i))).getFullyQualifiedName().toCharArray());
    }
    return focusQualifiedNames.length == 0 ? null
            : ReferenceCollection.internQualifiedNames(focusQualifiedNames, true);
}