Search field on menu



Hi all,

We are developing some tools on Neubias Taggathon. The question is:
how can I add a search field on the menubar already following ImageJ2 dev. Can you guys point me to some material?

The idea is to have: Help > Neubias > Search [xxxxxx]



Hi all,

I’m not sure what you mean exactly. How to integrate any command into the menu at a given position in the menu?
You can do one of the following:

  • Create a script performing your task (e.g. opening a URL), save it e.g. in ./ This will make it accessible in the menu at Help > Neubias > Search, and you can upload it to an update site via the updater.
  • If you need to do something more involved, you can implement org.scijava.plugin.Plugin and annotate it in Java with @Plugin (menuPath="Help>Neubias>Search")

Or did you think of an actual search text field directly in the menu where you can enter some text?? This would be an ideal use case for the search bar that is currently in development and has been discussed here:

Maybe the others will have more comments here…


Thanks for the input!

To clarify, the idea is:

Now, you have a item on the menu to click and this will run whatever command it mean to run, such as a plugin or opening a browser.

My idea is, instead of having a text with a name (like all entries on IJ menu), I would have a search button with a text field. When the user clicks the search button, it will be pointed to the webpage with the search results.

In that sense, the idea might be really close to the Search Bar. I’ll take a look into that and see if it fits.



I think there’s no way to achieve this in menus in a platform-independent manner: Windows doesn’t allow for editable text fields in menus, and the Search entry in the Help menu on OSX is an OS-specific thing, nothing that ImageJ or Java can control.

But it would be really awesome to have a NEUBIAS search plugin in the future search bar! @ctrueden, @haesleinhuepf We should try to keep that use case in mind for the upcoming ImageJ/KNIME hackathon in Konstanz next week :slight_smile:


That would be great! We are working hard on populating the website of neubias and the Bio Image Information indes (

I will be happy to (try to) help in anyway possible. Currently, I just added for testing and it works fine.

and suggestions and critics is very welcome.

Thanks @imagejan. I’ll keep my eyes on the search bar development.



@imagejan, neither you nor @haesleinhuepf will be in attendance, will you?

I would love to work on the search bar thing ASAP, because it is hugely impactful. But I also have other highly urgent stuff to do at that hackathon, including improvements to the core Ops framework, as well as PR reviews. We’ll see how things go… I definitely would be able to work on it with Robert at the MPI-CBG hackathon in December though!


Hey guys,

I just added a BISE search plugin to the WIP code:
It is actually just a copy of the WikiSearchPlugin, because apparently is a wiki.

The result could look like this:

BUT: There is a little bug in the HTML on server side. The XML is not well formed. In line 23, there is a slash missing at the end of the line. The meta tag is not closed properly:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

@vcaldas Do you know who could fix this little HTML issue on the server?

@ctrueden Unfortunately, I’m not attending the hackathon in Konstanz. We still could work on it in Dresden in December.


Great that it works!

I submitted a PR to suggest simplifying these Java plugins to even simpler Groovy scripts, as this saves many lines of code, while still being packaged into a single jar file by Maven:

Note that there is currently still a little issue with calling those URLs on Mac OS X, but as soon as this fix by @ctrueden is released, the scripts should work as expected on all platforms.

Thanks @haesleinhuepf for the illustrative example!

You’re right, my statement was a little optimistic, as my current first priorities on this field would be to work 1) on an #@include mechanism for scripts (scijava-common#261), and 2) on the batch-processor project (see this discussion).

So, December might be a more realistic target date for these plans.


@haesleinhuepf That’s amazing! I’ll spread the news over the BISE group!
I’ll ask for the fix to the person responsible.

That’s fantastic! Didn’t know was possible to do this way. Thanks!


Hey @vcaldas,

we’re almost coming back to the search bar thingy. Did you have time to find out who could fix the issue on server side?

That would allow us to get the BISE search in ImageJ actually running :wink:



Hi @haesleinhuepf

I just looked at it but I think with tag, it’s normal that there is no slash at the end.

So it’s not really the problem of HTML rendering - maybe it’s the parsing problem?



HI Kota,

thanks for looking into this! You’re right, the META tags in good old HTML didn’t need the slash. But if you want to parse the website with an XML parser, you need to have valid XML.Modern HTML is usually valid XML as well. The error message I’m face to at the moment looks like the following. By adding the slash it goes away immediately.

[Fatal Error] :26:5: The element type "meta" must be terminated by the matching end-tag "</meta>".
org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 5; The element type "meta" must be terminated by the matching end-tag "</meta>".
	at javax.xml.parsers.DocumentBuilder.parse(
	at java.util.TimerThread.mainLoop(

Furthermore, the META tag in the line below also has the / at the end. So it’s definitely fine to put the slash there.

There are now ways of making the BISE search run in ImageJ:



Hi @haesleinhuepf ,

I think the problem simply is that XML parser cannot parse HTML. I look for HTML parser and it seems that JSoup is recommended by many.

Would you try that?



Ok, I’ll take a look into that asap.



Hi guys.

@haesleinhuepf Awesome news!!

Sorry for the lack of reply. I’m in the middle of several trips and having some vacations in between. But I’m catching up the emails.

I do not have access to the website, as far as I know, although it seems that the issue is already being tackled.

@Kota How can I have access to that?
Than I’ll be happy to look further into the code.



Hi @vcaldas

great job that you are working on.

xml parser classes in @haesleinhuepf code can be replaced with the html parser of JSoup (not sure if this library is beautiful). For this to work, JSoup needs to be listed as one of the dependencies in pom.xml.

Am I answering your question?

Another idea is to add a plugin in that will offer search results as an xml / rss feed. I am not quite sure if there is such a plugin for Drupal.



Hi all,

I didn’t manage to solve the issue with the tag meta . So, I propose this solution, as suggested by @Kota using Jsoup.

I tested the code and it works great!
I’ll submit a pull after few more tests and proper commenting.


You can test it as a separated Jar file now.



Thanks @vcaldas for working on it, and glad to hear that you got things working.

FYI, it is much better not to commit JAR files to git directly. Instead, you should deploy the JAR to a binary Maven repository. See the Development Lifecycle page for details.


@ctrueden Glad you like and thanks for the tip!

That jar version was meant to be a quick and dirty test. I’ll work on that!