-
Notifications
You must be signed in to change notification settings - Fork 20
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
Restore addImports functionality #67
base: master
Are you sure you want to change the base?
Conversation
The Reflections project (https://github.com/ronmamo/reflections) adds support for scanning the classpath for various elements, including annotations, types, methods, etc... with pattern filters.
When given a "raw" class (no package), addImport will now iterate over all elements in the core ImageJ packages looking for potential matches to the requested class. All potential matches will be added as imports (e.g. net.imglib2.ImgPlus and net.imglib2.meta.ImgPlus will both be added). If there are no matches, the class will be imported without a package. Addresses http://fiji.sc/bugzilla/show_bug.cgi?id=817
Firstly: cool idea. Questions and concerns:
|
Slow. Takes a second or two. So you can tell it's happening but it doesn't feel ridiculous. That said, I wrote it so that it only scans once and caches the discovered collection. Iterating the org-filtered collection of items is not really noticeable on subsequent adds. Regardless, we could possibly add a progress bar.
Yep I agree with this plan.
Agreed that this should be changed; that was a primary motivator for the |
Or perhaps repurpose the fiji-scripting project. I dunno. |
Yes, I would rather do this. But on my computer it takes 9s to scan all resources without filters, and 1.5s with filters. Anyway if we use an extensible model we can easily add more packages as needed.
@ctrueden - after further thought here is my take on the architecture:
any concerns? |
per @ctrueden's suggestion we can just run this initialization on a background thread at startup |
The |
Allows package detection of imports in Java in the script editor.
See http://fiji.sc/bugzilla/show_bug.cgi?id=817