Ignore:
Timestamp:
2010-09-24T16:46:00+02:00 (14 years ago)
Author:
upliner
Message:

'show error if script cannot be executed'

Location:
applications/editors/josm/plugins/ext_tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ext_tools/build.xml

    r23126 r23327  
    3131
    3232        <!-- enter the SVN commit message -->
    33         <property name="commit.message" value="show stderr contents in debug window" />
     33        <property name="commit.message" value="show error if script cannot be executed" />
    3434        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    3535        <property name="plugin.main.version" value="3403" />
  • applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtTool.java

    r23126 r23327  
    117117
    118118    protected void showErrorMessage(String message, String details) {
    119         JPanel p = new JPanel(new GridBagLayout());
     119        final JPanel p = new JPanel(new GridBagLayout());
    120120        p.add(new JMultilineLabel(message),GBC.eol());
    121121        if (details != null) {
     
    125125            p.add(new JScrollPane(info), GBC.eop());
    126126        }
    127         JOptionPane.showMessageDialog(Main.parent, p, tr("External tool error"), JOptionPane.ERROR_MESSAGE);
     127        SwingUtilities.invokeLater(new Runnable() {
     128            public void run() {
     129                JOptionPane.showMessageDialog(Main.parent, p, tr("External tool error"), JOptionPane.ERROR_MESSAGE);
     130            }
     131        });
    128132    }
    129133
     
    167171        try {
    168172            tp.process = builder.start();
    169         } catch (IOException e1) {
     173        } catch (final IOException e) {
     174            e.printStackTrace();
     175            synchronized (debugstr) {
     176                showErrorMessage(
     177                        tr("Error executing the script:"),
     178                        debugstr.toString() + e.getMessage() + "\n" + e.getStackTrace());
     179            }
    170180            return;
    171181        }
     
    207217                    if (tp.running) {
    208218                        tp.process.destroy();
    209                         SwingUtilities.invokeLater(new Runnable() {
    210                             public void run() {
    211                                 synchronized (debugstr) {
    212                                     showErrorMessage(
    213                                             tr("Child script have returned invalid data.\n\nstderr contents:"),
    214                                             debugstr.toString());
    215                                 }
    216                             }
    217                         });
     219                        synchronized (debugstr) {
     220                            showErrorMessage(
     221                                    tr("Child script have returned invalid data.\n\nstderr contents:"),
     222                                    debugstr.toString());
     223                        }
    218224                    }
    219225                } finally {
Note: See TracChangeset for help on using the changeset viewer.