1 11 package org.eclipse.core.internal.filesystem.local; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.core.runtime.ProgressMonitorWrapper; 15 16 23 public class InfiniteProgress extends ProgressMonitorWrapper { 24 32 private int totalWork; 33 private int currentIncrement = 4; 34 private int halfWay; 35 private int nextProgress = currentIncrement; 36 private int worked = 0; 37 38 protected InfiniteProgress(IProgressMonitor monitor) { 39 super(monitor); 40 } 41 42 public void beginTask(String name, int work) { 43 super.beginTask(name, work); 44 this.totalWork = work; 45 this.halfWay = totalWork / 2; 46 } 47 48 public void worked(int work) { 49 if (--nextProgress <= 0) { 50 super.worked(1); 52 worked++; 53 if (worked >= halfWay) { 54 currentIncrement *= 2; 57 halfWay += (totalWork - halfWay) / 2; 58 } 59 nextProgress = currentIncrement; 61 } 62 } 63 64 } 65 | Popular Tags |