Index: trunk/mwdumper/src/org/mediawiki/dumper/gui/DumperGui.java |
— | — | @@ -33,6 +33,7 @@ |
34 | 34 | final XmlDumpReader reader = new XmlDumpReader(stream, progress); |
35 | 35 | new Thread() { |
36 | 36 | public void run() { |
| 37 | + running = true; |
37 | 38 | gui.start(); |
38 | 39 | try { |
39 | 40 | reader.readDump(); |
— | — | @@ -40,12 +41,8 @@ |
41 | 42 | } catch(IOException e) { |
42 | 43 | gui.setProgress("FAILED: " + e.getMessage()); |
43 | 44 | } |
44 | | - SwingUtilities.invokeLater(new Runnable() { |
45 | | - public void run() { |
46 | | - running = false; |
47 | | - gui.stop(); |
48 | | - } |
49 | | - }); |
| 45 | + running = false; |
| 46 | + gui.stop(); |
50 | 47 | } |
51 | 48 | }.start(); |
52 | 49 | } |
Index: trunk/mwdumper/src/org/mediawiki/dumper/gui/DumperWindow.java |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | |
11 | 11 | package org.mediawiki.dumper.gui; |
12 | 12 | |
| 13 | +import java.awt.Component; |
13 | 14 | import java.io.File; |
14 | 15 | import java.io.IOException; |
15 | 16 | import javax.swing.JFileChooser; |
— | — | @@ -32,14 +33,41 @@ |
33 | 34 | } |
34 | 35 | |
35 | 36 | public void start() { |
36 | | - // todo: set the button up to a stop mode. ;) |
37 | | - startButton.setEnabled(false); |
| 37 | + // disable the other fields... |
| 38 | + setFieldsEnabled(false); |
| 39 | + |
| 40 | + // todo: set the start button up to a stop mode instead of disabling it |
38 | 41 | } |
39 | 42 | |
40 | 43 | public void stop() { |
41 | | - startButton.setEnabled(true); |
| 44 | + setFieldsEnabled(true); |
42 | 45 | } |
43 | 46 | |
| 47 | + void setFieldsEnabled(boolean val) { |
| 48 | + final boolean _val = val; |
| 49 | + SwingUtilities.invokeLater(new Runnable() { |
| 50 | + public void run() { |
| 51 | + Component[] widgets = new Component[] { |
| 52 | + fileText, |
| 53 | + browseButton, |
| 54 | + |
| 55 | + serverText, |
| 56 | + portText, |
| 57 | + userText, |
| 58 | + passwordText, |
| 59 | + connectButton, |
| 60 | + |
| 61 | + schema14Radio, |
| 62 | + schema15Radio, |
| 63 | + prefixText, |
| 64 | + startButton }; |
| 65 | + for (int i = 0; i < widgets.length; i++) { |
| 66 | + widgets[i].setEnabled(_val); |
| 67 | + } |
| 68 | + } |
| 69 | + }); |
| 70 | + } |
| 71 | + |
44 | 72 | /** |
45 | 73 | * Set the progress bar text asynchronously, eg from a background thread |
46 | 74 | */ |