Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 55bfd8b

Browse files
committed
Remove Display and Results postprocessors from Context
These two post processors are what cause the output windows to pop up. Thus, removing them from the context solves the issue and makes the DummyDisplay classes unnecessary. Additionally, the DummyDisplay classes didn't fully solve this issue due to the ResultsPostprocessor calling a swing ui.
1 parent 37628fd commit 55bfd8b

3 files changed

Lines changed: 17 additions & 94 deletions

File tree

‎src/main/java/org/scijava/jupyter/kernel/DummyDisplay.java‎

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎src/main/java/org/scijava/jupyter/kernel/DummyDisplayViewer.java‎

Lines changed: 0 additions & 50 deletions
This file was deleted.

‎src/main/java/org/scijava/jupyter/kernel/ScijavaKernel.java‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,20 @@
2626
import com.twosigma.jupyter.handler.KernelHandler;
2727
import com.twosigma.jupyter.message.Message;
2828

29+
import net.imagej.table.process.ResultsPostprocessor;
30+
2931
import org.scijava.Context;
32+
import org.scijava.display.DisplayPostprocessor;
3033
import org.scijava.jupyter.kernel.comm.ScijavaCommOpenHandler;
3134
import org.scijava.jupyter.kernel.configuration.ScijavaKernelConfigurationFile;
3235
import org.scijava.jupyter.kernel.evaluator.ScijavaEvaluator;
3336
import org.scijava.jupyter.kernel.handler.ScijavaKernelInfoHandler;
3437
import org.scijava.jupyter.service.JupyterService;
3538
import org.scijava.log.LogService;
3639
import org.scijava.plugin.Parameter;
40+
import org.scijava.plugin.PluginInfo;
41+
import org.scijava.plugin.PluginService;
42+
import org.scijava.plugin.SciJavaPlugin;
3743

3844
/**
3945
*
@@ -96,11 +102,19 @@ private void setLogLevel(String logLevel) {
96102
}
97103

98104
public static void main(String... args) {
99-
Context context = new Context();
100-
105+
final Context context = new Context();
106+
107+
// Remove the Display and Results post-processors to prevent output
108+
// windows from being displayed
109+
final PluginService pluginService = context.service(PluginService.class);
110+
final PluginInfo<SciJavaPlugin> display = pluginService.getPlugin(DisplayPostprocessor.class);
111+
final PluginInfo<SciJavaPlugin> results = pluginService.getPlugin(ResultsPostprocessor.class);
112+
pluginService.removePlugin(display);
113+
pluginService.removePlugin(results);
114+
101115
JupyterService jupyter = context.service(JupyterService.class);
102116
jupyter.runKernel(args);
103-
117+
104118
context.dispose();
105119
}
106120
}

0 commit comments

Comments
 (0)