You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 49a5723
Browse filesBrowse the repository at this point in the historyBrowse files
`scijava-bridge` presents SciJava Common's modules as SciJava3 commands,
so an application can show, harvest and run everything the old world
already knows about -- every ImageJ2 command, every Fiji plugin ported to
the module system -- beside its own commands and its scripts, in its own
menus and dialogs, with neither side changed. It is the only component
that depends on SciJava Common, and the dependency goes one way.
Before any of it could work: **org.scijava.command was a split package**.
SciJava Common owns it and SciJava3 had claimed it too. Two modules
containing one package is a JVM that refuses to start; on the classpath
it is worse, two different `Command` interfaces under one name with the
first jar winning. Fiji could never have loaded both. The incarnation
rule was applied to io3, convert3 and script3 and simply missed here, so
this renames the component to scijava-command3 / org.scijava.command3,
version 3.0.0-SNAPSHOT. Checking all 77 SciJava Common packages against
all 34 SciJava3 ones: that was the only collision.
What else the bridge turned up, each of which is a translation rather
than a compromise:
- SciJava Common's @parameter means both "this is an input" and "inject
this service"; its harvester tells them apart by having preprocessors
fill the services first. SciJava3 split the annotations so the question
never arises, so the bridge answers it once: a Service or Context
parameter is the legacy context's business and never reaches a dialog.
Without this, every DynamicCommand dialog would show four spurious rows.
- DynamicCommand needs no SciJava3 equivalent to be supported. Its
parameters live on the module's own description, so the bridge
initializes at create() time, as InitPreprocessor does, and reads that
description. What SciJava3 declines to offer as a way of writing
commands, it presents without trouble.
- Callbacks and validators resolve by name through behavior(String) --
the SPI that exists so scripts could have callbacks turns out to be
exactly what legacy commands need. SciJava Common's two validator
protocols (throw, or return a message) collapse into SciJava3's one,
and its "Error executing method" wrapper is unwrapped so the user sees
what the validator actually said.
- Accelerators are translated rather than passed through:
Accelerator.toString() renders Swing's "control L", which Swing parses
back and JavaFX does not. Written ^L, all three bindings agree.
- Menu paths are rebuilt from their entries, getMenuString() rendering
"A > B > C" with spaces that would end up inside the labels.
- LegacyContext keeps SciJava Common types out of the bridge's
signatures: a JPMS module would otherwise need `requires org.scijava`
merely to hold the context, and a test-scoped use cannot say that at
all.
The bridge's tests stop at the dialog *model*, which is where its claim
ends; that a correct model becomes correct widgets is what the bindings'
shared conformance suite already establishes three times over.
NB: the monorepo already has a scijava-legacy, for ops and ImageJ2
interop, which `requires net.imagej`. Keeping the command bridge separate
is deliberate: an application wanting Fiji's existing commands in its
menus should not thereby acquire ImageJ2.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gJpzGd3ksbME4CN6Tu2ni
|**1. Application model** (built, less `scijava-desktop`) |`scijava-command` (a struct plus presentation metadata, the menu tree and its walk), `scijava-ui3` (toolkit-agnostic contracts), `scijava-desktop`| layer 0 |
696
+
|**1. Application model** (built, less `scijava-desktop`) |`scijava-command3` (a struct plus presentation metadata, the menu tree and its walk), `scijava-ui3` (toolkit-agnostic contracts), `scijava-desktop`| layer 0 |
697
697
|**2. Toolkit bindings**|`scijava-awt` (and the AWT platform layer the others use), `scijava-swing`, `scijava-javafx`, headless | layer 1 |
Copy file name to clipboardExpand all lines: docs/migration.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ A **dropped** row is a successful outcome, not a gap.
86
86
|`Contextual`, `AbstractContextual`, `NullContextException`| dropped — a service receives its context in `Service.initialize(Context)`, so it need not carry one, and there is no null-context state to report | dropped |
87
87
|`Gateway`, `AbstractGateway`, `SciJava`| Phase 2, if retained at all | open |
88
88
|`Instantiable`, `InstantiableException`| subsumed by `Discovery`| planned |
89
-
|`BasicDetails`, `AbstractBasicDetails`, `UIDetails`, `AbstractUIDetails`, `MenuEntry`, `MenuPath`|`scijava-command` presentation metadata (layer 1). All of it survives — menu path, label, icon, accelerator, weight, selection group, visibility, enablement — but as attributes in the annotation index rather than an inheritance chain every plugin extends | planned |
89
+
|`BasicDetails`, `AbstractBasicDetails`, `UIDetails`, `AbstractUIDetails`, `MenuEntry`, `MenuPath`|`scijava-command3` presentation metadata (layer 1). All of it survives — menu path, label, icon, accelerator, weight, selection group, visibility, enablement — but as attributes in the annotation index rather than an inheritance chain every plugin extends | planned |
90
90
|`Validated`, `ValidityProblem`| execution layer (Phase 3) | open |
91
91
|`Optional`|`scijava-optional` (satellite repo, moves in later) | open |
92
92
@@ -121,14 +121,15 @@ A **dropped** row is a successful outcome, not a gap.
121
121
|`app`| mostly `org.scijava.meta` for version and title metadata; the rest is app-shell material, dropped | planned |
122
122
|`thread`| EDT dispatch belongs with the UI layer (Phase 4); parallelism is `org.scijava.concurrent`| planned |
123
123
|`convert`|`org.scijava.convert3`: `Converter` asks one question - can you turn *this value* into *that type* - where SciJava Common had eight `canConvert` overloads and a `ConversionRequest` to carry the combinations. `ConvertService` becomes `Converters`, backed by plain `ServiceLoader` so that conversion sits *below* the container: parameter binding converts, and a script or command line supplies strings for everything. `DefaultConverter`'s pile of special cases becomes one converter per concern (cast, number, string, to-string, array, collection, constructor, file/path), each contributable and orderable by priority. `Converter.of(String.class, Foo.class, Foo::parse)` covers the common case in a line | ported |
124
+
| the legacy bridge |`org.scijava.bridge`: `LegacyCommandInfo` presents a SciJava Common `ModuleInfo` as a SciJava3 `CommandInfo`, so every existing ImageJ2 command and Fiji plugin appears in SciJava3 menus and runs through the SciJava3 runner, harvester and dialogs unchanged. Service and context parameters are filtered out (SciJava Common's `@Parameter` meant both "input" and "inject"); `DynamicCommand`s work because the module's own description is read after initialization; callbacks and validators resolve by name through `behavior(String)`. The dependency goes one way and lives only here | ported |
124
125
|`module`, `module.process`|`org.scijava.execute`: `@Parameter` on fields, `Executables` for the plain case, and `Runner` for the processor chain. `ModuleService.run` becomes `Runner.run`, still returning a future, but of an `ExecutionResult` that reports a declined run with its reason and its author rather than through `ModulePreprocessor.isCanceled()`| ported |
125
-
|`command`|`org.scijava.command`: `Command` is a `Runnable` whose `@Parameter` fields are its struct; `@Menu` (repeatable) carries the presentation metadata, read from the annotation index without loading the class. `CommandInfo` replaces `ModuleInfo` and needs no `Context` - a command is anything a user can run, whether its implementation is a class (`ClassCommandInfo`, read from the index) or a script; `MenuTree` replaces `ShadowMenu`. There is no `DynamicCommand`: see `choicesFrom` and `@Group(membersFrom)`| ported |
126
+
|`command`|`org.scijava.command3`: `Command` is a `Runnable` whose `@Parameter` fields are its struct; `@Menu` (repeatable) carries the presentation metadata, read from the annotation index without loading the class. `CommandInfo` replaces `ModuleInfo` and needs no `Context` - a command is anything a user can run, whether its implementation is a class (`ClassCommandInfo`, read from the index) or a script; `MenuTree` replaces `ShadowMenu`. There is no `DynamicCommand`: see `choicesFrom` and `@Group(membersFrom)`| ported |
126
127
| `script`, `script.process` | `org.scijava.script3`: `ScriptLanguage`/`ScriptSession` are the SPI, with `JsrLanguage` making every JSR-223 engine on the classpath available for free; GraalVM polyglot and Appose are further languages, not replacements. `ScriptInfo`/`ScriptModule` become `ScriptExecutable`, an ordinary `Executable`, so a script runs through the same `Runner`, preprocessors, dialogs and menus as a Java command. `ScriptService` has no equivalent: `Scripts.get().of(path)` is a line. The `#@` header syntax is unchanged, and declaration lines are blanked rather than removed so the language's error messages keep pointing at the right line. The processor chain (`ScriptProcessor` and friends) is not ported: it existed to rewrite scripts before evaluation, and parameters plus a shebang are all it was actually used for. `ScriptREPL`, `ScriptInterpreter`, `AutoCompleter` and `CodeGenerator` await the script editor. `ScriptFinder` is ported: it reads `#@script` directives and falls back to the directory hierarchy for a menu path, handing an application metadata rather than menus, since this component knows nothing about menus | ported |
127
128
|`widget` (`InputWidget`, `InputPanel`, `InputHarvester`, `WidgetModel`, `WidgetStyle`) |`org.scijava.ui3`: `Widget` is a view of a `ParameterNode`, `WidgetFactory` a discoverable `@Plugin`, `WidgetPanel` a widget holding widgets (so a group nests with no special case), and `WidgetPanels` walks the tree for every toolkit. `WidgetModel` has no equivalent - a widget reads the `ParameterModel` and the node directly, and `WidgetStyle`'s parsing is `Widgets.isStyle`/`styleValue`. `InputHarvester` is a `Preprocessor` that declines the run when the user dismisses the dialog, rather than setting a `canceled` flag on itself | ported |
128
129
|`ui.awt` (satellite repo `scijava-ui-awt`) |`org.scijava.awt`: the widget set in pure `java.awt` - no spinner, so the number widget is a field and a scroll bar - plus `Edt`, the first of the AWT platform layer that the Swing binding shares. `AWTColors`, `AWTWindows`, `AWTClipboard`, `AWTInputEventDispatcher` and the drag-and-drop dispatchers belong there too, when the `input`/`tool` layer arrives; the `AWTUI`/`AWTApplicationFrame`/`AWTStatusBar` shell classes await the application layer | ported |
129
130
|`ui.javafx` (satellite repo `scijava-ui-javafx`) |`org.scijava.javafx`: the same widget set as the Swing binding, plus `FxThread` for JavaFX's application thread. `JavaFXKeys`'s key-code mapping is worth keeping when the `input`/`tool` layer arrives; `JavaFXMenuCreator` is superseded by `FxMenus`, some 40 lines against `MenuCreator`| ported |
130
131
|`ui.swing.widget`|`org.scijava.swing`: number (spinner, with an optional slider or scroll bar and labelled ticks), text (field, password, area, and `BigInteger`/`BigDecimal`, which a spinner cannot step), toggle, choice, file, message, and the panel and dialog. `SpinnerBigDecimalModel`, `SpinnerBigIntegerModel`, `SpinnerTypedNumberModel` and `SpinnerNumberModelFactory` have no equivalent: `SpinnerNumberModel` already steps in the type of the value it holds, and arbitrary precision goes to the text widget. MigLayout is gone, in favor of `GridBagLayout`: one fewer dependency, and one fewer automatic module. The button, color, date, file-list and radio-choice widgets are not ported yet - each earns its place when something asks for it | ported |
131
-
|`menu` (`MenuCreator`, `AbstractMenuCreator`, `MenuService`, `ShadowMenu`) |`org.scijava.command`: `CommandInfo` is anything a user can run (a menu path being optional), `MenuTree` arranges the subset that has one, and `MenuCreator`/`Menus` are the toolkit-free walk, with `SwingMenus`, `FxMenus` and `AwtMenus` implementing it. `MenuService` has no equivalent: a menu bar is `MenuTree.of(Commands.discover(context))`, which is a line rather than a service | ported |
132
+
|`menu` (`MenuCreator`, `AbstractMenuCreator`, `MenuService`, `ShadowMenu`) |`org.scijava.command3`: `CommandInfo` is anything a user can run (a menu path being optional), `MenuTree` arranges the subset that has one, and `MenuCreator`/`Menus` are the toolkit-free walk, with `SwingMenus`, `FxMenus` and `AwtMenus` implementing it. `MenuService` has no equivalent: a menu bar is `MenuTree.of(Commands.discover(context))`, which is a line rather than a service | ported |
132
133
|`ui`, `menu`|`scijava-ui3` (toolkit-agnostic contracts) and `scijava-menu` (the menu tree), with `ApplicationFrame`/`Desktop`/`StatusBar`/`ToolBar` as contracts there and implementations in the toolkit bindings. Dropped from the *core*, not from the stack — see the layering section of [migration-plan.md](migration-plan.md)| planned |
0 commit comments