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

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

Introduction

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

Prototype

public static final boolean isExcluded(IJavaElement element) 

Source Link

Usage

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

License:Open Source License

/**
 * Sets the deltas to register the changes resulting from this operation
 * for this source element and its destination.
 * If the operation is a cross project operation<ul>
 * <li>On a copy, the delta should be rooted in the dest project
 * <li>On a move, two deltas are generated<ul>
 *          <li>one rooted in the source project
 *         <li>one rooted in the destination project</ul></ul>
 * If the operation is rooted in a single project, the delta is rooted in that project
 *
 *//*from   w  w w  .j a v a 2s  . c  o  m*/
protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove) {
    if (Util.isExcluded(sourceElement) || Util.isExcluded(destinationElement))
        return;
    IJavaProject destProject = destinationElement.getJavaProject();
    if (isMove) {
        IJavaProject sourceProject = sourceElement.getJavaProject();
        getDeltaFor(sourceProject).movedFrom(sourceElement, destinationElement);
        getDeltaFor(destProject).movedTo(destinationElement, sourceElement);
    } else {
        getDeltaFor(destProject).added(destinationElement);
    }
}

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

License:Open Source License

public boolean exists() {
    // super.exist() only checks for the parent and the resource existence
    // so also ensure that:
    //  - the package is not excluded (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138577)
    //  - its name is valide (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108456)
    return super.exists() && !Util.isExcluded(this) && isValidPackageName();
}

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

License:Open Source License

/**
 * @see IPackageFragment#getCompilationUnits(WorkingCopyOwner)
 *///  ww w .j  a  v  a  2s  .  c om
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;
}

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

License:Open Source License

protected IStatus validateExistence(IResource underlyingResource) {
    // check that the name of the package is valid (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108456)
    if (!isValidPackageName())
        return newDoesNotExistStatus();

    // check whether this pkg can be opened
    if (underlyingResource != null && !resourceExists(underlyingResource))
        return newDoesNotExistStatus();

    // check that it is not excluded (https://bugs.eclipse.org/bugs/show_bug.cgi?id=138577)
    int kind;/* ww  w.  j a  v a  2s.c o m*/
    try {
        kind = getKind();
    } catch (JavaModelException e) {
        return e.getStatus();
    }
    if (kind == IPackageFragmentRoot.K_SOURCE && Util.isExcluded(this))
        return newDoesNotExistStatus();

    return JavaModelStatus.VERIFIED_OK;
}

From source file:org.sculptor.dsl.ui.resource.MavenClasspathUriResolver.java

License:Apache License

/**
 * Returns <code>true</code> if the given {@link IPackageFragment} contains
 * source files, its underlying {@link IResource} is accessible and it is
 * excluded from its root's classpath./*from ww  w  .j a va 2 s  .  c o  m*/
 */
protected boolean isMavenResourceDirectory(IPackageFragment packageFragment) throws JavaModelException {
    if (packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE) {
        // check whether this pkg can be opened
        IResource underlyingResource = packageFragment.getUnderlyingResource();
        if (underlyingResource != null && underlyingResource.isAccessible()) {
            return Util.isExcluded(packageFragment);
        }
    }
    return false;
}