Example usage for org.eclipse.jdt.internal.compiler.util ObjectVector size

List of usage examples for org.eclipse.jdt.internal.compiler.util ObjectVector size

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.util ObjectVector size.

Prototype

int size

To view the source code for org.eclipse.jdt.internal.compiler.util ObjectVector size.

Click Source Link

Usage

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

License:Open Source License

public PossibleMatch[] getPossibleMatches(IPackageFragmentRoot[] roots) {
    PossibleMatch[] result = new PossibleMatch[this.elementCount];
    int index = 0;
    for (int i = 0, length = roots.length; i < length; i++) {
        ObjectVector possibleMatches = (ObjectVector) this.rootsToPossibleMatches.get(roots[i].getPath());
        if (possibleMatches != null) {
            possibleMatches.copyInto(result, index);
            index += possibleMatches.size();
        }//from   w  w  w . j  a v  a 2s. c  om
    }
    if (index < this.elementCount)
        System.arraycopy(result, 0, result = new PossibleMatch[index], 0, index);
    return result;
}

From source file:org.eclipse.che.jdt.internal.core.JavaProject.java

License:Open Source License

/**
 * Returns (local/all) the package fragment roots identified by the given project's classpath.
 * Note: this follows project classpath references to find required project contributions,
 * eliminating duplicates silently.//from   w w w  .j a  v  a 2  s . co  m
 * Only works with resolved entries
 *
 * @param resolvedClasspath
 *         IClasspathEntry[]
 * @param retrieveExportedRoots
 *         boolean
 * @return IPackageFragmentRoot[]
 * @throws JavaModelException
 */
public IPackageFragmentRoot[] computePackageFragmentRoots(IClasspathEntry[] resolvedClasspath,
        boolean retrieveExportedRoots, Map rootToResolvedEntries) throws JavaModelException {

    ObjectVector accumulatedRoots = new ObjectVector();
    computePackageFragmentRoots(resolvedClasspath, accumulatedRoots, new HashSet(5), // rootIDs
            null, // inside original project
            retrieveExportedRoots, rootToResolvedEntries);
    IPackageFragmentRoot[] rootArray = new IPackageFragmentRoot[accumulatedRoots.size()];
    accumulatedRoots.copyInto(rootArray);
    return rootArray;
}

From source file:org.eclipse.jdt.internal.core.JavaProject.java

License:Open Source License

/**
 * This is a helper method returning the expanded classpath for the project, as a list of classpath entries,
 * where all classpath variable entries have been resolved and substituted with their final target entries.
 * All project exports have been appended to project entries.
 * @return IClasspathEntry[]// w w  w .  j a  va  2 s.c o m
 * @throws JavaModelException
 */
public IClasspathEntry[] getExpandedClasspath() throws JavaModelException {

    ObjectVector accumulatedEntries = new ObjectVector();
    computeExpandedClasspath(null, new HashSet(5), accumulatedEntries);

    IClasspathEntry[] expandedPath = new IClasspathEntry[accumulatedEntries.size()];
    accumulatedEntries.copyInto(expandedPath);

    return expandedPath;
}

From source file:org.eclipse.recommenders.internal.chain.rcp.ChainCompletionProposalComputer.java

License:Open Source License

private static Set<String> getLocalVariableNames(final ObjectVector visibleLocalVariables) {
    final Set<String> names = Sets.newHashSet();
    for (int i = visibleLocalVariables.size(); i-- > 0;) {
        final LocalVariableBinding decl = (LocalVariableBinding) visibleLocalVariables.elementAt(i);
        names.add(Arrays.toString(decl.name));
    }/* w w  w . j av a2  s  . c o m*/
    return names;
}

From source file:org.eclipse.recommenders.internal.chain.rcp.ChainCompletionProposalComputer.java

License:Open Source License

private void resolveEntrypoints(final ObjectVector elements, final Set<String> localVariableNames) {
    for (int i = elements.size(); i-- > 0;) {
        final Binding decl = (Binding) elements.elementAt(i);
        if (!matchesPrefixToken(decl)) {
            continue;
        }/* w w w.  j a v a 2s.  c o m*/
        final String key = String.valueOf(decl.computeUniqueKey());
        if (key.startsWith("Ljava/lang/Object;")) { //$NON-NLS-1$
            continue;
        }
        boolean requiresThis = false;
        if (decl instanceof FieldBinding) {
            requiresThis = localVariableNames.contains(Arrays.toString(((FieldBinding) decl).name));
        }
        final ChainElement e = new ChainElement(decl, requiresThis);
        if (e.getReturnType() != null) {
            entrypoints.add(e);
        }
    }
}

From source file:org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.java

License:Open Source License

private IPackageFragmentRoot[] getSourceFolders(JavaProject javaProject) throws JavaModelException {
    /*/*from   ww  w .  jav  a  2  s . co  m*/
     * IJavaProject#getAllPackageFragmentRoots will open all references archives to read the JDK version from
     * the first class file it finds. This isn't necessary for our case thus we try to avoid this by copying a lot of 
     * code. 
     */
    ObjectVector result = new ObjectVector();
    collectSourcePackageFragmentRoots(javaProject, Sets.<String>newHashSet(), null, result);
    IPackageFragmentRoot[] rootArray = new IPackageFragmentRoot[result.size()];
    result.copyInto(rootArray);
    return rootArray;
}