-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple splash icons #63
base: master
Are you sure you want to change the base?
Conversation
When using the imagej-launcher binary, only a minimal class path is set when ClassLauncher.main() is invoked. Hence, we manually construct a class loader that has loaded the required libraries and invoke SplashScreen.show() via reflection using the constructed class loader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for working on this. I am super excited for ImageJ to do this. Much nicer and more extensible for additional update sites and extensions.
However, I think we need to shoot for the following requirements here:
- No dependencies.
- No reflection.
- Therefore, no reliance on the classpath, but rather scanning for resources using "lower level" approaches. Probably
java.util.zip.ZipFile
and/orFile.listFiles()
.
Please don't feel obligated to work on this right away. I can take a crack at it later this spring.
public SplashIcon(final URL main, final Collection<URL> splashs) { | ||
super(main); | ||
|
||
// FIXME Simplify with streams when support for Java 6 was dropped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use FIXME
only to mean "This must be fixed ASAP and the code is broken until then." For a comment like this, use TODO
, which means "It would be nice to improve this." See also the relevant section of Coding Style wiki page.
else imageIcon = new ImageIcon(logoURL); | ||
|
||
// Find all splash icons on the classpath | ||
Map<String, URL> splashs = FileUtils.findResources(".*", "splash", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think... we better not depend on scijava-common in this project. I'll give some thought to the best way to avoid it here. I think we can recapitulate a targeted subset of what the FileUtils.findResources
method does.
} | ||
catch (Throwable t) { | ||
t.printStackTrace(); | ||
URLClassLoader classLoader = ClassLoaderPlus.getInImageJDirectory(null, "jars/imagej-launcher.jar"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect that Java 11 is going to hate this with "illegal reflective access". I think we can avoid it if we scan for splash icons using a strategy that does not rely on the classpath. Perhaps we can just inspect the available JAR files manually and rip out the resources using java.util.zip
.
Add functionality to the Java-based splash screen to paint multiple small splash icons on the main logo:
Icons ideally are PNGs with transparent background and need to be located within
src/main/resources/splash
in a project. They will be picked up by the splash once the JAR file of the project is installed in ImageJ/Fiji e.g. via the updater.Closes #54.