1 11 package org.eclipse.compare.internal; 12 13 import java.util.*; 14 15 import org.eclipse.jface.operation.IRunnableWithProgress; 16 17 23 public class WorkQueue { 24 25 private List runnables = new ArrayList(); 26 27 public boolean add(IRunnableWithProgress runnable) { 28 if (runnables.contains(runnable)) 29 runnables.remove(runnable); 30 return runnables.add(runnable); 31 } 32 33 public void clear() { 34 runnables.clear(); 35 } 36 37 public boolean contains(IRunnableWithProgress runnable) { 38 return runnables.contains(runnable); 39 } 40 41 public boolean isEmpty() { 42 return runnables.isEmpty(); 43 } 44 45 public boolean remove(IRunnableWithProgress runnable) { 46 return runnables.remove(runnable); 47 } 48 49 public int size() { 50 return runnables.size(); 51 } 52 public IRunnableWithProgress remove() { 53 return (IRunnableWithProgress)runnables.remove(0); 54 } 55 56 57 } 58 | Popular Tags |