Skip to content

Commit a82a72f

Browse files
committed
Set wpcli verison in the background
1 parent 9b76050 commit a82a72f

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/org/netbeans/modules/php/wordpress/ui/options/WordPressOptionsPanel.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.List;
5151
import java.util.logging.Level;
5252
import java.util.logging.Logger;
53+
import javax.swing.SwingUtilities;
5354
import javax.swing.UIManager;
5455
import javax.swing.event.ChangeListener;
5556
import javax.swing.event.DocumentEvent;
@@ -78,6 +79,7 @@ final class WordPressOptionsPanel extends javax.swing.JPanel {
7879
private final ChangeSupport changeSupport = new ChangeSupport(this);
7980
private String wpCliPath;
8081
private static final Logger LOGGER = Logger.getLogger(WordPressOptionsPanel.class.getName());
82+
private static final RequestProcessor RP = new RequestProcessor(WordPressOptionsPanel.class);
8183

8284
WordPressOptionsPanel() {
8385
initComponents();
@@ -215,13 +217,18 @@ public void setWarning(String message) {
215217

216218
private void setWpCliVersoin() {
217219
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+
});
225232
} else {
226233
wpCliVersionLabel.setText(""); // NOI18N
227234
}
@@ -654,7 +661,7 @@ void store() {
654661

655662
@NbBundle.Messages("WordPressOptionsPanel.update.command.progress=Updating wp-cli command list")
656663
private void updateCommandListXml() {
657-
RequestProcessor.getDefault().post(new Runnable() {
664+
RP.post(new Runnable() {
658665

659666
@Override
660667
public void run() {

0 commit comments

Comments
 (0)