|
50 | 50 | import java.util.List; |
51 | 51 | import java.util.logging.Level; |
52 | 52 | import java.util.logging.Logger; |
| 53 | +import javax.swing.SwingUtilities; |
53 | 54 | import javax.swing.UIManager; |
54 | 55 | import javax.swing.event.ChangeListener; |
55 | 56 | import javax.swing.event.DocumentEvent; |
@@ -78,6 +79,7 @@ final class WordPressOptionsPanel extends javax.swing.JPanel { |
78 | 79 | private final ChangeSupport changeSupport = new ChangeSupport(this); |
79 | 80 | private String wpCliPath; |
80 | 81 | private static final Logger LOGGER = Logger.getLogger(WordPressOptionsPanel.class.getName()); |
| 82 | + private static final RequestProcessor RP = new RequestProcessor(WordPressOptionsPanel.class); |
81 | 83 |
|
82 | 84 | WordPressOptionsPanel() { |
83 | 85 | initComponents(); |
@@ -215,13 +217,18 @@ public void setWarning(String message) { |
215 | 217 |
|
216 | 218 | private void setWpCliVersoin() { |
217 | 219 | if (!StringUtils.isEmpty(getWpCliPath())) { |
218 | | - try { |
219 | | - WordPressCli wpCli = WordPressCli.getDefault(true); |
220 | | - String version = wpCli.getVersion(); |
221 | | - wpCliVersionLabel.setText(version); |
222 | | - } catch (InvalidPhpExecutableException ex) { |
223 | | - Exceptions.printStackTrace(ex); |
224 | | - } |
| 220 | + RP.post(() -> { |
| 221 | + try { |
| 222 | + WordPressCli wpCli = WordPressCli.getDefault(true); |
| 223 | + String version = wpCli.getVersion(); |
| 224 | + SwingUtilities.invokeLater(() -> { |
| 225 | + wpCliVersionLabel.setText(version); |
| 226 | + }); |
| 227 | + } catch (InvalidPhpExecutableException ex) { |
| 228 | + wpCliVersionLabel.setText(""); // NOI18N |
| 229 | + LOGGER.log(Level.WARNING, null, ex); |
| 230 | + } |
| 231 | + }); |
225 | 232 | } else { |
226 | 233 | wpCliVersionLabel.setText(""); // NOI18N |
227 | 234 | } |
@@ -654,7 +661,7 @@ void store() { |
654 | 661 |
|
655 | 662 | @NbBundle.Messages("WordPressOptionsPanel.update.command.progress=Updating wp-cli command list") |
656 | 663 | private void updateCommandListXml() { |
657 | | - RequestProcessor.getDefault().post(new Runnable() { |
| 664 | + RP.post(new Runnable() { |
658 | 665 |
|
659 | 666 | @Override |
660 | 667 | public void run() { |
|
0 commit comments