Search in sources :

Example 1 with BuilderPersistentInfo

use of org.eclipse.core.internal.events.BuilderPersistentInfo in project polymap4-core by Polymap4.

the class WorkspaceTreeReader_1 method readTree.

public void readTree(IProject project, DataInputStream input, IProgressMonitor monitor) throws CoreException {
    monitor = Policy.monitorFor(monitor);
    String message;
    try {
        message = Messages.resources_reading;
        monitor.beginTask(message, 10);
        /* read the number of builders */
        int numBuilders = input.readInt();
        /* read in the list of builder names */
        String[] builderNames = new String[numBuilders];
        for (int i = 0; i < numBuilders; i++) {
            String builderName = input.readUTF();
            builderNames[i] = builderName;
        }
        monitor.worked(1);
        /* read and link the trees */
        ElementTree[] trees = readTrees(project.getFullPath(), input, Policy.subMonitorFor(monitor, 8));
        /* map builder names to trees */
        if (numBuilders > 0) {
            ArrayList infos = new ArrayList(trees.length * 2 + 1);
            for (int i = 0; i < numBuilders; i++) {
                BuilderPersistentInfo info = new BuilderPersistentInfo(project.getName(), builderNames[i], -1);
                info.setLastBuildTree(trees[i]);
                infos.add(info);
            }
            workspace.getBuildManager().setBuildersPersistentInfo(project, infos);
        }
        monitor.worked(1);
    } catch (IOException e) {
        message = Messages.resources_readProjectTree;
        throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, null, message, e);
    } finally {
        monitor.done();
    }
}
Also used : ElementTree(org.eclipse.core.internal.watson.ElementTree) BuilderPersistentInfo(org.eclipse.core.internal.events.BuilderPersistentInfo)

Example 2 with BuilderPersistentInfo

use of org.eclipse.core.internal.events.BuilderPersistentInfo in project polymap4-core by Polymap4.

the class WorkspaceTreeReader_2 method readBuildersPersistentInfo.

/*
	 * overwritten from WorkspaceTreeReader_1
	 */
protected void readBuildersPersistentInfo(IProject project, DataInputStream input, List builders, IProgressMonitor monitor) throws IOException {
    monitor = Policy.monitorFor(monitor);
    try {
        int builderCount = input.readInt();
        for (int i = 0; i < builderCount; i++) {
            BuilderPersistentInfo info = readBuilderInfo(project, input, i);
            // read interesting projects
            int n = input.readInt();
            IProject[] projects = new IProject[n];
            for (int j = 0; j < n; j++) projects[j] = workspace.getRoot().getProject(input.readUTF());
            info.setInterestingProjects(projects);
            builders.add(info);
        }
    } finally {
        monitor.done();
    }
}
Also used : BuilderPersistentInfo(org.eclipse.core.internal.events.BuilderPersistentInfo) IProject(org.eclipse.core.resources.IProject)

Example 3 with BuilderPersistentInfo

use of org.eclipse.core.internal.events.BuilderPersistentInfo in project polymap4-core by Polymap4.

the class WorkspaceTreeReader_1 method linkBuildersToTrees.

protected void linkBuildersToTrees(List buildersToBeLinked, ElementTree[] trees, int index, IProgressMonitor monitor) {
    monitor = Policy.monitorFor(monitor);
    try {
        ArrayList infos = null;
        String projectName = null;
        for (int i = 0; i < buildersToBeLinked.size(); i++) {
            BuilderPersistentInfo info = (BuilderPersistentInfo) buildersToBeLinked.get(i);
            if (!info.getProjectName().equals(projectName)) {
                if (infos != null) {
                    // if it is not the first iteration
                    IProject project = workspace.getRoot().getProject(projectName);
                    workspace.getBuildManager().setBuildersPersistentInfo(project, infos);
                }
                projectName = info.getProjectName();
                infos = new ArrayList(5);
            }
            info.setLastBuildTree(trees[index++]);
            infos.add(info);
        }
        if (infos != null) {
            IProject project = workspace.getRoot().getProject(projectName);
            workspace.getBuildManager().setBuildersPersistentInfo(project, infos);
        }
    } finally {
        monitor.done();
    }
}
Also used : BuilderPersistentInfo(org.eclipse.core.internal.events.BuilderPersistentInfo) IProject(org.eclipse.core.resources.IProject)

Aggregations

BuilderPersistentInfo (org.eclipse.core.internal.events.BuilderPersistentInfo)3 IProject (org.eclipse.core.resources.IProject)2 ElementTree (org.eclipse.core.internal.watson.ElementTree)1