1
-
2
1
/*
3
2
* Copyright 2004 Francois Guillet
3
+ * Changes copyright 2022 by Maksim Khramov
4
4
* This program is free software; you can redistribute it and/or modify it under the
5
5
* terms of the GNU General Public License as published by the Free Software
6
6
* Foundation; either version 2 of the License, or (at your option) any later version.
15
15
import artofillusion .ui .*;
16
16
17
17
import java .awt .*;
18
- import java .awt .event .*;
19
18
import buoy .event .*;
20
19
import buoy .widget .*;
21
20
@@ -53,6 +52,7 @@ public class SPManagerPlugin implements Plugin
53
52
*@param message Description of the Parameter
54
53
*@param args Description of the Parameter
55
54
*/
55
+ @ Override
56
56
public void processMessage ( int message , Object args [] )
57
57
{
58
58
// NTJ: get the AOI run-time (*not* compile-time) version
@@ -101,8 +101,7 @@ public void processMessage( int message, Object args[] )
101
101
Method addUrl = null ;
102
102
103
103
try {
104
- addUrl =
105
- URLClassLoader .class .getDeclaredMethod ("addURL" , sig );
104
+ addUrl = URLClassLoader .class .getDeclaredMethod ("addURL" , sig );
106
105
addUrl .setAccessible (true );
107
106
} catch (Exception e ) {
108
107
System .out .println ("Error getting addURL method: " + e );
@@ -114,8 +113,8 @@ public void processMessage( int message, Object args[] )
114
113
Class plugType ;
115
114
File files [], urlfile ;
116
115
URL url ;
117
- Map . Entry entry ;
118
- String key [], value ;
116
+
117
+
119
118
File plugdir = new File (PLUGIN_DIRECTORY );
120
119
if (plugdir .exists ()) {
121
120
files = plugdir .listFiles ();
@@ -157,11 +156,9 @@ public void processMessage( int message, Object args[] )
157
156
}
158
157
159
158
// ok, now perform the actions
160
- for (Iterator iter = info .actions .entrySet ().iterator ();
161
- iter .hasNext (); ) {
162
-
163
- entry = (Map .Entry ) iter .next ();
164
- key = entry .getKey ().toString ().split (":" );
159
+ for (Map .Entry <String , String > entry : info .actions .entrySet ()) {
160
+ String value = entry .getValue ();
161
+ String key [] = entry .getKey ().split (":" );
165
162
166
163
try {
167
164
if (key [0 ].startsWith ("/" ))
@@ -177,30 +174,24 @@ public void processMessage( int message, Object args[] )
177
174
178
175
System .out .println ("SPM: adding path: " + url );
179
176
180
- value = entry .getValue ().toString ();
181
-
182
-
183
177
if ("classpath" .equalsIgnoreCase (value )) {
184
178
if (searchldr != null )
185
179
searchldr .add (url );
186
180
else if (addUrl != null ) {
187
181
try {
188
182
addUrl .invoke (urlldr , url );
189
183
} catch (Exception e ) {
190
- System .out .println ("Error invoking: "
191
- + e );
184
+ System .out .println ("Error invoking: " + e );
192
185
}
193
186
}
194
- else System .out .println ("Could not add path" +
195
- url );
187
+ else System .out .println ("Could not add path" + url );
196
188
}
197
189
else if ("import" .equalsIgnoreCase (value )) {
198
190
ldr = (ClassLoader ) loaders .get (url );
199
191
200
192
if (key .length == 1 ) {
201
193
if (obj != null ) searchldr .add (ldr );
202
- else System .out .println ("SPM: could not find"
203
- + " loader for: " + url );
194
+ else System .out .println ("SPM: could not find" + " loader for: " + url );
204
195
}
205
196
206
197
}
0 commit comments