[josm-dev] Allow plugins to register search operators

Josh Doe josh at joshdoe.com
Tue Dec 27 13:39:16 GMT 2011


I'd like to work on this functionality this week, any comments?

http://josm.openstreetmap.de/ticket/7178
At least #5905 and #6232 require the functionality for plugins to
register search operators that can be used in the search dialog.
Relevant code changes would be in
org.openstreetmap.josm.actions.search.SearchCompiler. Currently an
if-else structure handles operators in parseFactor(). This could
perhaps be changed so that all operators (really subclasses of Match)
provide another method to return the name for the operator, or when
registering operators the name would be provided. This of course means
that SearchCompiler should have a method like addOperator() which will
append the new operator to a list, which both core and plugins can
use. This function should check for name conflicts and modify the new
operator name by appending an integer. The Match class should also
require the operator to return a short (and possibly a long)
description which can be used for generating help.

Does this sound like a reasonable implementation? I wouldn't want to
adversely impact performance of course.

-Josh



More information about the josm-dev mailing list