Changeset 22686 in osm for applications/editors/josm
- Timestamp:
- 2010-08-19T00:44:22+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r22677 r22686 15 15 import java.io.InputStreamReader; 16 16 import java.io.UnsupportedEncodingException; 17 import java.lang.reflect.InvocationTargetException; 18 import java.lang.reflect.Method; 17 19 import java.util.ArrayList; 18 20 import java.util.Collections; … … 39 41 import org.openstreetmap.josm.plugins.PluginInformation; 40 42 import org.openstreetmap.josm.plugins.PluginProxy; 41 import org.openstreetmap.josm.plugins.remotecontrol.RemoteControlPlugin;42 43 43 44 import wmsplugin.io.WMSLayerExporter; … … 61 62 62 63 static boolean remoteControlAvailable = false; 64 static String remoteControlVersion = null; 63 65 64 66 protected void initExporterAndImporter() { … … 86 88 private void initRemoteControl() { 87 89 final String remotecontrolName = "remotecontrol"; 88 final String remotecontrol Version = "22675";90 final String remotecontrolMinVersion = "22675"; 89 91 for(PluginProxy pp: PluginHandler.pluginList) 90 92 { … … 92 94 if(remotecontrolName.equals(info.name)) 93 95 { 94 if(remotecontrol Version.compareTo(info.version) <= 0)96 if(remotecontrolMinVersion.compareTo(info.version) <= 0) 95 97 { 96 98 remoteControlAvailable = true; 99 remoteControlVersion = info.version; 97 100 } 98 101 else 99 102 { 100 103 System.out.println("wmsplugin: remote control plugin version is " + 101 info.version + ", need " + remotecontrol Version + " or newer");104 info.version + ", need " + remotecontrolMinVersion + " or newer"); 102 105 } 103 106 break; … … 107 110 if(remoteControlAvailable) 108 111 { 112 remoteControlAvailable = false; 109 113 System.out.println("wmsplugin: initializing remote control"); 110 RemoteControlPlugin plugin = 111 (RemoteControlPlugin) PluginHandler.getPlugin(remotecontrolName); 112 plugin.addRequestHandler(WMSRemoteHandler.command, WMSRemoteHandler.class); 113 } 114 else 114 Plugin plugin = 115 (Plugin) PluginHandler.getPlugin(remotecontrolName); 116 try { 117 Method method = plugin.getClass().getMethod("addRequestHandler", String.class, Class.class); 118 method.invoke(plugin, WMSRemoteHandler.command, WMSRemoteHandler.class); 119 remoteControlAvailable = true; 120 } catch (SecurityException e) { 121 e.printStackTrace(); 122 } catch (NoSuchMethodException e) { 123 e.printStackTrace(); 124 } catch (IllegalArgumentException e) { 125 e.printStackTrace(); 126 } catch (IllegalAccessException e) { 127 e.printStackTrace(); 128 } catch (InvocationTargetException e) { 129 e.printStackTrace(); 130 } 131 } 132 if(!remoteControlAvailable) 115 133 { 116 134 System.out.println("wmsplugin: cannot use remote control");
Note:
See TracChangeset
for help on using the changeset viewer.