|
3 | 3 | import org.eclipse.core.runtime.IProgressMonitor;
|
4 | 4 | import org.eclipse.core.runtime.IStatus;
|
5 | 5 | import org.eclipse.core.runtime.MultiStatus;
|
| 6 | +import org.eclipse.core.runtime.jobs.IJobChangeEvent; |
6 | 7 | import org.eclipse.core.runtime.jobs.Job;
|
| 8 | +import org.eclipse.core.runtime.jobs.JobChangeAdapter; |
| 9 | +import org.eclipse.jface.dialogs.MessageDialog; |
7 | 10 | import org.eclipse.jface.preference.PreferencePage;
|
8 | 11 | import org.eclipse.jface.viewers.CellLabelProvider;
|
9 | 12 | import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
@@ -80,15 +83,27 @@ protected Control createContents(Composite parent) {
|
80 | 83 | public boolean performOk() {
|
81 | 84 | if (this.isJobRunning == false) {
|
82 | 85 | this.isJobRunning = true;
|
83 |
| - new Job(Messages.ui_Adopting_arduino_libraries) { |
| 86 | + Job job = new Job(Messages.ui_Adopting_arduino_libraries) { |
84 | 87 | @Override
|
85 | 88 | protected IStatus run(IProgressMonitor monitor) {
|
86 | 89 | MultiStatus status = new MultiStatus(Activator.getId(), 0, Messages.ui_installing_arduino_libraries,
|
87 | 90 | null);
|
88 | 91 | return LibraryManager.setLibraryTree(LibrarySelectionPage.this.libs, monitor, status);
|
89 | 92 | }
|
90 |
| - }.schedule(); |
| 93 | + }; |
| 94 | + job.addJobChangeListener(new JobChangeAdapter() { |
| 95 | + |
| 96 | + @Override |
| 97 | + public void done(IJobChangeEvent event) { |
| 98 | + LibrarySelectionPage.this.isJobRunning = false; |
| 99 | + } |
| 100 | + |
| 101 | + }); |
| 102 | + job.setUser(true); |
| 103 | + job.schedule(); |
91 | 104 | return true;
|
| 105 | + } else { |
| 106 | + MessageDialog.openInformation(getShell(), "Library Manager", "Library Manager is busy. Please wait some time..."); |
92 | 107 | }
|
93 | 108 | return false;
|
94 | 109 | }
|
|
0 commit comments