Opened 12 years ago

Closed 12 years ago

#4546 closed defect (fixed)

Possibility to add custom search requests as toolbar buttons

Reported by: Komzpa Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: search Cc:


A feature that allows calling some number of searches from a toolbar would be nice.

Sample usecases:

  1. User adds a toolbar button that searches for "child parent selected | parent selected". Wherever user wants to quickly select multipolygon with all the members, user presses that toolbar button.
  1. Fixing an import. User downloads an area, clicks a button that searches for "user:WHOEVER_IMPORTED -modified" and considers what else needs fixing.

Attachments (0)

Change History (12)

comment:1 Changed 12 years ago by Ldp

This is notably different from the search history. The search history doesn't survive a restart, and requires searches to be reentered after such a restart. The position of a certain search in the search history drop down isn't fixed, and can drop off if a mapper executes other searches. This could conveniently be addressed by allowing a mapper to move his (complex) searches into toolbar buttons.

comment:2 Changed 12 years ago by Ldp

#3952 is about searches not remembered across JOSM restarts. If I could bookmark favourite searches, I wouldn't mind that much about #3952 anymore.

comment:3 Changed 12 years ago by malenki

A good suggestion, I second this.

comment:4 Changed 12 years ago by jttt

(In [3175]) Allow to set parameters for actions on toolbar. Used by SearchAction to set searching expression (see #4546)

comment:5 Changed 12 years ago by jttt

This is now possible, but I'm keeping the ticket open because the implementation is not too good.

To add predefined search to toolbar, go to Preferences - Toolbar and add Search action. In bottom part of dialog, you can set search expression. Empty expression will show search dialog, non empty will perform search directly. You can add multiple searches to the toolbar (but they will all look the same).

Search expression can look like this: ACR test. A means result will be added to selection (possible values: R=replace, A=add to selection, D=remove from selection, S=in selection). C means case sensitive search and R is regexp search.

comment:6 Changed 12 years ago by avarab@…

Nice basic implementation. Maybe this should be closed and #4113 kept open.

I think the logical next step is to support search presets as I originally filed a bug for. That would make it easy to distribute searches via some XML file (e.g. for many people working on an import) and you could add toolbar buttons just like you can with presets now.

comment:7 Changed 12 years ago by Ldp

Excellent, very handy enhancement!

Showing the entered search expression as tooltip would be handy, as would the general possibility of entering your own label/image for a toolbar button.

And I notice that when I enter the search expression in the settings, it won't set it to that value unless I press <enter> in the text field. Could be some (Windows) JAVA-ism?

comment:8 Changed 12 years ago by fsteggink

I also like this addition. It could become better if it would be possible to use macros / multiple queries. For example, during the 3dShapes import it is necessary to remove duplicate nodes. In order to make sure that only the 3dShapes nodes are merged, the following sequence needs to be entered (with dup nodes selected): A parent selected; A parent selected; S source=3dShapes
The semicolon doesn't work, but is used for illustrative purposes and as a suggestion.

comment:9 Changed 12 years ago by fsteggink

Another idea for enhancement: it should be possible to edit the search string in a textbox, which appears by right-clicking the tool button.

comment:10 Changed 12 years ago by anonymous

Ticket #2417 has been marked as a duplicate of this ticket.

comment:11 Changed 12 years ago by Ldp

Type: enhancementdefect

The toolbar searches seem to be broken currently.

Add Edit->Search as a toolbar button, configure a search expression (for example "R highway=residential") Click on the added search toolbar button. A "Preset" popup opens where you can scroll through a list of presets. The configured search expression does not run.

The preferences file does have "dialogs/search(searchExpression=R highway\=residential)".

Open the Preferences again: The "Search" entry is now showing as "Search preset" and the search expression field is gone. The preferences file now contains "dialogs/search".

comment:12 Changed 12 years ago by stoecker

Resolution: fixed
Status: newclosed

(In [3546]) fix #4546 - search dialog toolbar arguments broken

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.