Example usage for org.eclipse.jdt.core.compiler CompilationParticipant NEEDS_FULL_BUILD

List of usage examples for org.eclipse.jdt.core.compiler CompilationParticipant NEEDS_FULL_BUILD

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.compiler CompilationParticipant NEEDS_FULL_BUILD.

Prototype

int NEEDS_FULL_BUILD

To view the source code for org.eclipse.jdt.core.compiler CompilationParticipant NEEDS_FULL_BUILD.

Click Source Link

Usage

From source file:net.sf.j2s.core.builder.JavaBuilder.java

License:Open Source License

private int initializeBuilder(int kind, boolean forBuild) throws CoreException {
    // some calls just need the nameEnvironment initialized so skip the rest
    this.javaProject = (JavaProject) JavaCore.create(this.currentProject);
    this.workspaceRoot = this.currentProject.getWorkspace().getRoot();

    if (forBuild) {
        // cache the known participants for this project
        this.participants = JavaModelManager.getJavaModelManager().compilationParticipants
                .getCompilationParticipants(this.javaProject);
        if (this.participants != null)
            for (int i = 0, l = this.participants.length; i < l; i++)
                if (this.participants[i]
                        .aboutToBuild(this.javaProject) == CompilationParticipant.NEEDS_FULL_BUILD)
                    kind = FULL_BUILD;/*www .j  av a2s. c o m*/

        // Flush the existing external files cache if this is the beginning of a build cycle
        String projectName = this.currentProject.getName();
        if (builtProjects == null || builtProjects.contains(projectName)) {
            try {
                Method method = JavaModel.class.getMethod("flushExternalFileCache", new Class[] { Void.class });
                if (method != null) {
                    method.invoke(JavaModel.class, new Object[0]);
                }
            } catch (Throwable e) {
                e.printStackTrace();
            }
            //JavaModel.flushExternalFileCache();
            builtProjects = new ArrayList();
        }
        builtProjects.add(projectName);
    }

    this.binaryLocationsPerProject = new SimpleLookupTable(3);
    this.nameEnvironment = new NameEnvironment(this.workspaceRoot, this.javaProject,
            this.binaryLocationsPerProject, this.notifier);

    if (forBuild) {
        String filterSequence = this.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true);
        char[][] filters = filterSequence != null && filterSequence.length() > 0
                ? CharOperation.splitAndTrimOn(',', filterSequence.toCharArray())
                : null;
        if (filters == null) {
            this.extraResourceFileFilters = null;
            this.extraResourceFolderFilters = null;
        } else {
            int fileCount = 0, folderCount = 0;
            for (int i = 0, l = filters.length; i < l; i++) {
                char[] f = filters[i];
                if (f.length == 0)
                    continue;
                if (f[f.length - 1] == '/')
                    folderCount++;
                else
                    fileCount++;
            }
            this.extraResourceFileFilters = new char[fileCount][];
            this.extraResourceFolderFilters = new String[folderCount];
            for (int i = 0, l = filters.length; i < l; i++) {
                char[] f = filters[i];
                if (f.length == 0)
                    continue;
                if (f[f.length - 1] == '/')
                    this.extraResourceFolderFilters[--folderCount] = new String(f, 0, f.length - 1);
                else
                    this.extraResourceFileFilters[--fileCount] = f;
            }
        }
    }
    return kind;
}

From source file:org.codecover.eclipse.builder.CodeCoverCompilationParticipant.java

License:Open Source License

@Override
public int aboutToBuild(IJavaProject project) {
    // until the instrumenter can handle incremental instrumentation we need to do full builds
    return CompilationParticipant.NEEDS_FULL_BUILD;
}