Changeset 18715 in josm for trunk/src/org
- Timestamp:
- 2023-04-25T17:06:43+02:00 (21 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r17333 r18715 10 10 import java.awt.event.ItemEvent; 11 11 import java.awt.event.ItemListener; 12 import java.awt.event.KeyEvent; 12 13 import java.awt.event.MouseAdapter; 13 14 import java.awt.event.MouseEvent; 14 import java.awt.event.KeyEvent;15 15 import java.util.Arrays; 16 16 import java.util.Collection; … … 22 22 import java.util.stream.Collectors; 23 23 24 import javax.swing.AbstractAction;25 24 import javax.swing.Action; 26 25 import javax.swing.DefaultListSelectionModel; … … 35 34 import javax.swing.event.ListSelectionListener; 36 35 36 import org.openstreetmap.josm.actions.JosmAction; 37 37 import org.openstreetmap.josm.actions.OpenBrowserAction; 38 38 import org.openstreetmap.josm.actions.downloadtasks.ChangesetHeaderDownloadTask; … … 60 60 import org.openstreetmap.josm.io.OnlineResource; 61 61 import org.openstreetmap.josm.spi.preferences.Config; 62 import org.openstreetmap.josm.tools.ImageProvider;63 62 import org.openstreetmap.josm.tools.Logging; 64 63 import org.openstreetmap.josm.tools.OpenBrowser; 64 import org.openstreetmap.josm.tools.Shortcut; 65 65 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 66 import org.openstreetmap.josm.tools.Shortcut;67 66 68 67 /** … … 297 296 * Selects objects for the currently selected changesets. 298 297 */ 299 class SelectObjectsAction extends AbstractAction implements ListSelectionListener, ItemListener {298 class SelectObjectsAction extends JosmAction implements ListSelectionListener, ItemListener { 300 299 301 300 SelectObjectsAction() { 302 putValue(NAME, tr("Select")); 303 putValue(SHORT_DESCRIPTION, tr("Select all objects assigned to the currently selected changesets")); 304 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 305 updateEnabledState(); 306 } 307 301 super(tr("Select"), "dialogs/select", tr("Select all objects assigned to the currently selected changesets"), 302 Shortcut.registerShortcut("changeset:select:objects", 303 tr("Changesets: Select all objects assigned to the currently selected changesets"), 304 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 305 false, false); 306 updateEnabledState(); 307 } 308 309 /** 310 * Select objects based off of the changeset id 311 * @param ds The dataset to select objects from 312 * @param ids The ids to select 313 */ 308 314 public void selectObjectsByChangesetIds(DataSet ds, Set<Integer> ids) { 309 315 if (ds == null || ids == null) … … 328 334 } 329 335 336 @Override 330 337 protected void updateEnabledState() { 331 338 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0); … … 348 355 * 349 356 */ 350 class ReadChangesetsAction extends AbstractAction implements ListSelectionListener, ItemListener {357 class ReadChangesetsAction extends JosmAction implements ListSelectionListener, ItemListener { 351 358 ReadChangesetsAction() { 352 putValue(NAME, tr("Download")); 353 putValue(SHORT_DESCRIPTION, tr("Download information about the selected changesets from the OSM server")); 354 new ImageProvider("download").getResource().attachImageIcon(this, true); 359 super(tr("Download"), "download", tr("Download information about the selected changesets from the OSM server"), 360 Shortcut.registerShortcut("changeset:download:information", 361 tr("Changesets: Download information about the selected changeset from the OSM server"), 362 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 363 false, false); 355 364 updateEnabledState(); 356 365 } … … 366 375 } 367 376 377 @Override 368 378 protected void updateEnabledState() { 369 379 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0 && !NetworkManager.isOffline(OnlineResource.OSM_API)); … … 385 395 * 386 396 */ 387 class CloseOpenChangesetsAction extends AbstractAction implements ListSelectionListener, ItemListener {397 class CloseOpenChangesetsAction extends JosmAction implements ListSelectionListener, ItemListener { 388 398 CloseOpenChangesetsAction() { 389 putValue(NAME, tr("Close open changesets")); 390 putValue(SHORT_DESCRIPTION, tr("Close the selected open changesets")); 391 new ImageProvider("closechangeset").getResource().attachImageIcon(this, true); 399 super(tr("Close open changesets"), "closechangeset", tr("Close the selected open changesets"), 400 Shortcut.registerShortcut("changeset:close", 401 tr("Changesets: Close the selected open changesets"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 402 false, false); 392 403 updateEnabledState(); 393 404 } … … 401 412 } 402 413 414 @Override 403 415 protected void updateEnabledState() { 404 416 setEnabled(getCurrentChangesetListModel().hasSelectedOpenChangesets()); … … 420 432 * 421 433 */ 422 class ShowChangesetInfoAction extends AbstractAction implements ListSelectionListener, ItemListener {434 class ShowChangesetInfoAction extends JosmAction implements ListSelectionListener, ItemListener { 423 435 ShowChangesetInfoAction() { 424 putValue(NAME, tr("Show info")); 425 putValue(SHORT_DESCRIPTION, tr("Open a web page for each selected changeset")); 426 new ImageProvider("help/internet").getResource().attachImageIcon(this, true); 436 super(tr("Show info"), "help/internet", tr("Open a web page for each selected changeset"), 437 Shortcut.registerShortcut("changeset:info", 438 tr("Changesets: Open a web page for each selected changeset"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 439 false, false); 427 440 updateEnabledState(); 428 441 } … … 441 454 } 442 455 456 @Override 443 457 protected void updateEnabledState() { 444 458 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0); … … 460 474 * 461 475 */ 462 class LaunchChangesetManagerAction extends AbstractAction {476 class LaunchChangesetManagerAction extends JosmAction { 463 477 LaunchChangesetManagerAction() { 464 putValue(NAME, tr("Details")); 465 putValue(SHORT_DESCRIPTION, tr("Opens the Changeset Manager window for the selected changesets")); 466 new ImageProvider("dialogs/changeset", "changesetmanager").getResource().attachImageIcon(this, true); 478 super(tr("Details"), "dialogs/changeset/changesetmanager", tr("Opens the Changeset Manager window for the selected changesets"), 479 Shortcut.registerShortcut("changeset:launch:manager", 480 tr("Changesets: Opens the Changeset Manager window for the selected changesets"), 481 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 482 false, false); 467 483 } 468 484 -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r17772 r18715 17 17 import java.util.Set; 18 18 19 import javax.swing.AbstractAction;20 19 import javax.swing.Box; 21 20 import javax.swing.JComponent; … … 39 38 import org.openstreetmap.josm.actions.AutoScaleAction; 40 39 import org.openstreetmap.josm.actions.AutoScaleAction.AutoScaleMode; 40 import org.openstreetmap.josm.actions.JosmAction; 41 41 import org.openstreetmap.josm.command.Command; 42 42 import org.openstreetmap.josm.command.PseudoCommand; … … 54 54 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 55 55 import org.openstreetmap.josm.tools.GBC; 56 import org.openstreetmap.josm.tools.ImageProvider;57 56 import org.openstreetmap.josm.tools.InputMapUtils; 58 57 import org.openstreetmap.josm.tools.Shortcut; … … 411 410 * Action that selects the objects that take part in a command. 412 411 */ 413 public class SelectAction extends AbstractAction implements IEnabledStateUpdating {412 public class SelectAction extends JosmAction implements IEnabledStateUpdating { 414 413 415 414 /** … … 417 416 */ 418 417 public SelectAction() { 419 putValue(NAME, tr("Select")); 420 putValue(SHORT_DESCRIPTION, tr("Selects the objects that take part in this command (unless currently deleted)")); 421 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 418 this(tr("Select"), "dialogs/select", tr("Selects the objects that take part in this command (unless currently deleted)"), 419 Shortcut.registerShortcut("command:stack:select", tr("Command Stack: Select"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 420 false, null, false); 421 } 422 423 /** 424 * Constructs a new {@code SelectAction} that calls 425 * {@link JosmAction#JosmAction(String, String, String, Shortcut, boolean, String, boolean)} 426 * 427 * The new super for all CommandStack actions. 428 * 429 * Use this super constructor to setup your action. 430 * 431 * @param name the action's text as displayed on the menu (if it is added to a menu) 432 * @param iconName the filename of the icon to use 433 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 434 * that html is not supported for menu actions on some platforms. 435 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 436 * do want a shortcut, remember you can always register it with group=none, so you 437 * won't be assigned a shortcut unless the user configures one. If you pass null here, 438 * the user CANNOT configure a shortcut for your action. 439 * @param registerInToolbar register this action for the toolbar preferences? 440 * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null 441 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 442 */ 443 protected SelectAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, 444 String toolbarId, boolean installAdapters) { 445 super(name, iconName, tooltip, shortcut, registerInToolbar, toolbarId, installAdapters); 422 446 } 423 447 … … 465 489 */ 466 490 public SelectAndZoomAction() { 467 putValue(NAME, tr("Select and zoom"));468 putValue(SHORT_DESCRIPTION,469 tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it"));470 new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true);491 super(tr("Select and zoom"), "dialogs/autoscale/selection", 492 tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it"), 493 Shortcut.registerShortcut("command:stack:select_and_zoom", tr("Command Stack: Select and zoom"), 494 KeyEvent.VK_UNDEFINED, Shortcut.NONE), false, null, false); 471 495 } 472 496 … … 489 513 * Action to undo or redo all commands up to (and including) the seleced item. 490 514 */ 491 protected class UndoRedoAction extends AbstractAction implements IEnabledStateUpdating {515 protected class UndoRedoAction extends JosmAction implements IEnabledStateUpdating { 492 516 private final UndoRedoType type; 493 517 private final JTree tree; … … 498 522 */ 499 523 public UndoRedoAction(UndoRedoType type) { 524 // This is really annoying. JEP 8300786 might fix this. 525 super(UndoRedoType.UNDO == type ? tr("Undo") : tr("Redo"), 526 UndoRedoType.UNDO == type ? "undo" : "redo", 527 UndoRedoType.UNDO == type ? tr("Undo the selected and all later commands") 528 : tr("Redo the selected and all earlier commands"), 529 UndoRedoType.UNDO == type 530 ? Shortcut.registerShortcut("command:stack:undo", tr("Command Stack: Undo"), KeyEvent.VK_UNDEFINED, Shortcut.NONE) 531 : Shortcut.registerShortcut("command:stack:redo", tr("Command Stack: Redo"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 532 false, false); 500 533 this.type = type; 501 534 if (UndoRedoType.UNDO == type) { 502 535 tree = undoTree; 503 putValue(NAME, tr("Undo"));504 putValue(SHORT_DESCRIPTION, tr("Undo the selected and all later commands"));505 new ImageProvider("undo").getResource().attachImageIcon(this, true);506 536 } else { 507 537 tree = redoTree; 508 putValue(NAME, tr("Redo"));509 putValue(SHORT_DESCRIPTION, tr("Redo the selected and all earlier commands"));510 new ImageProvider("redo").getResource().attachImageIcon(this, true);511 538 } 512 539 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r18556 r18715 27 27 import javax.swing.table.TableModel; 28 28 29 import org.openstreetmap.josm.actions.JosmAction; 29 30 import org.openstreetmap.josm.actions.mapmode.MapMode; 30 31 import org.openstreetmap.josm.actions.search.SearchAction; … … 52 53 import org.openstreetmap.josm.gui.util.TableHelper; 53 54 import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField; 54 import org.openstreetmap.josm.tools.ImageProvider;55 55 import org.openstreetmap.josm.tools.InputMapUtils; 56 56 import org.openstreetmap.josm.tools.Shortcut; … … 119 119 }; 120 120 121 private abstract class FilterAction extends AbstractAction implements IEnabledStateUpdating { 122 123 FilterAction(String name, String description, String icon) { 124 putValue(NAME, name); 125 putValue(SHORT_DESCRIPTION, description); 126 new ImageProvider("dialogs", icon).getResource().attachImageIcon(this, true); 121 private abstract class FilterAction extends JosmAction implements IEnabledStateUpdating { 122 123 FilterAction(String name, String description, String icon, Shortcut shortcut) { 124 super(name, "dialogs/" + icon, description, shortcut, false, false); 127 125 } 128 126 … … 135 133 private class AddAction extends FilterAction { 136 134 AddAction() { 137 super(tr("Add"), tr("Add filter."), /* ICON(dialogs/) */ "add"); 135 super(tr("Add"), tr("Add filter."), /* ICON(dialogs/) */ "add", 136 Shortcut.registerShortcut("filter:add", tr("Filter: Add"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 138 137 } 139 138 … … 154 153 private class EditAction extends FilterAction { 155 154 EditAction() { 156 super(tr("Edit"), tr("Edit filter."), /* ICON(dialogs/) */ "edit"); 155 super(tr("Edit"), tr("Edit filter."), /* ICON(dialogs/) */ "edit", 156 Shortcut.registerShortcut("filter:edit", tr("Filter: Edit"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 157 157 } 158 158 … … 171 171 private class DeleteAction extends FilterAction { 172 172 DeleteAction() { 173 super(tr("Delete"), tr("Delete filter."), /* ICON(dialogs/) */ "delete"); 173 super(tr("Delete"), tr("Delete filter."), /* ICON(dialogs/) */ "delete", 174 Shortcut.registerShortcut("filter:delete", tr("Filter: Delete"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 174 175 } 175 176 … … 182 183 private class MoveUpAction extends FilterAction { 183 184 MoveUpAction() { 184 super(tr("Up"), tr("Move filter up."), /* ICON(dialogs/) */ "up"); 185 super(tr("Up"), tr("Move filter up."), /* ICON(dialogs/) */ "up", 186 Shortcut.registerShortcut("filter:up", tr("Filter: Move up"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 185 187 } 186 188 … … 198 200 private class MoveDownAction extends FilterAction { 199 201 MoveDownAction() { 200 super(tr("Down"), tr("Move filter down."), /* ICON(dialogs/) */ "down"); 202 super(tr("Down"), tr("Move filter down."), /* ICON(dialogs/) */ "down", 203 Shortcut.registerShortcut("filter:down", tr("Filter: Move down"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 201 204 } 202 205 … … 214 217 private class SortAction extends FilterAction { 215 218 SortAction() { 216 super(tr("Sort"), tr("Sort filters."), /* ICON(dialogs/) */ "sort"); 219 super(tr("Sort"), tr("Sort filters."), /* ICON(dialogs/) */ "sort", 220 Shortcut.registerShortcut("filter:sort", tr("Filter: Sort"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 217 221 } 218 222 … … 230 234 private class ReverseAction extends FilterAction { 231 235 ReverseAction() { 232 super(tr("Reverse"), tr("Reverse the filters order."), /* ICON(dialogs/) */ "reverse"); 236 super(tr("Reverse"), tr("Reverse the filters order."), /* ICON(dialogs/) */ "reverse", 237 Shortcut.registerShortcut("filter:reverse", tr("Filter: Reverse"), KeyEvent.VK_UNDEFINED, Shortcut.NONE)); 233 238 } 234 239 -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r18311 r18715 311 311 } 312 312 313 protected class OnOffAction extends AbstractAction implements ListSelectionListener {313 protected class OnOffAction extends JosmAction implements ListSelectionListener { 314 314 /** 315 315 * Constructs a new {@code OnOffAction}. 316 316 */ 317 317 public OnOffAction() { 318 putValue(NAME, tr("On/Off"));319 putValue(SHORT_DESCRIPTION, tr("Turn selected styles on or off"));320 new ImageProvider("apply").getResource().attachImageIcon(this, true);318 super(tr("On/Off"), "apply", tr("Turn selected styles on or off"), 319 Shortcut.registerShortcut("map:paint:style:on_off", tr("Filter: Add"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 320 false, false); 321 321 updateEnabledState(); 322 322 } 323 323 324 @Override 324 325 protected void updateEnabledState() { 325 326 setEnabled(!cbWireframe.isSelected() && tblStyles.getSelectedRowCount() > 0); … … 342 343 * The action to move down the currently selected entries in the list. 343 344 */ 344 protected class MoveUpDownAction extends AbstractAction implements ListSelectionListener {345 protected class MoveUpDownAction extends JosmAction implements ListSelectionListener { 345 346 346 347 private final int increment; … … 351 352 */ 352 353 public MoveUpDownAction(boolean isDown) { 354 super(isDown ? tr("Down") : tr("Up"), "dialogs/" + (isDown ? "down" : "up"), 355 isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."), 356 isDown ? Shortcut.registerShortcut("map:paint:style:down", tr("Map Paint Styles: Move selected entry down"), 357 KeyEvent.VK_UNDEFINED, Shortcut.NONE) 358 : Shortcut.registerShortcut("map:paint:style:up", tr("Map Paint Styles: Move selected entry up"), 359 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 360 false, false); 353 361 increment = isDown ? 1 : -1; 354 putValue(NAME, isDown ? tr("Down") : tr("Up"));355 new ImageProvider("dialogs", isDown ? "down" : "up").getResource().attachImageIcon(this, true);356 putValue(SHORT_DESCRIPTION, isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."));357 362 updateEnabledState(); 358 363 } 359 364 365 @Override 360 366 public void updateEnabledState() { 361 367 int[] sel = tblStyles.getSelectedRows(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r18540 r18715 19 19 import java.util.function.Predicate; 20 20 import java.util.regex.Pattern; 21 22 import javax.swing.AbstractAction; 21 import java.util.stream.Collectors; 22 23 23 import javax.swing.AbstractListModel; 24 24 import javax.swing.DefaultListCellRenderer; … … 35 35 36 36 import org.openstreetmap.josm.actions.DownloadNotesInViewAction; 37 import org.openstreetmap.josm.actions.JosmAction; 37 38 import org.openstreetmap.josm.actions.UploadNotesAction; 38 39 import org.openstreetmap.josm.actions.mapmode.AddNoteAction; … … 343 344 filteredData.addAll(data); 344 345 } else { 345 data.stream().filter(filter).forEach(filteredData::add);346 filteredData.addAll(data.stream().filter(filter).collect(Collectors.toList())); 346 347 } 347 348 fireContentsChanged(this, 0, getSize()); … … 351 352 } 352 353 354 /** 355 * Set the note data 356 * @param noteList The notes to show 357 */ 353 358 public void setData(Collection<Note> noteList) { 354 359 data.clear(); … … 357 362 } 358 363 364 /** 365 * Clear the note data 366 */ 359 367 public void clearData() { 360 368 displayList.clearSelection(); … … 364 372 } 365 373 366 class AddCommentAction extends AbstractAction { 374 /** 375 * The action to add a new comment to OSM 376 */ 377 class AddCommentAction extends JosmAction { 367 378 368 379 /** … … 370 381 */ 371 382 AddCommentAction() { 372 putValue(SHORT_DESCRIPTION, tr("Add comment"));373 putValue(NAME, tr("Comment"));374 new ImageProvider("dialogs/notes", "note_comment").getResource().attachImageIcon(this, true);383 super(tr("Comment"), "dialogs/notes/note_comment", tr("Add comment"), 384 Shortcut.registerShortcut("notes:comment:add", tr("Notes: Add comment"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 385 false, false); 375 386 } 376 387 … … 396 407 } 397 408 398 class CloseAction extends AbstractAction { 409 /** 410 * Close a note 411 */ 412 class CloseAction extends JosmAction { 399 413 400 414 /** … … 402 416 */ 403 417 CloseAction() { 404 putValue(SHORT_DESCRIPTION, tr("Close note"));405 putValue(NAME, tr("Close"));406 new ImageProvider("dialogs/notes", "note_closed").getResource().attachImageIcon(this, true);418 super(tr("Close"), "dialogs/notes/note_closed", tr("Close note"), 419 Shortcut.registerShortcut("notes:comment:close", tr("Notes: Close note"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 420 false, false); 407 421 } 408 422 … … 428 442 } 429 443 430 class NewAction extends AbstractAction { 444 /** 445 * Create a new note 446 */ 447 class NewAction extends JosmAction { 431 448 432 449 /** … … 434 451 */ 435 452 NewAction() { 436 putValue(SHORT_DESCRIPTION, tr("Create a new note"));437 putValue(NAME, tr("Create"));438 new ImageProvider("dialogs/notes", "note_new").getResource().attachImageIcon(this, true);453 super(tr("Create"), "dialogs/notes/note_new", tr("Create a new note"), 454 Shortcut.registerShortcut("notes:comment:new", tr("Notes: New note"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 455 false, false); 439 456 } 440 457 … … 450 467 } 451 468 452 class ReopenAction extends AbstractAction { 469 /** 470 * Reopen a note 471 */ 472 class ReopenAction extends JosmAction { 453 473 454 474 /** … … 456 476 */ 457 477 ReopenAction() { 458 putValue(SHORT_DESCRIPTION, tr("Reopen note"));459 putValue(NAME, tr("Reopen"));460 new ImageProvider("dialogs/notes", "note_open").getResource().attachImageIcon(this, true);478 super(tr("Reopen"), "dialogs/notes/note_open", tr("Reopen note"), 479 Shortcut.registerShortcut("notes:comment:reopen", tr("Notes: Reopen note"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 480 false, false); 461 481 } 462 482 … … 476 496 } 477 497 478 class SortAction extends AbstractAction { 498 /** 499 * Sort notes 500 */ 501 class SortAction extends JosmAction { 479 502 480 503 /** … … 482 505 */ 483 506 SortAction() { 484 putValue(SHORT_DESCRIPTION, tr("Sort notes"));485 putValue(NAME, tr("Sort"));486 new ImageProvider("dialogs", "sort").getResource().attachImageIcon(this, true);507 super(tr("Sort"), "dialogs/sort", tr("Sort notes"), 508 Shortcut.registerShortcut("notes:comment:sort", tr("Notes: Sort notes"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 509 false, false); 487 510 } 488 511 … … 497 520 } 498 521 499 class OpenInBrowserAction extends AbstractAction { 522 /** 523 * Open the note in a browser 524 */ 525 class OpenInBrowserAction extends JosmAction { 500 526 OpenInBrowserAction() { 501 super(tr("Open in browser") );502 putValue(SHORT_DESCRIPTION, tr("Open the note in an external browser"));503 new ImageProvider("help", "internet").getResource().attachImageIcon(this, true);527 super(tr("Open in browser"), "help/internet", tr("Open the note in an external browser"), 528 Shortcut.registerShortcut("notes:comment:open_in_browser", tr("Notes: Open note in browser"), 529 KeyEvent.VK_UNDEFINED, Shortcut.NONE), false, false); 504 530 } 505 531 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r18211 r18715 19 19 import java.util.stream.IntStream; 20 20 21 import javax.swing.AbstractAction;22 21 import javax.swing.AbstractListModel; 23 22 import javax.swing.DefaultListSelectionModel; … … 36 35 import org.openstreetmap.josm.actions.ExpertToggleAction; 37 36 import org.openstreetmap.josm.actions.HistoryInfoAction; 37 import org.openstreetmap.josm.actions.JosmAction; 38 38 import org.openstreetmap.josm.actions.relation.AddSelectionToRelations; 39 39 import org.openstreetmap.josm.actions.relation.DeleteRelationsAction; … … 89 89 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 90 90 import org.openstreetmap.josm.spi.preferences.Config; 91 import org.openstreetmap.josm.tools.ImageProvider;92 91 import org.openstreetmap.josm.tools.InputMapUtils; 93 92 import org.openstreetmap.josm.tools.PlatformManager; … … 376 375 * The action for creating a new relation. 377 376 */ 378 static class NewAction extends AbstractAction implements LayerChangeListener, ActiveLayerChangeListener {377 static class NewAction extends JosmAction implements LayerChangeListener, ActiveLayerChangeListener { 379 378 NewAction() { 380 putValue(SHORT_DESCRIPTION, tr("Create a new relation"));381 putValue(NAME, tr("New"));382 new ImageProvider("dialogs", "add").getResource().attachImageIcon(this, true);379 super(tr("New"), "dialogs/add", tr("Create a new relation"), 380 Shortcut.registerShortcut("relation:new", tr("Create a new relation"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 381 false, false); 383 382 updateEnabledState(); 384 383 } 385 384 385 /** 386 * Make a new relation 387 */ 386 388 public void run() { 387 389 RelationEditor.getEditor(MainApplication.getLayerManager().getEditLayer(), null, null).setVisible(true); … … 393 395 } 394 396 397 @Override 395 398 protected void updateEnabledState() { 396 399 setEnabled(MainApplication.getLayerManager().getEditLayer() != null); … … 514 517 // extract the removed relations 515 518 Set<Relation> removedRelations = removedPrimitives.stream() 516 .filter( p -> p instanceof Relation).map(p -> (Relation) p)519 .filter(Relation.class::isInstance).map(Relation.class::cast) 517 520 .collect(Collectors.toSet()); 518 521 if (removedRelations.isEmpty()) … … 598 601 } 599 602 603 /** 604 * Update the title for the relation list dialog 605 */ 600 606 public void updateTitle() { 601 607 if (!relations.isEmpty() && relations.size() != getSize()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r18208 r18715 30 30 31 31 import org.openstreetmap.josm.actions.AbstractInfoAction; 32 import org.openstreetmap.josm.actions.JosmAction; 32 33 import org.openstreetmap.josm.data.osm.DataSelectionListener; 33 34 import org.openstreetmap.josm.data.osm.IPrimitive; … … 46 47 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 47 48 import org.openstreetmap.josm.spi.preferences.Config; 48 import org.openstreetmap.josm.tools.ImageProvider;49 49 import org.openstreetmap.josm.tools.Logging; 50 50 import org.openstreetmap.josm.tools.OpenBrowser; … … 164 164 } 165 165 166 class SelectUsersPrimitivesAction extends AbstractAction implements ListSelectionListener { 166 /** 167 * Select the primitives that a user modified <i>last</i>. 168 */ 169 class SelectUsersPrimitivesAction extends JosmAction implements ListSelectionListener { 167 170 168 171 /** … … 170 173 */ 171 174 SelectUsersPrimitivesAction() { 172 putValue(NAME, tr("Select"));173 putValue(SHORT_DESCRIPTION, tr("Select objects submitted by this user"));174 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true);175 super(tr("Select"), "dialogs/select", tr("Select objects submitted by this user"), 176 Shortcut.registerShortcut("user:select_primitives", tr("User: objects submitted by selected user"), 177 KeyEvent.VK_UNDEFINED, Shortcut.NONE), false, false); 175 178 updateEnabledState(); 176 179 } 177 180 181 /** 182 * Select the primitives owned by the selected users 183 */ 178 184 public void select() { 179 185 int[] indexes = userTable.getSelectedRows(); … … 188 194 } 189 195 196 @Override 190 197 protected void updateEnabledState() { 191 198 setEnabled(userTable != null && userTable.getSelectedRowCount() > 0); … … 204 211 205 212 ShowUserInfoAction() { 206 super(false); 207 putValue(NAME, tr("Show info")); 208 putValue(SHORT_DESCRIPTION, tr("Launches a browser with information about the user")); 209 new ImageProvider("help/internet").getResource().attachImageIcon(this, true); 213 super(tr("Show info"), "help/internet", tr("Launches a browser with information about the user"), 214 Shortcut.registerShortcut("user:open_in_browser", tr("User: Show info in browser"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 215 false, null, false); 210 216 updateEnabledState(); 211 217 } … … 235 241 if (infoObject instanceof User) { 236 242 User user = (User) infoObject; 237 return Config.getUrls().getBaseUserUrl() + '/' + Utils.encodeUrl(user.getName()).replace All("\\+", "%20");243 return Config.getUrls().getBaseUserUrl() + '/' + Utils.encodeUrl(user.getName()).replace("+", "%20"); 238 244 } else { 239 245 return null;
Note:
See TracChangeset
for help on using the changeset viewer.