1 11 package org.eclipse.core.internal.runtime; 12 13 import java.util.Date ; 14 import org.eclipse.core.runtime.*; 15 16 public class Policy { 17 18 public static IProgressMonitor monitorFor(IProgressMonitor monitor) { 19 if (monitor == null) 20 return new NullProgressMonitor(); 21 return monitor; 22 } 23 24 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { 25 if (monitor == null) 26 return new NullProgressMonitor(); 27 if (monitor instanceof NullProgressMonitor) 28 return monitor; 29 return new SubProgressMonitor(monitor, ticks); 30 } 31 32 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) { 33 if (monitor == null) 34 return new NullProgressMonitor(); 35 if (monitor instanceof NullProgressMonitor) 36 return monitor; 37 return new SubProgressMonitor(monitor, ticks, style); 38 } 39 40 44 public static void debug(String message) { 45 StringBuffer buffer = new StringBuffer (); 46 buffer.append(new Date (System.currentTimeMillis())); 47 buffer.append(" - ["); buffer.append(Thread.currentThread().getName()); 49 buffer.append("] "); buffer.append(message); 51 System.out.println(buffer.toString()); 52 } 53 } 54 | Popular Tags |