1 11 package org.eclipse.core.runtime; 12 13 23 public abstract class ProgressMonitorWrapper implements IProgressMonitor, IProgressMonitorWithBlocking { 24 25 26 private IProgressMonitor progressMonitor; 27 28 33 protected ProgressMonitorWrapper(IProgressMonitor monitor) { 34 Assert.isNotNull(monitor); 35 progressMonitor = monitor; 36 } 37 38 46 public void beginTask(String name, int totalWork) { 47 progressMonitor.beginTask(name, totalWork); 48 } 49 50 59 public void clearBlocked() { 60 if (progressMonitor instanceof IProgressMonitorWithBlocking) 61 ((IProgressMonitorWithBlocking) progressMonitor).clearBlocked(); 62 } 63 64 72 public void done() { 73 progressMonitor.done(); 74 } 75 76 81 public IProgressMonitor getWrappedProgressMonitor() { 82 return progressMonitor; 83 } 84 85 93 public void internalWorked(double work) { 94 progressMonitor.internalWorked(work); 95 } 96 97 105 public boolean isCanceled() { 106 return progressMonitor.isCanceled(); 107 } 108 109 118 public void setBlocked(IStatus reason) { 119 if (progressMonitor instanceof IProgressMonitorWithBlocking) 120 ((IProgressMonitorWithBlocking) progressMonitor).setBlocked(reason); 121 } 122 123 131 public void setCanceled(boolean b) { 132 progressMonitor.setCanceled(b); 133 } 134 135 143 public void setTaskName(String name) { 144 progressMonitor.setTaskName(name); 145 } 146 147 155 public void subTask(String name) { 156 progressMonitor.subTask(name); 157 } 158 159 167 public void worked(int work) { 168 progressMonitor.worked(work); 169 } 170 } 171 | Popular Tags |