private static SubMonitor getImpl() { if(impl == null) { impl = new SubMonitor(); } return impl; } }
/** * <p>Converts an unknown (possibly null) IProgressMonitor into a SubMonitor allocated * with the given number of ticks. It is not necessary to call done() on the result, * but the caller is responsible for calling done() on the argument. Calls beginTask * on the argument.</p> * * <p>This method should generally be called at the beginning of a method that accepts * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor.</p> * * @param monitor to convert into a SubMonitor instance or null. If given a null argument, * the resulting SubMonitor will not report its progress anywhere. * @param taskName user readable name to pass to monitor.beginTask. Never null. * @param work initial number of ticks to allocate for children of the SubMonitor * @return a new SubMonitor instance that is a child of the given monitor */ public static SubMonitor convert(IProgressMonitor monitor, String taskName, int work) { if (monitor == null) monitor = new NullProgressMonitor(); // Optimization: if the given monitor already a SubMonitor, no conversion is necessary if (monitor instanceof SubMonitor) { monitor.beginTask(taskName, work); return (SubMonitor) monitor; } monitor.beginTask(taskName, MINIMUM_RESOLUTION); return new SubMonitor(new RootInfo(monitor), MINIMUM_RESOLUTION, work, SUPPRESS_NONE); }
/** * <p>Converts an unknown (possibly null) IProgressMonitor into a SubMonitor allocated * with the given number of ticks. It is not necessary to call done() on the result, * but the caller is responsible for calling done() on the argument. Calls beginTask * on the argument.</p> * * <p>This method should generally be called at the beginning of a method that accepts * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor.</p> * * @param monitor to convert into a SubMonitor instance or null. If given a null argument, * the resulting SubMonitor will not report its progress anywhere. * @param taskName user readable name to pass to monitor.beginTask. Never null. * @param work initial number of ticks to allocate for children of the SubMonitor * @return a new SubMonitor instance that is a child of the given monitor */ public static SubMonitor convert(IProgressMonitor monitor, String taskName, int work) { if (monitor == null) monitor = new NullProgressMonitor(); // Optimization: if the given monitor already a SubMonitor, no conversion is necessary if (monitor instanceof SubMonitor) { monitor.beginTask(taskName, work); return (SubMonitor) monitor; } monitor.beginTask(taskName, MINIMUM_RESOLUTION); return new SubMonitor(new RootInfo(monitor), MINIMUM_RESOLUTION, work, SUPPRESS_NONE); }
/** * <p>Converts an unknown (possibly null) IProgressMonitor into a SubMonitor allocated * with the given number of ticks. It is not necessary to call done() on the result, * but the caller is responsible for calling done() on the argument. Calls beginTask * on the argument.</p> * * <p>This method should generally be called at the beginning of a method that accepts * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor.</p> * * @param monitor to convert into a SubMonitor instance or null. If given a null argument, * the resulting SubMonitor will not report its progress anywhere. * @param taskName user readable name to pass to monitor.beginTask. Never null. * @param work initial number of ticks to allocate for children of the SubMonitor * @return a new SubMonitor instance that is a child of the given monitor */ public static SubMonitor convert(IProgressMonitor monitor, String taskName, int work) { if (monitor == null) monitor = new NullProgressMonitor(); // Optimization: if the given monitor already a SubMonitor, no conversion is necessary if (monitor instanceof SubMonitor) { monitor.beginTask(taskName, work); return (SubMonitor) monitor; } monitor.beginTask(taskName, MINIMUM_RESOLUTION); return new SubMonitor(new RootInfo(monitor), MINIMUM_RESOLUTION, work, SUPPRESS_NONE); }
/** * <p>Converts an unknown (possibly null) IProgressMonitor into a SubMonitor allocated * with the given number of ticks. It is not necessary to call done() on the result, * but the caller is responsible for calling done() on the argument. Calls beginTask * on the argument.</p> * * <p>This method should generally be called at the beginning of a method that accepts * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor.</p> * * <p>Since it is illegal to call beginTask on the same IProgressMonitor more than once, * the same instance of IProgressMonitor must not be passed to convert more than once.</p> * * @param monitor to convert into a SubMonitor instance or null. If given a null argument, * the resulting SubMonitor will not report its progress anywhere. * @param taskName user readable name to pass to monitor.beginTask. Never null. * @param work initial number of ticks to allocate for children of the SubMonitor * @return a new SubMonitor instance that is a child of the given monitor */ public static SubMonitor convert(IProgressMonitor monitor, String taskName, int work) { if (monitor == null) monitor = new NullProgressMonitor(); // Optimization: if the given monitor already a SubMonitor, no conversion is necessary if (monitor instanceof SubMonitor) { SubMonitor subMonitor = (SubMonitor) monitor; subMonitor.beginTaskImpl(taskName, work); return subMonitor; } monitor.beginTask(taskName, MINIMUM_RESOLUTION); return new SubMonitor(new RootInfo(monitor), MINIMUM_RESOLUTION, work, SUPPRESS_NONE); }
SubMonitor result = new SubMonitor(root, consume(totalWorkDouble), (int) totalWorkDouble, childFlags); lastSubMonitor = result; return result;
SubMonitor result = new SubMonitor(root, consume(totalWorkDouble), (int) totalWorkDouble, childFlags); lastSubMonitor = result; return result;
SubMonitor result = new SubMonitor(root, consume(totalWorkDouble), (int) totalWorkDouble, childFlags); lastSubMonitor = result; return result;
SubMonitor result = new SubMonitor(root, consume(totalWorkDouble), 0, childFlags); lastSubMonitor = result; return result;