/** * This is the magical place where the display model is connected with the real UI. * * @param event */ @Override protected void onDisplayCreated(final DisplayCreatedEvent event) { final Display<?> display = event.getObject(); final ImageJ imageJ = display.getContext(); final PluginService pluginService = imageJ.getService(PluginService.class); final EventService eventService = imageJ.getService(EventService.class); for (@SuppressWarnings("rawtypes") final PluginInfo<DisplayViewer> info : pluginService.getPluginsOfType(DisplayViewer.class)) { try { final DisplayViewer<?> displayViewer = info.createInstance(); if (displayViewer.canView(display)) { final SwingDisplayWindow displayWindow = new SwingDisplayWindow(); displayViewer.view(displayWindow, display); displayViewers.add(displayViewer); // add a copy of the JMenuBar to the new display if (displayWindow.getJMenuBar() == null) { createMenuBar(displayWindow); } displayWindow.addEventDispatcher(new AWTWindowEventDispatcher(display, eventService)); return; } } catch (final InstantiableException e) { Log.warn("Failed to create instance of " + info.getClassName(), e); } } Log.warn("No suitable DisplayViewer found for display"); }
public static PivotNumberWidget create( final WidgetModel model, final Number min, final Number max, final Number stepSize, final WidgetStyle style) { if (style == WidgetStyle.NUMBER_SCROLL_BAR) { return new PivotNumberScrollBarWidget(model, min, max, stepSize); } if (style == WidgetStyle.NUMBER_SLIDER) { return new PivotNumberSliderWidget(model, min, max); } if (style != WidgetStyle.DEFAULT && style != WidgetStyle.NUMBER_SPINNER) { Log.warn("Ignoring unsupported widget style: " + style); } return new PivotNumberSpinnerWidget(model, min, max, stepSize); }
public void install() { final Installer installer = new Installer(files, getProgress("Installing...")); try { installer.start(); updateFilesTable(); filesChanged(); files.write(); info("Updated successfully. Please restart ImageJ!"); dispose(); } catch (final Canceled e) { // TODO: remove "update/" directory error("Canceled"); installer.done(); } catch (final Exception e) { Log.error(e); // TODO: remove "update/" directory error("Installer failed: " + e); installer.done(); } }