Changeset 250 in josm for src/org/openstreetmap/josm/plugins
- Timestamp:
- 2007-05-31T00:29:59+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/plugins/PluginInformation.java
r243 r250 33 33 public final String author; 34 34 public final int stage; 35 public final List<URL> libraries = new ArrayList<URL>(); 35 protected final List<URL> libraries = new ArrayList<URL>(); 36 protected ClassLoader classLoader; 36 37 37 38 public final Map<String, String> attr = new TreeMap<String, String>(); … … 68 69 if (file != null) 69 70 libraries.add(new URL(getURLString(file.getAbsolutePath()))); 70 String classPath = attr.getValue( "Class-Path");71 String classPath = attr.getValue(Attributes.Name.CLASS_PATH); 71 72 if (classPath != null) { 72 73 String[] cp = classPath.split(" "); … … 112 113 public Class<?> loadClass() { 113 114 try { 114 URL[] urls = new URL[libraries.size()]; 115 urls = libraries.toArray(urls); 116 ClassLoader loader = URLClassLoader.newInstance(urls, getClass().getClassLoader()); 117 Class<?> realClass = Class.forName(className, true, loader); 115 Class<?> realClass = Class.forName(className, true, getClassLoader()); 118 116 return realClass; 119 117 } catch (Exception e) { … … 127 125 return "file://"+fileName; 128 126 } 127 128 /** 129 * Returns all libraries the plugin needs (the plugin's jar file itself and all jars declared 130 * in the manifest's Class-Path section). 131 * @return the libraries a list of URLs to the libraries. 132 */ 133 public List<URL> getLibraries() { 134 return libraries; 135 } 136 137 /** 138 * @return the classLoader 139 */ 140 public ClassLoader getClassLoader() { 141 // if I have no classloader set, create one for me and my libraries: 142 if(classLoader == null) { 143 URL[] urls = new URL[libraries.size()]; 144 urls = libraries.toArray(urls); 145 classLoader = URLClassLoader.newInstance(urls, getClass().getClassLoader()); 146 } 147 return classLoader; 148 } 149 150 /** 151 * @param classLoader the classLoader to set 152 */ 153 public void setClassLoader(ClassLoader classLoader) { 154 this.classLoader = classLoader; 155 } 129 156 130 157 /** … … 190 217 } 191 218 } 219
Note:
See TracChangeset
for help on using the changeset viewer.