1 11 package org.eclipse.jsch.internal.core; 12 13 import org.eclipse.core.runtime.*; 14 15 public class Policy{ 16 17 public static void checkCanceled(IProgressMonitor monitor){ 18 if(monitor.isCanceled()) 19 throw new OperationCanceledException(); 20 } 21 22 public static IProgressMonitor monitorFor(IProgressMonitor monitor){ 23 if(monitor==null) 24 return new NullProgressMonitor(); 25 return monitor; 26 } 27 28 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, 29 int ticks){ 30 if(monitor==null) 31 return new NullProgressMonitor(); 32 if(monitor instanceof NullProgressMonitor) 33 return monitor; 34 return new SubProgressMonitor(monitor, ticks); 35 } 36 37 } 38 | Popular Tags |