GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ADD: SelfShowableContent - a new kind of opening outcome by xulman · Pull Request #473 · scijava/scijava-common

Conversation

@xulman

@xulman xulman commented Oct 18, 2023

Copy link
Copy Markdown

It is often used in conjuction with openers that do load-and-show on their own,
as opposed to load-only-and-have-Fiji-to-show pattern.

Requires a patch on the imagej-legacy side... will PR there too.

Example code

package sc.fiji.ome.zarr.fiji.ui;

import net.imagej.ImageJ;
import org.scijava.io.AbstractIOPlugin;
import org.scijava.io.IOPlugin;
import org.scijava.io.location.Location;
import org.scijava.plugin.Attr;
import org.scijava.plugin.Plugin;
import org.scijava.ui.SelfShowableContent;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

@Plugin(type = IOPlugin.class, attrs = @Attr(name = "eager"))
public class MinimalFolderOpeningExample extends AbstractIOPlugin<Object> {
	@Override
	public boolean supportsOpen(Location source) {
		System.out.println(this.getClass().getName() + " is considering the file "+source);
		//
		final Path filePath = Paths.get(source.getURI());
		boolean canOpen = Files.isDirectory(filePath) && filePath.toString().endsWith(".xyz");
		System.out.println(this.getClass().getName() + " says canOpen = " + canOpen);
		return canOpen;
	}

	@Override
	public Object open(Location source) throws IOException {
		final String message = this.getClass().getName() + " is opening the file "+source;

		return new SelfShowableContent<>(
				source.toString(),
				m -> System.out.println("I just took care of the .xyz folder: "+m)
		);
	}

	@Override
	public Class<Object> getDataType() {
		return Object.class;
	}

	public static void main(String[] args) {
		ImageJ ij = new ImageJ();
		ij.ui().showUI();
	}
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bogovicj and ctrueden reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@xulman xulman mentioned this pull request Oct 18, 2023
revisited the DefaultLegacyOpener, added support for SelfShowableContent imagej/imagej-legacy#302
Open
@xulman

xulman commented Oct 18, 2023

Copy link
Copy Markdown
Author

this PR becomes useful only in conjunction with imagej/imagej-legacy#302

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 18, 2023
avoid opening data that was already opened in 3rd party opener fiji/IO#18
Closed
IOService recognizes a new 3rd state of loading data #430
Closed
@ctrueden
ctrueden force-pushed the master branch 3 times, most recently from 53b6733 to 3dc99c9 Compare November 7, 2023 18:37
@ctrueden ctrueden self-assigned this Dec 23, 2023
@xulman
ADD: SelfShowableContent - a new kind of opening outcome
13626d1
It is often used in conjuction with openers that do load-and-show
on their own, as opposite to load-only-and-have-Fiji-to-show pattern.
@xulman
xulman force-pushed the SelfShowableContent branch from cdc04ef to 13626d1 Compare March 4, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ctrueden ctrueden

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@xulman @ctrueden
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.