Ticket #19257: 19257.2.patch
| File 19257.2.patch, 6.8 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/AbstractShowHistoryAction.java
1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.actions; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import javax.swing.AbstractAction; 7 8 import org.openstreetmap.josm.tools.ImageProvider; 9 10 /** 11 * Superclass of "History" actions in various parts of JOSM. 12 * @since xxx 13 */ 14 public abstract class AbstractShowHistoryAction extends AbstractAction { 15 /** 16 * Constructs a new {@code AbstractShowHistoryAction}. 17 */ 18 public AbstractShowHistoryAction() { 19 putValue(NAME, tr("History")); 20 putValue(SHORT_DESCRIPTION, tr("Download and show the history of the selected objects.")); 21 new ImageProvider("dialogs", "history").getResource().attachImageIcon(this, true); 22 } 23 } -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
37 37 import javax.swing.event.ListSelectionListener; 38 38 import javax.swing.event.PopupMenuEvent; 39 39 40 import org.openstreetmap.josm.actions.AbstractShowHistoryAction; 40 41 import org.openstreetmap.josm.actions.AbstractSelectAction; 41 42 import org.openstreetmap.josm.actions.AutoScaleAction; 42 43 import org.openstreetmap.josm.actions.AutoScaleAction.AutoScaleMode; … … 347 348 /** 348 349 * The action for showing history information of the current history item. 349 350 */ 350 class ShowHistoryAction extends Abstract Action implements ListSelectionListener, DataSelectionListener {351 class ShowHistoryAction extends AbstractShowHistoryAction implements ListSelectionListener, DataSelectionListener { 351 352 /** 352 353 * Constructs a new {@code ShowHistoryAction}. 353 354 */ 354 355 ShowHistoryAction() { 355 putValue(NAME, tr("History")); 356 putValue(SHORT_DESCRIPTION, tr("Display the history of the selected objects.")); 357 new ImageProvider("dialogs", "history").getResource().attachImageIcon(this, true); 356 super(); 358 357 updateEnabledState(model.getSize()); 359 358 } 360 359 … … 370 369 } 371 370 372 371 protected void updateEnabledState(int osmSelectionSize) { 373 // See #10830 - allow to click on history button i sa single object is selected, even if not selected again in the list372 // See #10830 - allow to click on history button if a single object is selected, even if not selected again in the list 374 373 setEnabled(!model.isSelectionEmpty() || osmSelectionSize == 1); 375 374 } 376 375 -
src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
34 34 import javax.swing.event.ListSelectionEvent; 35 35 import javax.swing.event.ListSelectionListener; 36 36 37 import org.openstreetmap.josm.actions.AbstractShowHistoryAction; 37 38 import org.openstreetmap.josm.actions.AutoScaleAction; 38 39 import org.openstreetmap.josm.actions.HistoryInfoAction; 39 40 import org.openstreetmap.josm.actions.downloadtasks.ChangesetContentDownloadTask; … … 222 223 } 223 224 } 224 225 225 class ShowHistoryAction extends Abstract Action implements ListSelectionListener {226 class ShowHistoryAction extends AbstractShowHistoryAction implements ListSelectionListener { 226 227 227 228 ShowHistoryAction() { 228 putValue(NAME, tr("Show history")); 229 new ImageProvider("dialogs", "history").getResource().attachImageIcon(this); 230 putValue(SHORT_DESCRIPTION, tr("Download and show the history of the selected objects")); 229 super(); 231 230 updateEnabledState(); 232 231 } 233 232 -
src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
21 21 import javax.swing.event.ListSelectionEvent; 22 22 import javax.swing.event.ListSelectionListener; 23 23 24 import org.openstreetmap.josm.actions.AbstractShowHistoryAction; 24 25 import org.openstreetmap.josm.actions.AutoScaleAction; 25 26 import org.openstreetmap.josm.actions.AutoScaleAction.AutoScaleMode; 26 27 import org.openstreetmap.josm.actions.HistoryInfoAction; … … 105 106 menu.addSeparator(); 106 107 menu.add(new SelectPreviousGapAction()); 107 108 menu.add(new SelectNextGapAction()); 108 menu.add(new HistoryInfoAction() {109 menu.add(new AbstractShowHistoryAction() { 109 110 @Override 110 111 public void actionPerformed(ActionEvent ae) { 111 112 Collection<OsmPrimitive> sel = getMemberTableModel().getSelectedChildPrimitives(); -
src/org/openstreetmap/josm/gui/history/ShowHistoryAction.java
1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr;5 6 4 import java.awt.event.ActionEvent; 7 5 import java.awt.event.MouseAdapter; 8 6 import java.awt.event.MouseEvent; … … 9 7 import java.util.Collections; 10 8 import java.util.function.Function; 11 9 12 import javax.swing.AbstractAction; 13 10 import org.openstreetmap.josm.actions.AbstractShowHistoryAction; 14 11 import org.openstreetmap.josm.data.osm.PrimitiveId; 15 import org.openstreetmap.josm.tools.ImageProvider;16 12 17 13 /** 18 14 * Open a history browser with the history of an object. 19 15 */ 20 class ShowHistoryAction extends Abstract Action {16 class ShowHistoryAction extends AbstractShowHistoryAction { 21 17 private transient PrimitiveId primitiveId; 22 18 23 /**24 * Constructs a new {@code ShowHistoryAction}.25 */26 ShowHistoryAction() {27 putValue(NAME, tr("Show history"));28 putValue(SHORT_DESCRIPTION, tr("Display the history of the selected object."));29 new ImageProvider("dialogs", "history").getResource().attachImageIcon(this, true);30 }31 32 19 @Override 33 20 public void actionPerformed(ActionEvent e) { 34 21 if (isEnabled()) {
