Example usage for org.eclipse.jdt.internal.core.builder ClasspathLocation getProjectRelativePath

List of usage examples for org.eclipse.jdt.internal.core.builder ClasspathLocation getProjectRelativePath

Introduction

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

Prototype

public abstract IPath getProjectRelativePath();

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.java

License:Open Source License

protected boolean findAffectedSourceFiles(IResourceDelta delta, ClasspathLocation[] classFoldersAndJars,
        IProject prereqProject) {//from ww w.j  a  v a  2s  .co  m
    for (int i = 0, l = classFoldersAndJars.length; i < l; i++) {
        ClasspathLocation bLocation = classFoldersAndJars[i];
        // either a .class file folder or a zip/jar file
        if (bLocation != null) { // skip unchanged output folder
            IPath p = bLocation.getProjectRelativePath();
            if (p != null) {
                IResourceDelta binaryDelta = delta.findMember(p);
                if (binaryDelta != null) {
                    if (bLocation instanceof ClasspathJar) {
                        if (JavaBuilder.DEBUG)
                            System.out.println("ABORTING incremental build... found delta to jar/zip file"); //$NON-NLS-1$
                        return false; // do full build since jar file was changed (added/removed were caught as classpath change)
                    }
                    if (binaryDelta.getKind() == IResourceDelta.ADDED
                            || binaryDelta.getKind() == IResourceDelta.REMOVED) {
                        if (JavaBuilder.DEBUG)
                            System.out
                                    .println("ABORTING incremental build... found added/removed binary folder"); //$NON-NLS-1$
                        return false; // added/removed binary folder should not make it here (classpath change), but handle anyways
                    }
                    int segmentCount = binaryDelta.getFullPath().segmentCount();
                    IResourceDelta[] children = binaryDelta.getAffectedChildren(); // .class files from class folder
                    StringSet structurallyChangedTypes = null;
                    if (bLocation.isOutputFolder())
                        structurallyChangedTypes = this.newState
                                .getStructurallyChangedTypes(this.javaBuilder.getLastState(prereqProject));
                    for (int j = 0, m = children.length; j < m; j++)
                        findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes);
                    this.notifier.checkCancel();
                }
            }
        }
    }
    return true;
}