Example usage for org.eclipse.jdt.internal.core JavaModelManager NO_WORKING_COPY

List of usage examples for org.eclipse.jdt.internal.core JavaModelManager NO_WORKING_COPY

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core JavaModelManager NO_WORKING_COPY.

Prototype

ICompilationUnit[] NO_WORKING_COPY

To view the source code for org.eclipse.jdt.internal.core JavaModelManager NO_WORKING_COPY.

Click Source Link

Usage

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

License:Open Source License

/**
 * @see IPackageFragment#getCompilationUnits(WorkingCopyOwner)
 *///  w  ww .ja  va2s  .co m
public ICompilationUnit[] getCompilationUnits(WorkingCopyOwner owner) {
    ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner,
            false/*don't add primary*/);
    if (workingCopies == null)
        return JavaModelManager.NO_WORKING_COPY;
    int length = workingCopies.length;
    ICompilationUnit[] result = new ICompilationUnit[length];
    int index = 0;
    for (int i = 0; i < length; i++) {
        ICompilationUnit wc = workingCopies[i];
        if (equals(wc.getParent()) && !Util.isExcluded(wc)) { // 59933 - excluded wc shouldn't be answered back
            result[index++] = wc;
        }
    }
    if (index != length) {
        System.arraycopy(result, 0, result = new ICompilationUnit[index], 0, index);
    }
    return result;
}