protected void compile(SourceFile[] units, SourceFile[] additionalUnits, boolean compilingFirstGroup) { if (units.length == 0) return; this.notifier.aboutToCompile(units[0]); // just to change the message initialTypeNames[i] = units[i].initialTypeName; this.nameEnvironment.setNames(initialTypeNames, additionalUnits); this.notifier.checkCancel(); try { this.inCompiler = true; this.notifier.checkCancel();
/** * Notification while within a compile that a unit has finished being compiled. */ public void compiled(SourceFile unit) { String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString()); subTask(message); updateProgressDelta(this.progressPerCompilationUnit); checkCancelWithinCompiler(); }
public void subTask(String message) { String pm = problemsMessage(); String msg = pm.length() == 0 ? message : pm + " " + message; //$NON-NLS-1$ if (msg.equals(this.previousSubtask)) return; // avoid refreshing with same one //if (JavaBuilder.DEBUG) System.out.println(msg); if (this.monitor != null) this.monitor.subTask(msg); this.previousSubtask = msg; }
private void buildAll() { this.notifier.checkCancel(); this.notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && this.lastState != null) System.out.println("JavaBuilder: Clearing last state : " + this.lastState); //$NON-NLS-1$ clearLastState(); BatchImageBuilder imageBuilder = new BatchImageBuilder(this, true); imageBuilder.build(); recordNewState(imageBuilder.newState); }
protected void clean(IProgressMonitor monitor) throws CoreException { this.currentProject = getProject(); if (this.currentProject == null || !this.currentProject.isAccessible()) return; if (DEBUG) System.out.println("\nJavaBuilder: Cleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ this.notifier = new BuildNotifier(monitor, this.currentProject); this.notifier.begin(); try { this.notifier.checkCancel(); initializeBuilder(CLEAN_BUILD, true); if (DEBUG) System.out.println("JavaBuilder: Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$ clearLastState(); removeProblemsAndTasksFor(this.currentProject); new BatchImageBuilder(this, false).cleanOutputFolders(false); } catch (CoreException e) { Util.log(e, "JavaBuilder handling CoreException while cleaning: " + this.currentProject.getName()); //$NON-NLS-1$ createInconsistentBuildMarker(e); } finally { this.notifier.done(); cleanup(); } if (DEBUG) System.out.println("JavaBuilder: Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ }
resetCollections(); this.notifier.subTask(Messages.build_analyzingDeltas); if (this.javaBuilder.hasBuildpathErrors()) { this.javaBuilder.currentProject.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); addAllSourceFiles(this.sourceFiles); this.notifier.updateProgressDelta(0.25f); } else { IResourceDelta sourceDelta = (IResourceDelta) deltas.get(this.javaBuilder.currentProject); if (sourceDelta != null) if (!findSourceFiles(sourceDelta)) return false; this.notifier.updateProgressDelta(0.10f); this.notifier.updateProgressDelta(0.10f); this.notifier.subTask(Messages.build_analyzingSources); addAffectedSourceFiles(); this.notifier.updateProgressDelta(0.05f); return false; this.notifier.checkCancel(); this.notifier.setProgressPerCompilationUnit(increment / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles);
private boolean incrementalBuildLoop() throws CoreException { int compileLoop = 0; float increment = 0.40f; while (this.sourceFiles.size() > 0) { // added to in acceptResult if (++compileLoop > MaxCompileLoop) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... exceeded loop count"); //$NON-NLS-1$ return false; } this.notifier.checkCancel(); SourceFile[] allSourceFiles = new SourceFile[this.sourceFiles.size()]; this.sourceFiles.toArray(allSourceFiles); resetCollections(); this.workQueue.addAll(allSourceFiles); this.notifier.setProgressPerCompilationUnit(increment / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles); removeSecondaryTypes(); addAffectedSourceFiles(); } return true; }
for (int j = 0, m = children.length; j < m; j++) findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes); this.notifier.checkCancel();
/** * Hook allowing to reset some static state after a complete build iteration. * This hook is invoked during POST_AUTO_BUILD notification */ public static void buildFinished() { BuildNotifier.resetProblemCounters(); }
/** * Check whether the build has been canceled. * Must use this call instead of checkCancel() when within the compiler. */ public void checkCancelWithinCompiler() { if (this.monitor != null && this.monitor.isCanceled() && !this.cancelling) { // Once the compiler has been canceled, don't check again. setCancelling(true); // Only AbortCompilation can stop the compiler cleanly. // We check cancelation again following the call to compile. throw new AbortCompilation(true, null); } }
private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName) { if (this.notifier != null) this.notifier.checkCancelWithinCompiler();
this.notifier.compiled(compilationUnit);
protected void clean(IProgressMonitor monitor) throws CoreException { this.currentProject = getProject(); if (this.currentProject == null || !this.currentProject.isAccessible()) return; if (DEBUG) System.out.println("\nJavaBuilder: Cleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ this.notifier = new BuildNotifier(monitor, this.currentProject); this.notifier.begin(); try { this.notifier.checkCancel(); initializeBuilder(CLEAN_BUILD, true); if (DEBUG) System.out.println("JavaBuilder: Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$ clearLastState(); removeProblemsAndTasksFor(this.currentProject); new BatchImageBuilder(this, false).cleanOutputFolders(false); } catch (CoreException e) { Util.log(e, "JavaBuilder handling CoreException while cleaning: " + this.currentProject.getName()); //$NON-NLS-1$ createInconsistentBuildMarker(e); } finally { this.notifier.done(); cleanup(); } if (DEBUG) System.out.println("JavaBuilder: Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ }
private void buildAll() { this.notifier.checkCancel(); this.notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && this.lastState != null) System.out.println("JavaBuilder: Clearing last state : " + this.lastState); //$NON-NLS-1$ clearLastState(); BatchImageBuilder imageBuilder = new BatchImageBuilder(this, true); imageBuilder.build(); recordNewState(imageBuilder.newState); }
resetCollections(); this.notifier.subTask(Messages.build_analyzingDeltas); if (this.javaBuilder.hasBuildpathErrors()) { this.javaBuilder.currentProject.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); addAllSourceFiles(this.sourceFiles); this.notifier.updateProgressDelta(0.25f); } else { IResourceDelta sourceDelta = (IResourceDelta) deltas.get(this.javaBuilder.currentProject); if (sourceDelta != null) if (!findSourceFiles(sourceDelta)) return false; this.notifier.updateProgressDelta(0.10f); this.notifier.updateProgressDelta(0.10f); this.notifier.subTask(Messages.build_analyzingSources); addAffectedSourceFiles(); this.notifier.updateProgressDelta(0.05f); return false; this.notifier.checkCancel(); this.notifier.setProgressPerCompilationUnit(increment / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles);
protected void buildAfterBatchBuild() { // called from a batch builder once all source files have been compiled AND some changes // need to be propagated incrementally (annotations, missing secondary types) if (JavaBuilder.DEBUG) System.out.println("INCREMENTAL build after batch build @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ // this is a copy of the incremental build loop try { addAffectedSourceFiles(); while (this.sourceFiles.size() > 0) { this.notifier.checkCancel(); SourceFile[] allSourceFiles = new SourceFile[this.sourceFiles.size()]; this.sourceFiles.toArray(allSourceFiles); resetCollections(); this.notifier.setProgressPerCompilationUnit(0.08f / allSourceFiles.length); this.workQueue.addAll(allSourceFiles); compile(allSourceFiles); removeSecondaryTypes(); addAffectedSourceFiles(); } } catch (CoreException e) { throw internalException(e); } finally { cleanUp(); } }
for (int j = 0, m = children.length; j < m; j++) findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes); this.notifier.checkCancel();
/** * Hook allowing to reset some static state after a complete build iteration. * This hook is invoked during POST_AUTO_BUILD notification */ public static void buildFinished() { BuildNotifier.resetProblemCounters(); }
/** * Check whether the build has been canceled. * Must use this call instead of checkCancel() when within the compiler. */ public void checkCancelWithinCompiler() { if (this.monitor != null && this.monitor.isCanceled() && !this.cancelling) { // Once the compiler has been canceled, don't check again. setCancelling(true); // Only AbortCompilation can stop the compiler cleanly. // We check cancelation again following the call to compile. throw new AbortCompilation(true, null); } }
private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName) { if (this.notifier != null) this.notifier.checkCancelWithinCompiler();