1 23 package org.objectweb.clif.scenario.util.isac.gui; 24 30 import java.net.MalformedURLException ; 31 import java.net.URL ; 32 import java.util.Hashtable ; 33 34 import org.eclipse.jface.resource.ImageDescriptor; 35 import org.eclipse.jface.resource.ImageRegistry; 36 import org.objectweb.clif.scenario.util.isac.FileName; 37 import org.objectweb.clif.scenario.util.isac.util.tree.Node; 38 39 public class Icons { 40 private static ImageRegistry imageRegistry; 41 private static Hashtable imageDescriptorFileName; 42 43 50 public static URL newURL(String url) { 51 try { 52 return new URL ("file:" + url); 53 } catch (MalformedURLException e) { 54 throw new RuntimeException ("Malformed URL " + url, e); 55 } 56 } 57 58 public static Hashtable getImageDescriptorFileName() { 59 if (imageDescriptorFileName == null) { 60 imageDescriptorFileName = new Hashtable (); 61 imageDescriptorFileName.put(Node.BEHAVIOR, FileName.BEHAVIOR_ICON); 63 imageDescriptorFileName.put(Node.PLUGINS, FileName.PLUGINS_ICON); 64 imageDescriptorFileName.put(Node.USE, FileName.USE_ICON); 65 imageDescriptorFileName.put(Node.SAMPLE, FileName.SAMPLE_ICON); 66 imageDescriptorFileName.put(Node.TIMER, FileName.TIMER_ICON); 67 imageDescriptorFileName.put(Node.IF, FileName.IF_ICON); 68 imageDescriptorFileName.put(Node.NCHOICE, FileName.NCHOICE_ICON); 69 } 70 return imageDescriptorFileName; 71 } 72 73 public static ImageRegistry getImageRegistry() { 74 if (imageRegistry == null) { 75 imageRegistry = new ImageRegistry(); 76 imageRegistry.put(FileName.EXIT_ICON, ImageDescriptor 78 .createFromURL(newURL(FileName.EXIT_ICON))); 79 imageRegistry.put(FileName.ABOUT_ICON, ImageDescriptor 80 .createFromURL(newURL(FileName.ABOUT_ICON))); 81 imageRegistry.put(FileName.NEW_ICON, ImageDescriptor 82 .createFromURL(newURL(FileName.NEW_ICON))); 83 imageRegistry.put(FileName.OPEN_ICON, ImageDescriptor 84 .createFromURL(newURL(FileName.OPEN_ICON))); 85 imageRegistry.put(FileName.SAVE_ICON, ImageDescriptor 86 .createFromURL(newURL(FileName.SAVE_ICON))); 87 imageRegistry.put(FileName.SAVE_AS_ICON, ImageDescriptor 88 .createFromURL(newURL(FileName.SAVE_AS_ICON))); 89 imageRegistry.put(FileName.HELP_SHOW_ICON, ImageDescriptor 90 .createFromURL(newURL(FileName.HELP_SHOW_ICON))); 91 imageRegistry.put(FileName.HELP_HIDE_ICON, ImageDescriptor 92 .createFromURL(newURL(FileName.HELP_HIDE_ICON))); 93 imageRegistry.put(FileName.UP_ARROW_ICON, ImageDescriptor 94 .createFromURL(newURL(FileName.UP_ARROW_ICON))); 95 imageRegistry.put(FileName.DOWN_ARROW_ICON, ImageDescriptor 96 .createFromURL(newURL(FileName.DOWN_ARROW_ICON))); 97 imageRegistry.put(FileName.DELETE_ICON, ImageDescriptor 98 .createFromURL(newURL(FileName.DELETE_ICON))); 99 imageRegistry.put(FileName.COPY_ICON, ImageDescriptor 100 .createFromURL(newURL(FileName.COPY_ICON))); 101 imageRegistry.put(FileName.CUT_ICON, ImageDescriptor 102 .createFromURL(newURL(FileName.CUT_ICON))); 103 imageRegistry.put(FileName.PASTE_ICON, ImageDescriptor 104 .createFromURL(newURL(FileName.PASTE_ICON))); 105 imageRegistry.put(FileName.ADD_ICON, ImageDescriptor 106 .createFromURL(newURL(FileName.ADD_ICON))); 107 imageRegistry.put(FileName.EXPAND_ICON, ImageDescriptor 108 .createFromURL(newURL(FileName.EXPAND_ICON))); 109 imageRegistry.put(FileName.COLLAPSE_ICON, ImageDescriptor 110 .createFromURL(newURL(FileName.COLLAPSE_ICON))); 111 imageRegistry.put(FileName.GENERATE_ICON, ImageDescriptor 112 .createFromURL(newURL(FileName.GENERATE_ICON))); 113 imageRegistry.put(FileName.ADDPOINT_ICON, ImageDescriptor 115 .createFromURL(newURL(FileName.ADDPOINT_ICON))); 116 imageRegistry.put(FileName.DELPOINT_ICON, ImageDescriptor 117 .createFromURL(newURL(FileName.DELPOINT_ICON))); 118 imageRegistry.put(FileName.MAXIMIZEVIEW_ICON, ImageDescriptor 119 .createFromURL(newURL(FileName.MAXIMIZEVIEW_ICON))); 120 imageRegistry.put(FileName.NORMALVIEW_ICON, ImageDescriptor 121 .createFromURL(newURL(FileName.NORMALVIEW_ICON))); 122 imageRegistry.put(FileName.DRAW_NOTHING_ICON, ImageDescriptor.createFromURL(newURL(FileName.DRAW_NOTHING_ICON))) ; 123 imageRegistry.put(Node.BEHAVIOR, ImageDescriptor 125 .createFromURL(newURL(FileName.BEHAVIOR_ICON))); 126 imageRegistry.put(Node.PLUGINS, ImageDescriptor 127 .createFromURL(newURL(FileName.PLUGINS_ICON))); 128 imageRegistry.put(Node.USE, ImageDescriptor 129 .createFromURL(newURL(FileName.USE_ICON))); 130 imageRegistry.put(Node.SAMPLE, ImageDescriptor 131 .createFromURL(newURL(FileName.SAMPLE_ICON))); 132 imageRegistry.put(Node.TIMER, ImageDescriptor 133 .createFromURL(newURL(FileName.TIMER_ICON))); 134 imageRegistry.put(Node.IF, ImageDescriptor 135 .createFromURL(newURL(FileName.IF_ICON))); 136 imageRegistry.put(Node.NCHOICE, ImageDescriptor 137 .createFromURL(newURL(FileName.NCHOICE_ICON))); 138 139 } 140 return imageRegistry; 141 } 142 143 } | Popular Tags |