1 11 package org.eclipse.team.internal.ui; 12 13 14 15 import java.util.ResourceBundle ; 16 17 import org.eclipse.core.runtime.*; 18 19 23 public class Policy { 24 public static boolean DEBUG_SYNC_MODELS = false; 26 27 private static String ACTION_BUNDLE = "org.eclipse.team.internal.ui.actions.actions"; private static ResourceBundle actionBundle = null; 29 30 33 public static ResourceBundle getActionBundle() { 34 ResourceBundle tmpBundle = actionBundle; 36 if (tmpBundle != null) 37 return tmpBundle; 38 return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE); 39 } 40 41 static { 42 if (TeamUIPlugin.getPlugin().isDebugging()) { 44 DEBUG_SYNC_MODELS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamUIPlugin.ID + "/syncmodels")); } 46 } 47 48 54 public static void checkCanceled(IProgressMonitor monitor) { 55 if (monitor.isCanceled()) { 56 throw new OperationCanceledException(); 57 } 58 } 59 60 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { 61 if (monitor == null) 62 return new NullProgressMonitor(); 63 if (monitor instanceof NullProgressMonitor) 64 return monitor; 65 return new SubProgressMonitor(monitor, ticks); 66 } 67 68 public static IProgressMonitor monitorFor(IProgressMonitor monitor) { 69 if (monitor == null) 70 return new NullProgressMonitor(); 71 return monitor; 72 } 73 } 74 | Popular Tags |