Skip to content

Simplify the OmeZarrOpenActions and OmeZarr APIs - #163

Open
stefanhahmann wants to merge 3 commits into
mainfrom
issue-162-open-actions-api
Open

stefanhahmann wants to merge 3 commits into
mainfrom
issue-162-open-actions-api

Conversation

@stefanhahmann

@stefanhahmann stefanhahmann commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #162.

OmeZarrOpenActions (the issue). withSettings and withDefaultBackend returned an OmeZarr, not actions, which was confusing next to openWithSettings. The factory method now lives on the settings class as OmeZarrOpeningSettings.createOmeZarr.

Result in IDE:

grafik grafik

OmeZarr constructors.

  • One public constructor remains (instead of previously 4)
  • plus chainable withPreferredMaxWidth and withErrorHandler instead.

Btw, this also addresses this review comment on #150 I overlooked earlier on: showInBdv( BdvHandle ) no longer installs the drop target as a side effect. OmeZarr.showInBdv( bdvHandle ) only shows the image, and the caller decides about drag and drop with OmeZarrBdvDropListener.install( bdvHandle, context ). That works for a BDV opened elsewhere, e.g. with Vistools, too. Adding to such a BDV via the GUI remains #160.

ome-zarr-imglib2, ome-zarr-n5, ome-zarr-zarrjava

No API changes.

ome-zarr-fiji

  • Removed: the OmeZarr constructor taking preferredMaxWidth and errorHandler. Use instead now new OmeZarr( uri, context, backend ).withPreferredMaxWidth( … ).withErrorHandler( … ).
  • Deprecated to be removed with 0.11: the OmeZarr constructor taking preferredMaxWidth(bigvolumebrowser calls it).
  • Now package-private: the constructor taking openAnywayConfirmation.
  • Added: OmeZarr.withPreferredMaxWidth( Integer ) and withErrorHandler( Consumer< String > ) chainables.

ome-zarr-fiji-ui

  • Removed from OmeZarrOpenActions:
    • withSettings(…) and withDefaultBackend(…). Use OmeZarrOpeningSettings.createOmeZarr(…) or new OmeZarr(…).
    • The constructors taking a URI. Use new OmeZarrOpenActions( omeZarr ).
    • showInImageJ(), showInImageJ( int ), showInBdv() and showInBdv( BdvHandle ). Call them on the OmeZarr.
  • OmeZarrOpenActions.showHelp() is now static.
  • Added: OmeZarrOpeningSettings.createOmeZarr( URI, Context, Consumer< String > ).

🤖 Generated with Claude Code

Its withSettings/withDefaultBackend factories returned an OmeZarr, and its
URI constructors and show delegates served only tests. The factory is now
OmeZarrOpeningSettings.createOmeZarr, the only constructor takes an OmeZarr,
the BDV openers install the drop target themselves, and showHelp is static.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stefanhahmann stefanhahmann self-assigned this Oct 27, 2026
@stefanhahmann

stefanhahmann commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Effect of the breaking changes on downstream users, checked on main of mobie/mobie-io (ae2e801) and UU-cellbiology/bigvolumebrowser (42e658c). Both pin ome-zarr 0.9.1 and neither depends on ome-zarr-fiji-ui. mobie-io is not affected.

Project File Current code Change Effect Fix
bigvolumebrowser bvb/io/OmeZarrBVB.java:169 (openURIZarrJavaBackend, called from PanelAddSources.java:284) new OmeZarr( uri, context, new ZarrJavaPyramidBackend(), null ) 4-argument OmeZarr constructor deprecated, removed with 0.11 Compiles and runs with a deprecation warning. Breaks with 0.11 (compile error, NoSuchMethodError for a jar built against an older version). Drop the null before 0.11: new OmeZarr( uri, context, new ZarrJavaPyramidBackend() ). Same behaviour, since null meant full resolution.

OmeZarr had four public constructors, so setting an error handler meant
passing a positional null for the preferred width. There is now one public
constructor plus withPreferredMaxWidth and withErrorHandler, which return
copies and chain in any order. The constructor taking the open-anyway
confirmation is package-private, since only tests replace the dialog.
The 4-argument constructor stays, deprecated until 0.11, because
bigvolumebrowser calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stefanhahmann
stefanhahmann force-pushed the issue-162-open-actions-api branch from de6a09c to a90c457 Compare October 28, 2026 11:40
stefanhahmann added a commit that referenced this pull request Oct 28, 2026
The test opens the chooser's real modal dialog and presses OK from a
WINDOW_OPENED listener. If OK is never pressed, choose() blocks forever.
That happened once in the SonarCloud job on PR #163, which ran until
GitHub cancelled it after six hours. The cause is unknown. The same test
passed in that job on main, and it passes locally on JDK 11 and 21.

Now a 5 second timeout, run on a separate thread so JUnit can abandon
the blocked one, turns any hang into a failed test that names itself.
The listener also only touches the chooser's dialog, matched by title,
so a dialog left behind by another test cannot trip it.

Polling for the showing dialog instead of listening was tried and
dropped: JOptionPane resets its value on COMPONENT_SHOWN, so pressing
OK too early gets wiped (an empty result on JDK 11). Window.show() posts
WINDOW_OPENED after that reset, which is why the listener is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stefanhahmann
stefanhahmann force-pushed the issue-162-open-actions-api branch from e9f5456 to 65563ab Compare October 28, 2026 11:52
A dialog that was never closed held the SonarCloud job.
A 5 seconds timeout now fails the test instead, and the
listener only touches the chooser's own dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stefanhahmann
stefanhahmann force-pushed the issue-162-open-actions-api branch from 65563ab to 4ac3667 Compare October 28, 2026 11:53
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve public API (OmeZarrOpenActions)

1 participant