use of org.eclipse.core.internal.watson.ElementTreeReader in project polymap4-core by Polymap4.
the class WorkspaceTreeReader_1 method readTrees.
/**
* Read trees from disk and link them to the workspace tree.
*/
protected ElementTree[] readTrees(IPath root, DataInputStream input, IProgressMonitor monitor) throws IOException {
monitor = Policy.monitorFor(monitor);
try {
String message = Messages.resources_reading;
monitor.beginTask(message, 4);
ElementTreeReader treeReader = new ElementTreeReader(workspace.getSaveManager());
ElementTree[] trees = treeReader.readDeltaChain(input);
monitor.worked(3);
if (root.isRoot()) {
// Don't need to link because we're reading the whole workspace.
// The last tree in the chain is the complete tree.
ElementTree newTree = trees[trees.length - 1];
newTree.setTreeData(workspace.tree.getTreeData());
workspace.tree = newTree;
} else {
// splice the restored tree into the current set of trees
workspace.linkTrees(root, trees);
}
monitor.worked(1);
return trees;
} finally {
monitor.done();
}
}
use of org.eclipse.core.internal.watson.ElementTreeReader in project polymap4-core by Polymap4.
the class WorkspaceTreeReader_1 method readSnapshotTree.
public ElementTree readSnapshotTree(DataInputStream input, ElementTree complete, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
String message;
try {
message = Messages.resources_readingSnap;
monitor.beginTask(message, Policy.totalWork);
ElementTreeReader reader = new ElementTreeReader(workspace.getSaveManager());
while (input.available() > 0) {
readWorkspaceFields(input, Policy.subMonitorFor(monitor, Policy.totalWork / 2));
complete = reader.readDelta(complete, input);
try {
// make sure each snapshot is read by the correct reader
int version = input.readInt();
if (version != getVersion())
return WorkspaceTreeReader.getReader(workspace, version).readSnapshotTree(input, complete, monitor);
} catch (EOFException e) {
break;
}
}
return complete;
} catch (IOException e) {
message = Messages.resources_readWorkspaceSnap;
throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, null, message, e);
} finally {
monitor.done();
}
}
Aggregations