Skip to content

Commit cbb82a5

Browse files
committed
Finalize merge
1 parent bf24cf2 commit cbb82a5

File tree

1 file changed

+1
-53
lines changed

1 file changed

+1
-53
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForNewExercisesOrUpdates.java

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@
66
import fi.helsinki.cs.tmc.model.CourseDb;
77
import fi.helsinki.cs.tmc.model.LocalExerciseStatus;
88
import fi.helsinki.cs.tmc.model.ObsoleteClientException;
9-
import fi.helsinki.cs.tmc.model.NbTmcSettings;
109
import fi.helsinki.cs.tmc.model.TmcCoreSingleton;
1110
import fi.helsinki.cs.tmc.ui.DownloadOrUpdateExercisesDialog;
1211
import fi.helsinki.cs.tmc.ui.ConvenientDialogDisplayer;
1312
import fi.helsinki.cs.tmc.ui.TmcNotificationDisplayer;
1413
import fi.helsinki.cs.tmc.utilities.Inflector;
1514
import fi.helsinki.cs.tmc.utilities.TmcStringUtils;
1615
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;
2716
import fi.helsinki.cs.tmc.utilities.BgTask;
2817
import fi.helsinki.cs.tmc.utilities.BgTaskListener;
2918
import fi.helsinki.cs.tmc.utilities.CancellableCallable;
@@ -93,47 +82,6 @@ public void actionPerformed(ActionEvent e) {
9382

9483
public void run() {
9584
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-
}
13785

13886
BgTaskListener bgTaskListener = new BgTaskListener<Course>() {
13987
@Override
@@ -226,4 +174,4 @@ private void displayNotification(LocalExerciseStatus status, ActionListener acti
226174
private Icon getNotificationIcon() {
227175
return ImageUtilities.loadImageIcon("fi/helsinki/cs/tmc/smile.gif", false);
228176
}
229-
}
177+
}

0 commit comments

Comments
 (0)