Ticket #22798: 22798.patch
| File 22798.patch, 37.3 KB (added by , 3 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
Subject: [PATCH] #22798: AbstractAction -> JosmAction --- IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java b/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
a b 9 9 import java.awt.event.ActionEvent; 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; 17 17 import java.util.HashSet; … … 21 21 import java.util.concurrent.Future; 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; 27 26 import javax.swing.JCheckBox; … … 34 33 import javax.swing.event.ListSelectionEvent; 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; 39 39 import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler; … … 59 59 import org.openstreetmap.josm.io.NetworkManager; 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; 65 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;66 64 import org.openstreetmap.josm.tools.Shortcut; 65 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 67 66 68 67 /** 69 68 * ChangesetDialog is a toggle dialog which displays the current list of changesets. … … 296 295 /** 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); 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); 305 306 updateEnabledState(); 306 307 } 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) 310 316 return; … … 327 333 selectObjectsByChangesetIds(ds, sel); 328 334 } 329 335 336 @Override 330 337 protected void updateEnabledState() { 331 338 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0); 332 339 } … … 347 354 * Downloads selected changesets 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"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 362 false, false); 355 363 updateEnabledState(); 356 364 } 357 365 … … 365 373 MainApplication.worker.submit(new PostDownloadHandler(task, task.download())); 366 374 } 367 375 376 @Override 368 377 protected void updateEnabledState() { 369 378 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0 && !NetworkManager.isOffline(OnlineResource.OSM_API)); 370 379 } … … 384 393 * Closes the currently selected changesets 385 394 * 386 395 */ 387 class CloseOpenChangesetsAction extends AbstractAction implements ListSelectionListener, ItemListener {396 class CloseOpenChangesetsAction extends JosmAction implements ListSelectionListener, ItemListener { 388 397 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); 398 super(tr("Close open changesets"), "closechangeset", tr("Close the selected open changesets"), 399 Shortcut.registerShortcut("changeset:close", 400 tr("Changesets: Close the selected open changesets"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 401 false, false); 392 402 updateEnabledState(); 393 403 } 394 404 … … 400 410 MainApplication.worker.submit(new CloseChangesetTask(sel)); 401 411 } 402 412 413 @Override 403 414 protected void updateEnabledState() { 404 415 setEnabled(getCurrentChangesetListModel().hasSelectedOpenChangesets()); 405 416 } … … 419 430 * Show information about the currently selected changesets 420 431 * 421 432 */ 422 class ShowChangesetInfoAction extends AbstractAction implements ListSelectionListener, ItemListener {433 class ShowChangesetInfoAction extends JosmAction implements ListSelectionListener, ItemListener { 423 434 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); 435 super(tr("Show info"), "closechangeset", tr("Open a web page for each selected changeset"), 436 Shortcut.registerShortcut("changeset:info", 437 tr("Changesets: Open a web page for each selected changeset"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 438 false, false); 427 439 updateEnabledState(); 428 440 } 429 441 … … 440 452 } 441 453 } 442 454 455 @Override 443 456 protected void updateEnabledState() { 444 457 setEnabled(getCurrentChangesetList().getSelectedIndices().length > 0); 445 458 } … … 459 472 * Show information about the currently selected changesets 460 473 * 461 474 */ 462 class LaunchChangesetManagerAction extends AbstractAction {475 class LaunchChangesetManagerAction extends JosmAction { 463 476 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); 477 super(tr("Details"), "dialogs/changeset/changesetmanager", tr("Opens the Changeset Manager window for the selected changesets"), 478 Shortcut.registerShortcut("changeset:launch:manager", 479 tr("Changesets: Opens the Changeset Manager window for the selected changesets"), 480 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 481 false, false); 467 482 } 468 483 469 484 @Override -
src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java b/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
a b 16 16 import java.util.List; 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; 22 21 import javax.swing.JLabel; … … 38 37 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; 43 43 import org.openstreetmap.josm.data.UndoRedoHandler; … … 53 53 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 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; 59 58 import org.openstreetmap.josm.tools.SubclassFilteredCollection; … … 410 409 /** 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 /** 416 415 * Constructs a new {@code SelectAction}. 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 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 424 448 @Override … … 464 488 * Constructs a new {@code SelectAndZoomAction}. 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 473 497 @Override … … 488 512 /** 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; 494 518 … … 497 521 * @param type decide whether it is an undo action or a redo action 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 } 513 540 -
src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java b/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
a b 26 26 import javax.swing.table.TableColumnModel; 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; 31 32 import org.openstreetmap.josm.data.osm.Filter; … … 51 52 import org.openstreetmap.josm.gui.util.MultikeyShortcutAction; 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; 57 57 … … 118 118 tr("Filter mode") 119 119 }; 120 120 121 private abstract class FilterAction extends AbstractAction implements IEnabledStateUpdating {121 private abstract class FilterAction extends JosmAction implements IEnabledStateUpdating { 122 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); 123 FilterAction(String name, String description, String icon, Shortcut shortcut) { 124 super(name, "dialogs/" + icon, description, shortcut, false, false); 127 125 } 128 126 129 127 @Override … … 134 132 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 140 139 @Override … … 153 152 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 159 159 @Override … … 170 170 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 176 177 @Override … … 181 182 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 187 189 @Override … … 197 199 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 203 206 @Override … … 213 216 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 219 223 @Override … … 229 233 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 235 240 @Override -
src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java b/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
a b 310 310 } 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 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); 318 321 putValue(NAME, tr("On/Off")); 319 322 putValue(SHORT_DESCRIPTION, tr("Turn selected styles on or off")); 320 323 new ImageProvider("apply").getResource().attachImageIcon(this, true); 321 324 updateEnabledState(); 322 325 } 323 326 327 @Override 324 328 protected void updateEnabledState() { 325 329 setEnabled(!cbWireframe.isSelected() && tblStyles.getSelectedRowCount() > 0); 326 330 } … … 341 345 /** 342 346 * The action to move down the currently selected entries in the list. 343 347 */ 344 protected class MoveUpDownAction extends AbstractAction implements ListSelectionListener {348 protected class MoveUpDownAction extends JosmAction implements ListSelectionListener { 345 349 346 350 private final int increment; 347 351 … … 350 354 * @param isDown {@code true} to move the entry down, {@code false} to move it up 351 355 */ 352 356 public MoveUpDownAction(boolean isDown) { 357 super(isDown ? tr("Down") : tr("Up"), "dialogs/" + (isDown ? "down" : "up"), 358 isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."), 359 isDown ? Shortcut.registerShortcut("map:paint:style:down", tr("Map Paint Styles: Move selected entry down"), 360 KeyEvent.VK_UNDEFINED, Shortcut.NONE) 361 : Shortcut.registerShortcut("map:paint:style:up", tr("Map Paint Styles: Move selected entry up"), 362 KeyEvent.VK_UNDEFINED, Shortcut.NONE), 363 false, false); 353 364 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 365 updateEnabledState(); 358 366 } 359 367 368 @Override 360 369 public void updateEnabledState() { 361 370 int[] sel = tblStyles.getSelectedRows(); 362 371 setEnabled(!cbWireframe.isSelected() && MapPaintStyles.canMoveStyles(sel, increment)); -
src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
a b 18 18 import java.util.Objects; 19 19 import java.util.function.Predicate; 20 20 import java.util.regex.Pattern; 21 import java.util.stream.Collectors; 21 22 22 import javax.swing.AbstractAction;23 23 import javax.swing.AbstractListModel; 24 24 import javax.swing.DefaultListCellRenderer; 25 25 import javax.swing.ImageIcon; … … 34 34 import javax.swing.SwingUtilities; 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; 39 40 import org.openstreetmap.josm.data.notes.Note; … … 342 343 if (filter == null) { 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()); 348 349 setTitle(data.isEmpty() … … 350 351 : tr("Notes: {0}/{1}", filteredData.size(), data.size())); 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(); 355 360 data.addAll(noteList); 356 361 setFilter(filter); 357 362 } 358 363 364 /** 365 * Clear the note data 366 */ 359 367 public void clearData() { 360 368 displayList.clearSelection(); 361 369 data.clear(); … … 363 371 } 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 /** 369 380 * Constructs a new {@code AddCommentAction}. 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 377 388 @Override … … 395 406 } 396 407 } 397 408 398 class CloseAction extends AbstractAction { 409 /** 410 * Close a note 411 */ 412 class CloseAction extends JosmAction { 399 413 400 414 /** 401 415 * Constructs a new {@code CloseAction}. 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 409 423 @Override … … 427 441 } 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 /** 433 450 * Constructs a new {@code NewAction}. 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 441 458 @Override … … 449 466 } 450 467 } 451 468 452 class ReopenAction extends AbstractAction { 469 /** 470 * Reopen a note 471 */ 472 class ReopenAction extends JosmAction { 453 473 454 474 /** 455 475 * Constructs a new {@code ReopenAction}. 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 463 483 @Override … … 475 495 } 476 496 } 477 497 478 class SortAction extends AbstractAction { 498 /** 499 * Sort notes 500 */ 501 class SortAction extends JosmAction { 479 502 480 503 /** 481 504 * Constructs a new {@code SortAction}. 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 489 512 @Override … … 496 519 } 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 506 532 @Override -
src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java b/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
a b 18 18 import java.util.stream.Collectors; 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; 24 23 import javax.swing.FocusManager; … … 35 34 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; 40 40 import org.openstreetmap.josm.actions.relation.DuplicateRelationAction; … … 88 88 import org.openstreetmap.josm.gui.widgets.JosmTextField; 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; 94 93 import org.openstreetmap.josm.tools.Shortcut; … … 375 374 /** 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); 388 390 } … … 392 394 run(); 393 395 } 394 396 397 @Override 395 398 protected void updateEnabledState() { 396 399 setEnabled(MainApplication.getLayerManager().getEditLayer() != null); 397 400 } … … 513 516 if (removedPrimitives == null) return; 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()) 519 522 return; … … 597 600 } 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()) { 602 608 RelationListDialog.this.setTitle(tr("Relations: {0}/{1}", getSize(), relations.size())); -
src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java b/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
a b 29 29 import javax.swing.table.DefaultTableModel; 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; 34 35 import org.openstreetmap.josm.data.osm.OsmData; … … 45 46 import org.openstreetmap.josm.gui.util.GuiHelper; 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; 51 51 import org.openstreetmap.josm.tools.Shortcut; … … 163 163 return model.getSelectedUsers(rows); 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 /** 169 172 * Constructs a new {@code SelectUsersPrimitivesAction}. 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(); 180 186 if (indexes.length == 0) … … 187 193 select(); 188 194 } 189 195 196 @Override 190 197 protected void updateEnabledState() { 191 198 setEnabled(userTable != null && userTable.getSelectedRowCount() > 0); 192 199 } … … 203 210 class ShowUserInfoAction extends AbstractInfoAction implements ListSelectionListener { 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 } 212 218 … … 234 240 protected String createInfoUrl(Object infoObject) { 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; 240 246 }
