1 18 19 package org.apache.jmeter.plugin; 20 21 import java.net.URL ; 22 23 import javax.swing.ImageIcon ; 24 25 import org.apache.jmeter.gui.GUIFactory; 26 27 31 public final class PluginManager 32 { 33 private static final PluginManager instance = new PluginManager(); 34 35 private PluginManager() 36 { 37 } 38 39 44 public static void install(JMeterPlugin plugin, boolean useGui) 45 { 46 if (useGui) 47 { 48 instance.installPlugin(plugin); 49 } 50 } 51 52 private void installPlugin(JMeterPlugin plugin) 53 { 54 String [][] icons = plugin.getIconMappings(); 55 ClassLoader classloader = plugin.getClass().getClassLoader(); 56 57 for (int i = 0; i < icons.length; i++) 58 { 59 URL resource = classloader.getResource(icons[i][1].trim()); 60 61 if (resource == null) 62 { 63 } 65 else 66 { 67 GUIFactory.registerIcon(icons[i][0], new ImageIcon (resource)); 68 } 69 } 70 } 71 } 72 | Popular Tags |