- Timestamp:
- 2011-11-07T13:12:19+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r4543 r4587 3 3 4 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences.ActionParser; 5 6 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 import static org.openstreetmap.josm.tools.I18n.trc; … … 36 37 import org.openstreetmap.josm.data.osm.OsmPrimitive; 37 38 import org.openstreetmap.josm.gui.ExtendedDialog; 39 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; 38 40 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 39 41 import org.openstreetmap.josm.tools.GBC; … … 186 188 allElements.setToolTipText(tr("Also include incomplete and deleted objects in search.")); 187 189 final JCheckBox regexSearch = new JCheckBox(tr("regular expression"), initialValues.regexSearch); 190 final JCheckBox addOnToolbar = new JCheckBox(tr("Add toolbar button"), false); 188 191 189 192 JPanel top = new JPanel(new GridBagLayout()); … … 200 203 left.add(allElements, GBC.eol()); 201 204 left.add(regexSearch, GBC.eol()); 205 left.add(addOnToolbar, GBC.eol()); 202 206 } 203 207 … … 293 297 initialValues.allElements = allElements.isSelected(); 294 298 initialValues.regexSearch = regexSearch.isSelected(); 299 300 if (addOnToolbar.isSelected()) { 301 ToolbarPreferences.ActionDefinition aDef = 302 new ToolbarPreferences.ActionDefinition(Main.main.menu.search); 303 aDef.getParameters().put("searchExpression", initialValues); 304 // parametrized action definition is now composed 305 ActionParser actionParser = new ToolbarPreferences.ActionParser(null); 306 String res = actionParser.saveAction(aDef); 307 308 Collection<String> t = new LinkedList<String>(Main.pref.getCollection("toolbar")); 309 if (t!=null) { 310 // add custom search button to toolbar preferences 311 if (!t.contains(res)) t.add(res); 312 Main.pref.putCollection("toolbar", t); 313 Main.toolbar.refreshToolbarControl(); 314 } 315 } 295 316 return initialValues; 296 317 }
Note:
See TracChangeset
for help on using the changeset viewer.