Changeset 23126 in osm for applications/editors/josm
- Timestamp:
- 2010-09-12T18:33:47+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/ext_tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ext_tools/.classpath
r22236 r23126 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 6"/>5 4 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 6 6 <classpathentry kind="output" path="build"/> 7 7 </classpath> -
applications/editors/josm/plugins/ext_tools/build.xml
r22531 r23126 31 31 32 32 <!-- enter the SVN commit message --> 33 <property name="commit.message" value=" update to josm latest" />33 <property name="commit.message" value="show stderr contents in debug window" /> 34 34 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 35 35 <property name="plugin.main.version" value="3403" /> -
applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtTool.java
r21930 r23126 4 4 5 5 import java.awt.Cursor; 6 import java.awt.GridBagLayout; 6 7 import java.io.File; 7 8 import java.io.IOException; … … 14 15 import javax.swing.JMenuItem; 15 16 import javax.swing.JOptionPane; 17 import javax.swing.JPanel; 18 import javax.swing.JScrollPane; 19 import javax.swing.JTextArea; 16 20 import javax.swing.SwingUtilities; 17 21 … … 22 26 import org.openstreetmap.josm.data.coor.LatLon; 23 27 import org.openstreetmap.josm.data.osm.DataSet; 28 import org.openstreetmap.josm.gui.JMultilineLabel; 24 29 import org.openstreetmap.josm.gui.MainMenu; 25 30 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 27 32 import org.openstreetmap.josm.io.IllegalDataException; 28 33 import org.openstreetmap.josm.io.OsmReader; 34 import org.openstreetmap.josm.tools.GBC; 29 35 30 36 public class ExtTool { … … 110 116 } 111 117 118 protected void showErrorMessage(String message, String details) { 119 JPanel p = new JPanel(new GridBagLayout()); 120 p.add(new JMultilineLabel(message),GBC.eol()); 121 if (details != null) { 122 JTextArea info = new JTextArea(details, 20, 60); 123 info.setCaretPosition(0); 124 info.setEditable(false); 125 p.add(new JScrollPane(info), GBC.eop()); 126 } 127 JOptionPane.showMessageDialog(Main.parent, p, tr("External tool error"), JOptionPane.ERROR_MESSAGE); 128 } 129 112 130 public void runTool(LatLon pos) { 113 131 Main.map.mapView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); … … 138 156 builder.directory(new File(ExtToolsPlugin.plugin.getPluginDir())); 139 157 158 final StringBuilder debugstr = new StringBuilder(); 159 140 160 // debug: print resulting cmdline 141 161 for (String s : builder.command()) 142 System.out.print(s + " "); 143 System.out.print("\n"); 162 debugstr.append(s + " "); 163 debugstr.append("\n"); 164 System.out.print(debugstr.toString()); 144 165 145 166 final ToolProcess tp = new ToolProcess(); … … 159 180 int len; 160 181 while ((len = errStream.read(buffer)) > 0) { 182 synchronized (debugstr) { 183 debugstr.append(new String(buffer, 0, len)); 184 } 161 185 System.err.write(buffer, 0, len); 162 186 } … … 185 209 SwingUtilities.invokeLater(new Runnable() { 186 210 public void run() { 187 JOptionPane.showMessageDialog(Main.parent, 188 tr("Child script have returned invalid data.")); 211 synchronized (debugstr) { 212 showErrorMessage( 213 tr("Child script have returned invalid data.\n\nstderr contents:"), 214 debugstr.toString()); 215 } 189 216 } 190 217 });
Note:
See TracChangeset
for help on using the changeset viewer.