#14923 closed enhancement (fixed)
[patch] JOSM search by preset in the search dialog
Reported by: | bafonins | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 17.07 |
Component: | Core | Version: | |
Keywords: | Cc: | michael2402 |
Description (last modified by )
Currently, there are two menu entries to perform searching - "Search" and "Search for object by preset...". And functionality to search for osm objects is very limiting, namely there is no way to search for two or more presets at the same time, it is not possible to add object that match the preset to the current selection and etc.
I propose to merge these dialogs, actually adding functionality to search for presets to the search dialog. Then queries like
preset:water | preset:waterway or
preset:Village | preset:"Cave Entrance" | highway=motorway
can be performed + the selection settings from the search dialog can be used to control selected objects.
Also, we can embed the "Search for objectsby preset..." dialog intro the "Search" dialog in order to simply select needed presets and append 'preset:...' query to the text field.
Attachments (8)
Change History (22)
by , 8 years ago
Attachment: | preset-search..jpg added |
---|
by , 8 years ago
Attachment: | preset-search.patch added |
---|
comment:1 by , 8 years ago
Summary: | JOSM search by preset in the search dialog → [patch] JOSM search by preset in the search dialog |
---|
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:4 by , 8 years ago
Description: | modified (diff) |
---|
comment:5 by , 8 years ago
Milestone: | → 17.06 |
---|
follow-up: 7 comment:6 by , 8 years ago
There is a github PR for this patch. Commenting is easier there. I did a review on it - especially to address some coding style issues:
follow-up: 8 comment:7 by , 8 years ago
Replying to michael2402:
There is a github PR for this patch. Commenting is easier there.
No it is not. It is already enough work to react to one bug-tracker. Starting to react to different places is not a good idea.
comment:8 by , 8 years ago
Replying to stoecker:
Replying to michael2402:
There is a github PR for this patch. Commenting is easier there.
No it is not. It is already enough work to react to one bug-tracker. Starting to react to different places is not a good idea.
For conceptional issues I agree. But my comments were more on stylistic issues (variable names, inverting equals, using blocks in if/else, ...)
@bafonins: You patch looks better that way ;-). Cann you add test cases to it to the SearchCompilerTest
? Especially for:
preset:"water" (Test if it matches correctly) preset:water (Test if it matches correctly) preset: water (Test if it matches correctly) preset: (Should throw a ParseError) preset:xyz (Should throw a ParseError)
And fix this exception while typing in a preset search:
Build-Date:2017-06-11 12:26:22 Revision:12354 Is-Local-Build:true Identification: JOSM/1.5 (12354 SVN en) Linux Ubuntu 14.04.5 LTS Memory Usage: 615 MB / 3559 MB (423 MB allocated, but free) Java version: 1.8.0_111-8u111-b14-3~14.04.1-b14, Oracle Corporation, OpenJDK 64-Bit Server VM Screen: :0.0 1920x1080, :0.1 1920x1080 Maximum Screen Size: 1920x1080 Java package: openjdk-8-jre:amd64-8u111-b14-3~14.04.1 Java ATK Wrapper package: libatk-wrapper-java:all-0.30.4-4 VM arguments: [-Dfile.encoding=UTF-8] Dataset consistency test: No problems found Last errors/warnings: - W: java.util.zip.ZipException: error in opening zip file - W: PluginException: : org.openstreetmap.josm.plugins.PluginException: Invalid jar file '<josm.pref>/plugins/ebdirigo.jar.new' - W: Failed to scan file 'ebdirigo.jar.new' for plugin information. Skipping. - W: Failed to install plugin '<josm.pref>/plugins/ebdirigo.jar' from temporary download file '<josm.pref>/plugins/ebdirigo.jar.new'. error in opening zip file: java.util.zip.ZipException: error in opening zip file - W: No configuration settings found. Using hardcoded default values for all pools. - E: Handled by bug report queue: java.lang.NullPointerException === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (18) of main java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at org.openstreetmap.josm.actions.search.SearchCompiler$Preset.<init>(SearchCompiler.java:1571) at org.openstreetmap.josm.actions.search.SearchCompiler$CoreSimpleMatchFactory.get(SearchCompiler.java:159) at org.openstreetmap.josm.actions.search.SearchCompiler.parseFactor(SearchCompiler.java:1775) at org.openstreetmap.josm.actions.search.SearchCompiler.parseExpressionStep1(SearchCompiler.java:1697) at org.openstreetmap.josm.actions.search.SearchCompiler.parseExpression(SearchCompiler.java:1685) at org.openstreetmap.josm.actions.search.SearchCompiler.parse(SearchCompiler.java:1670) at org.openstreetmap.josm.actions.search.SearchCompiler.compile(SearchCompiler.java:1641) at org.openstreetmap.josm.actions.search.SearchAction$1.isValid(SearchAction.java:343) at org.openstreetmap.josm.actions.search.SearchAction$1.validate(SearchAction.java:328) at org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator.insertUpdate(AbstractTextComponentValidator.java:166) at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:201) at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:748) at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707) at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130) at org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox$AutoCompletingComboBoxDocument.insertString(AutoCompletingComboBox.java:109) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669) at javax.swing.text.JTextComponent.replaceSelection(JTextComponent.java:1328) at javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(DefaultEditorKit.java:884) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1663) at javax.swing.JComponent.processKeyBinding(JComponent.java:2882) at javax.swing.JComponent.processKeyBindings(JComponent.java:2929) at javax.swing.JComponent.processKeyEvent(JComponent.java:2845) at java.awt.Component.processEvent(Component.java:6310) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771) at java.awt.Component.dispatchEventImpl(Component.java:4760) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109) at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227) at java.security.AccessController.doPrivileged(Native Method) at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227) at java.awt.Dialog.show(Dialog.java:1084) at java.awt.Component.show(Component.java:1671) at java.awt.Component.setVisible(Component.java:1623) at java.awt.Window.setVisible(Window.java:1014) at java.awt.Dialog.setVisible(Dialog.java:1005) at org.openstreetmap.josm.gui.ExtendedDialog.setVisible(ExtendedDialog.java:456) at org.openstreetmap.josm.gui.ExtendedDialog.showDialog(ExtendedDialog.java:253) at org.openstreetmap.josm.actions.search.SearchAction.showSearchDialog(SearchAction.java:390) at org.openstreetmap.josm.actions.search.SearchAction.search(SearchAction.java:517) at org.openstreetmap.josm.actions.search.SearchAction.actionPerformed(SearchAction.java:191) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1663) at javax.swing.JComponent.processKeyBinding(JComponent.java:2882) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:307) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:263) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2974) at javax.swing.JComponent.processKeyBindings(JComponent.java:2966) at javax.swing.JComponent.processKeyEvent(JComponent.java:2845) at java.awt.Component.processEvent(Component.java:6310) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771) at java.awt.Component.dispatchEventImpl(Component.java:4760) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
comment:9 by , 8 years ago
@bafonins: Should I merge this patch now or wait for your work on your future work?
comment:11 by , 8 years ago
Milestone: | 17.06 → 17.07 |
---|
Moving this until after the 17.6 release - the patch should be ready before then but we should have time to fix issues.
by , 8 years ago
Attachment: | en-search-dialog-expert.jpg added |
---|
The search dialog, expert mode, english
by , 8 years ago
Attachment: | ger-search-dialog-exp.jpg added |
---|
The search dialog, expert mode, german
comment:12 by , 8 years ago
With this update GUI of the search dialog changed a bit. New hints added, as well as a list of possible presets to search for.
After clicking on any preset in the selector, a corresponding string is generated and appended to the text field. Autocomplete is working and in case of selecting some preset that starts already used query, the generated part is selected. And of course, presets can be combined into more sophisticated queries as you usually do with types, names, logical operators, etc.
So, searching works as follows :
Annotation/Address - a regular query that matches all object that have the corresponding preset
Annotation/* - a wildcard query that matches all object that have any preset of the group Annotation
Any suggestions?
by , 8 years ago
Attachment: | preset-search-v4.patch added |
---|
Note before applying: Typo in the first line "all object_s_".