Skip to content

Commit 3224f19

Browse files
committed
Fixes #341
1 parent 14f6f2e commit 3224f19

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/MasterDetailDialogPage.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ public void finish() {
164164
CreateEnrichmentMapTaskFactory taskFactory = taskFactoryFactory.create(params, dataSets);
165165
TaskIterator tasks = taskFactory.createTaskIterator();
166166

167-
// Close this dialog after the progress dialog finishes normally
168-
tasks.append(callback.getCloseTask());
169-
170-
dialogTaskManager.execute(tasks);
167+
dialogTaskManager.execute(tasks, callback.getCloseTaskObserver());
171168
}
172169

173170

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/CardDialog.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727

2828
import org.cytoscape.util.swing.LookAndFeelUtil;
2929
import org.cytoscape.work.AbstractTask;
30+
import org.cytoscape.work.FinishStatus;
31+
import org.cytoscape.work.ObservableTask;
3032
import org.cytoscape.work.Task;
3133
import org.cytoscape.work.TaskMonitor;
34+
import org.cytoscape.work.TaskObserver;
3235

3336
public class CardDialog {
3437

@@ -242,6 +245,11 @@ public void close() {
242245
dialog.setVisible(false);
243246
}
244247

248+
@Override
249+
public CardDialog getDialog() {
250+
return CardDialog.this;
251+
}
252+
245253
@Override
246254
public Task getCloseTask() {
247255
return new AbstractTask() {
@@ -254,9 +262,19 @@ public void run(TaskMonitor taskMonitor) throws Exception {
254262
}
255263

256264
@Override
257-
public CardDialog getDialog() {
258-
return CardDialog.this;
265+
public TaskObserver getCloseTaskObserver() {
266+
return new TaskObserver() {
267+
@Override
268+
public void taskFinished(ObservableTask task) {
269+
}
270+
@Override
271+
public void allFinished(FinishStatus finishStatus) {
272+
// because the finishButton listener disables the Finish button
273+
// need to re-enable the finish button even if the task fails
274+
finishButton.setEnabled(true);
275+
close();
276+
}
277+
};
259278
}
260-
261279
}
262280
}

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/CardDialogCallback.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import javax.swing.JDialog;
44

55
import org.cytoscape.work.Task;
6+
import org.cytoscape.work.TaskObserver;
67

78
public interface CardDialogCallback {
89

@@ -15,4 +16,6 @@ public interface CardDialogCallback {
1516
void close();
1617

1718
Task getCloseTask();
19+
20+
TaskObserver getCloseTaskObserver();
1821
}

0 commit comments

Comments
 (0)