1 11 package org.eclipse.team.internal.core; 12 13 import org.eclipse.core.runtime.*; 14 15 public class Policy { 16 17 public static boolean DEBUG_STREAMS = false; 19 public static boolean DEBUG_REFRESH_JOB = true; 20 public static boolean DEBUG_BACKGROUND_EVENTS = false; 21 public static boolean DEBUG_THREADING = false; 22 23 static { 24 if (TeamPlugin.getPlugin().isDebugging()) { 26 DEBUG_STREAMS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/streams")); DEBUG_REFRESH_JOB = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/refreshjob")); DEBUG_BACKGROUND_EVENTS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/backgroundevents")); DEBUG_THREADING = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/threading")); } 31 } 32 33 36 public static void checkCanceled(IProgressMonitor monitor) { 37 if (monitor != null && monitor.isCanceled()) 38 throw new OperationCanceledException(); 39 } 40 public static IProgressMonitor monitorFor(IProgressMonitor monitor) { 41 if (monitor == null) 42 return new NullProgressMonitor(); 43 return monitor; 44 } 45 46 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { 47 if (monitor == null) 48 return new NullProgressMonitor(); 49 if (monitor instanceof NullProgressMonitor) 50 return monitor; 51 return new SubProgressMonitor(monitor, ticks); 52 } 53 54 public static IProgressMonitor infiniteSubMonitorFor(IProgressMonitor monitor, int ticks) { 55 if (monitor == null) 56 return new NullProgressMonitor(); 57 if (monitor instanceof NullProgressMonitor) 58 return monitor; 59 return new InfiniteSubProgressMonitor(monitor, ticks); 60 } 61 } 62 | Popular Tags |