1 11 12 package org.eclipse.ui.internal.util; 13 14 import java.util.Hashtable ; 15 import java.util.Iterator ; 16 import java.util.Map ; 17 18 import org.eclipse.swt.graphics.Color; 19 import org.eclipse.swt.graphics.Font; 20 import org.eclipse.swt.graphics.Image; 21 22 26 public class SWTResourceUtil { 27 28 33 private static Map imageTable = new Hashtable (40); 34 35 39 private static Map colorTable = new Hashtable (7); 40 41 45 private static Map fontTable = new Hashtable (7); 46 47 51 public static final void shutdown() { 52 if (imageTable != null) { 53 for (Iterator i = imageTable.values().iterator(); i.hasNext();) { 54 ((Image) i.next()).dispose(); 55 } 56 imageTable = null; 57 } 58 if (colorTable != null) { 59 for (Iterator i = colorTable.values().iterator(); i.hasNext();) { 60 ((Color) i.next()).dispose(); 61 } 62 colorTable = null; 63 } 64 if (fontTable != null) { 65 for (Iterator i = fontTable.values().iterator(); i.hasNext();) { 66 ((Font) i.next()).dispose(); 67 } 68 fontTable = null; 69 } 70 } 71 72 76 public static Map getColorTable() { 77 return colorTable; 78 } 79 80 84 public static Map getFontTable() { 85 return fontTable; 86 } 87 88 92 public static Map getImageTable() { 93 return imageTable; 94 } 95 } 96 | Popular Tags |