Skip to content

Commit 264a1f7

Browse files
committed
Library selection: Now job can be started only once at a time
Fixing problem with library selection: Open library manager select all libraries, push "apply" a then push "ok". Error messages appears, because update job is running twice.
1 parent 2c4a8fb commit 264a1f7

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

io.sloeber.ui/src/io/sloeber/ui/preferences/LibrarySelectionPage.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
public class LibrarySelectionPage extends PreferencePage implements IWorkbenchPreferencePage {
4242

4343
private FilteredTree tree;
44+
private boolean isJobRunning = false;
4445
protected TreeViewer viewer;
4546
protected TreeEditor editor;
4647
protected LibraryTree libs = LibraryManager.getLibraryTree();
@@ -78,19 +79,20 @@ protected Control createContents(Composite parent) {
7879

7980
@Override
8081
public boolean performOk() {
81-
82-
new Job(Messages.ui_Adopting_arduino_libraries) {
83-
84-
@Override
85-
protected IStatus run(IProgressMonitor monitor) {
86-
MultiStatus status = new MultiStatus(Activator.getId(), 0, Messages.ui_installing_arduino_libraries,
87-
null);
88-
return LibraryManager.setLibraryTree(LibrarySelectionPage.this.libs, monitor, status);
89-
90-
}
91-
}.schedule();
92-
93-
return true;
82+
if (isJobRunning == false) {
83+
isJobRunning = true;
84+
new Job(Messages.ui_Adopting_arduino_libraries) {
85+
@Override
86+
protected IStatus run(IProgressMonitor monitor) {
87+
MultiStatus status = new MultiStatus(Activator.getId(), 0, Messages.ui_installing_arduino_libraries,
88+
null);
89+
return LibraryManager.setLibraryTree(LibrarySelectionPage.this.libs, monitor, status);
90+
}
91+
}.schedule();
92+
return true;
93+
} else {
94+
return false;
95+
}
9496
}
9597

9698
public void createTree(Composite parent) {

0 commit comments

Comments
 (0)