7
7
import fi .helsinki .cs .tmc .model .NBTmcSettings ;
8
8
import fi .helsinki .cs .tmc .ui .PreferencesUI ;
9
9
import fi .helsinki .cs .tmc .ui .DownloadOrUpdateExercisesDialog ;
10
- import fi .helsinki .cs .tmc .utilities .BgTaskListener ;
11
- import hy .tmc .core .exceptions .TmcCoreException ;
12
10
import java .awt .event .ActionEvent ;
13
11
import java .util .List ;
14
12
import javax .swing .AbstractAction ;
15
- import org . openide . util . Exceptions ;
13
+ import javax . swing . SwingUtilities ;
16
14
17
15
public class SaveSettingsAction extends AbstractAction {
18
16
@@ -53,10 +51,15 @@ public void actionPerformed(ActionEvent e) {
53
51
refresh .addListener (new FutureCallback <List <Course >>() {
54
52
@ Override
55
53
public void onSuccess (List <Course > v ) {
56
- LocalExerciseStatus status = LocalExerciseStatus .get (courseDb .getCurrentCourseExercises ());
57
- if (status .thereIsSomethingToDownload (false )) {
58
- DownloadOrUpdateExercisesDialog .display (status .unlockable , status .downloadableUncompleted , status .updateable );
59
- }
54
+ SwingUtilities .invokeLater (new Runnable () {
55
+ @ Override
56
+ public void run () {
57
+ LocalExerciseStatus status = LocalExerciseStatus .get (courseDb .getCurrentCourseExercises ());
58
+ if (status .thereIsSomethingToDownload (false )) {
59
+ DownloadOrUpdateExercisesDialog .display (status .unlockable , status .downloadableUncompleted , status .updateable );
60
+ }
61
+ }
62
+ });
60
63
}
61
64
62
65
@ Override
@@ -65,7 +68,6 @@ public void onFailure(Throwable thrwbl) {
65
68
});
66
69
refresh .run ();
67
70
}
68
-
69
71
settings .save ();
70
72
}
71
73
}
0 commit comments