List of usage examples for org.eclipse.jdt.internal.core.builder JavaBuilder readState
public static State readState(IProject project, DataInputStream in) throws IOException, CoreException
From source file:org.eclipse.jdt.internal.core.JavaModelManager.java
License:Open Source License
/** * Reads the build state for the relevant project. *//*w w w . j a v a 2 s. c o m*/ protected Object readState(IProject project) throws CoreException { File file = getSerializationFile(project); if (file != null && file.exists()) { try { DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); try { String pluginID = in.readUTF(); if (!pluginID.equals(JavaCore.PLUGIN_ID)) throw new IOException(Messages.build_wrongFileFormat); String kind = in.readUTF(); if (!kind.equals("STATE")) //$NON-NLS-1$ throw new IOException(Messages.build_wrongFileFormat); if (in.readBoolean()) return JavaBuilder.readState(project, in); if (JavaBuilder.DEBUG) System.out.println("Saved state thinks last build failed for " + project.getName()); //$NON-NLS-1$ } finally { in.close(); } } catch (Exception e) { e.printStackTrace(); throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project " + project.getName(), e)); //$NON-NLS-1$ } } else if (JavaBuilder.DEBUG) { if (file == null) System.out.println("Project does not exist: " + project); //$NON-NLS-1$ else System.out.println("Build state file " + file.getPath() + " does not exist"); //$NON-NLS-1$ //$NON-NLS-2$ } return null; }
From source file:org.objectstyle.wolips.target.TargetBuilderPersistenceStore.java
License:Open Source License
protected void readStateFrom(File target) { try {/*from w w w. j ava2s . c o m*/ DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(target))); try { int stateCount = in.readInt(); for (int i = 0; i < stateCount; i++) { String key = in.readUTF(); // This is not correct. State buildState = JavaBuilder.readState(null, in); setBuildStateForKey(buildState, key); } } finally { in.close(); } } catch (Exception e) { System.out.println(e); } }