Skip to content

Commit 5d2c17b

Browse files
committed
Optimize option panel
1 parent fa097d0 commit 5d2c17b

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ If applicable, add screenshots to help explain your problem.
2525
**Desktop (please complete the following information):**
2626
- OS: [e.g. iOS]
2727
- JDK Version [e.g. 22]
28+
- Python version [e.g. 3.11.8]
2829
- Netbeans Version: [e.g. 22]
2930
- Python Plugin Version: [e.g. 22]
3031

3132
**Mandatory Logs**
3233
Add any other context about the problem here.
3334
[e.g. Netbeans stacktrace/logs: (View-> IDE Log)]
34-
[e.g. LSP Server logs ${netbeans_userdir}/.pythonlsp/lsp_log_file]
35+
[e.g. LSP Server logs ${netbeans_userdir}/.pythonlsp/lsp_log_file]
3536
/!\: (this log is cleaned at Netbeans exit)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ The project is driven by the need to bring to Netbeans similar support for Pytho
3737

3838
Support this project growth and maintenance by:
3939

40-
- Starring it [![](https://img.shields.io/github/stars/albilu/netbeansPython)]()
41-
- Submiting [PR](https://github.com/albilu/netbeansPython/pulls) for issues in the backlog
4240
- [Sponsoring it](https://github.com/sponsors/albilu)
41+
- Submiting [PR](https://github.com/albilu/netbeansPython/pulls) for issues in the backlog
42+
- Starring it [![](https://img.shields.io/github/stars/albilu/netbeansPython)]()
4343

4444
### Related Projects
4545

src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232
import org.openide.util.Exceptions;
3333
import org.openide.util.NbPreferences;
3434
import org.openide.util.Pair;
35+
import org.openide.util.RequestProcessor;
3536

3637
final class PythonLspServerConfigsPanel extends javax.swing.JPanel {
3738

3839
private static final long serialVersionUID = 1L;
3940

41+
RequestProcessor RP = new RequestProcessor(this.getClass().getName(), 1);
42+
4043
public static String[] PACKAGES = {
4144
"pylsp",
4245
"pyls-isort",
@@ -231,33 +234,36 @@ private void lspListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:eve
231234
}//GEN-LAST:event_lspListMouseClicked
232235

233236
void load() {
234-
if (errors != null && !errors.isEmpty()) {
235-
return;
236-
}
237-
try {
238-
lspServerCheckBox.setSelected(NbPreferences.root().getBoolean("autoUpdate", false));
239-
lspServerLabel.setText(String.format("%s%s", "Current Version: ", PythonUtility.getServerVersion()));
240-
lspPythonVersionLabel.setText(String.format("%s%s", "Python Version: ", PythonUtility.getVersion(PythonUtility.getLspPythonExe())));
241-
String pipListOutput = PythonUtility.getPipList(PythonUtility.getLspPythonExe());
237+
RP.post(() -> {
238+
if (errors != null && !errors.isEmpty()) {
239+
return;
240+
}
241+
try {
242+
lspServerCheckBox.setSelected(NbPreferences.root().getBoolean("autoUpdate", false));
243+
lspServerLabel.setText(String.format("%s%s", "Current Version: ", PythonUtility.getServerVersion()));
244+
lspPythonVersionLabel.setText(String.format("%s%s", "Python Version: ", PythonUtility.getVersion(PythonUtility.getLspPythonExe())));
245+
String pipListOutput = PythonUtility.getPipList(PythonUtility.getLspPythonExe());
246+
247+
DefaultListModel<Pair<String, Boolean>> model = new DefaultListModel<>();
242248

243-
DefaultListModel<Pair<String, Boolean>> model = new DefaultListModel<>();
249+
for (String pipPackage : PACKAGES) {
250+
if (pipListOutput.contains(pipPackage)) {
251+
model.addElement(Pair.of(pipPackage, true));
244252

245-
for (String pipPackage : PACKAGES) {
246-
if (pipListOutput.contains(pipPackage)) {
247-
model.addElement(Pair.of(pipPackage, true));
253+
} else {
254+
model.addElement(Pair.of(pipPackage, false));
248255

249-
} else {
250-
model.addElement(Pair.of(pipPackage, false));
256+
}
251257

252258
}
259+
lspList.setModel(model);
253260

261+
lspEditorPane.setText(Files.readString(PythonUtility.SETTINGS.toPath()));
262+
} catch (IOException ex) {
263+
Exceptions.printStackTrace(ex);
254264
}
255-
lspList.setModel(model);
256265

257-
lspEditorPane.setText(Files.readString(PythonUtility.SETTINGS.toPath()));
258-
} catch (IOException ex) {
259-
Exceptions.printStackTrace(ex);
260-
}
266+
});
261267

262268
}
263269

src/main/java/org/netbeans/modules/python/repl/PythonTerminalConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import java.nio.charset.Charset;
99
import java.nio.file.Paths;
1010
import java.util.Map;
11-
import org.netbeans.modules.python.project.PythonProject;
1211
import org.netbeans.modules.python.PythonUtility;
12+
import org.netbeans.modules.python.project.PythonProject;
1313

1414
/**
1515
*

0 commit comments

Comments
 (0)