001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.actions; 003 004import static org.openstreetmap.josm.tools.I18n.tr; 005 006import java.awt.event.ActionEvent; 007import java.awt.event.KeyEvent; 008 009import org.openstreetmap.josm.tools.Shortcut; 010import org.openstreetmap.josm.tools.bugreport.BugReportSender; 011 012/** 013 * Reports a ticket to JOSM bugtracker. 014 * @since 7624 015 */ 016public class ReportBugAction extends JosmAction { 017 018 private final String text; 019 020 /** 021 * Constructs a new {@code ReportBugAction} that reports the normal status report. 022 */ 023 public ReportBugAction() { 024 this(null); 025 } 026 027 /** 028 * Constructs a new {@link ReportBugAction} for the given debug text. 029 * @param text The text to send 030 */ 031 public ReportBugAction(String text) { 032 super(tr("Report bug"), "bug", tr("Report a ticket to JOSM bugtracker"), 033 Shortcut.registerShortcut("reportbug", tr("Report a ticket to JOSM bugtracker"), 034 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true); 035 this.text = text; 036 } 037 038 @Override 039 public void actionPerformed(ActionEvent e) { 040 BugReportSender.reportBug(text == null ? ShowStatusReportAction.getReportHeader() : text); 041 } 042}