6
6
import fi .helsinki .cs .tmc .model .CourseDb ;
7
7
import fi .helsinki .cs .tmc .model .LocalExerciseStatus ;
8
8
import fi .helsinki .cs .tmc .model .ObsoleteClientException ;
9
- import fi .helsinki .cs .tmc .model .NbTmcSettings ;
10
9
import fi .helsinki .cs .tmc .model .TmcCoreSingleton ;
11
10
import fi .helsinki .cs .tmc .ui .DownloadOrUpdateExercisesDialog ;
12
11
import fi .helsinki .cs .tmc .ui .ConvenientDialogDisplayer ;
13
12
import fi .helsinki .cs .tmc .ui .TmcNotificationDisplayer ;
14
13
import fi .helsinki .cs .tmc .utilities .Inflector ;
15
14
import fi .helsinki .cs .tmc .utilities .TmcStringUtils ;
16
15
import fi .helsinki .cs .tmc .core .TmcCore ;
17
- import fi .helsinki .cs .tmc .core .domain .Exercise ;
18
- import fi .helsinki .cs .tmc .core .exceptions .TmcCoreException ;
19
- import java .awt .event .ActionEvent ;
20
- import java .awt .event .ActionListener ;
21
- import java .net .URI ;
22
- import java .net .URISyntaxException ;
23
- import java .util .ArrayList ;
24
- import javax .swing .AbstractAction ;
25
- import javax .swing .Icon ;
26
- import javax .swing .SwingUtilities ;
27
16
import fi .helsinki .cs .tmc .utilities .BgTask ;
28
17
import fi .helsinki .cs .tmc .utilities .BgTaskListener ;
29
18
import fi .helsinki .cs .tmc .utilities .CancellableCallable ;
@@ -93,47 +82,6 @@ public void actionPerformed(ActionEvent e) {
93
82
94
83
public void run () {
95
84
final Course currentCourseBeforeUpdate = courseDb .getCurrentCourse ();
96
- <<<<<<< HEAD
97
- try {
98
- if (backgroundProcessingOrNoCurrentCourse (currentCourseBeforeUpdate )) {
99
- return ;
100
- }
101
- ProgressHandle exerciseRefresh = ProgressHandleFactory .createSystemHandle (
102
- "Checking for new exercises" );
103
- exerciseRefresh .start ();
104
- ListenableFuture <Course > currentCourseFuture = this .tmcCore .getCourse (
105
- detailUrl (currentCourseBeforeUpdate )
106
- );
107
- Futures .addCallback (currentCourseFuture , new UpdateCourseForExerciseUpdate (exerciseRefresh ));
108
- } catch (TmcCoreException ex ) {
109
- Exceptions .printStackTrace (ex );
110
- dialogs .displayError ("An exception occurred in tmc core" , ex );
111
- } catch (URISyntaxException ex ) {
112
- String illegalUri = currentCourseBeforeUpdate .getDetailsUrl ();
113
- dialogs .displayError ("Illegal uri from server: " + illegalUri , ex );
114
- Exceptions .printStackTrace (ex );
115
- }
116
- }
117
-
118
- private URI detailUrl (final Course currentCourseBeforeUpdate ) throws URISyntaxException {
119
- return new URI (currentCourseBeforeUpdate .getDetailsUrl ());
120
- }
121
-
122
- /**
123
- * If there is something at background or no current course is chosen,
124
- * return true.
125
- */
126
- private boolean backgroundProcessingOrNoCurrentCourse (final Course currentCourseBeforeUpdate ) {
127
- if (backgroundCheck && !NbTmcSettings .getDefault ().isCheckingForUpdatesInTheBackground ()) {
128
- return ;
129
- }
130
-
131
- if (currentCourseBeforeUpdate == null ) {
132
- if (!beQuiet ) {
133
- dialogs .displayMessage ("Please select a course in TMC -> Settings." );
134
- }
135
- return ;
136
- }
137
85
138
86
BgTaskListener bgTaskListener = new BgTaskListener <Course >() {
139
87
@ Override
@@ -226,4 +174,4 @@ private void displayNotification(LocalExerciseStatus status, ActionListener acti
226
174
private Icon getNotificationIcon () {
227
175
return ImageUtilities .loadImageIcon ("fi/helsinki/cs/tmc/smile.gif" , false );
228
176
}
229
- }
177
+ }
0 commit comments