001package jmri.jmrix.cmri.serial.diagnostic; 002 003import java.awt.event.ActionEvent; 004import javax.swing.AbstractAction; 005import jmri.jmrix.cmri.CMRISystemConnectionMemo; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009/** 010 * Swing action to create and register a DiagnosticFrame object 011 * 012 * @author Dave Duchamp Copyright (C) 2004 013 */ 014public class DiagnosticAction extends AbstractAction { 015 016 private CMRISystemConnectionMemo _memo = null; 017 018 public DiagnosticAction(String s,CMRISystemConnectionMemo memo) { 019 super(s); 020 _memo = memo; 021 } 022 023 public DiagnosticAction(CMRISystemConnectionMemo memo) { 024 this(Bundle.getMessage("MenuItemDiagnostics"),memo); 025 } 026 027 @Override 028 public void actionPerformed(ActionEvent e) { 029 DiagnosticFrame f = new DiagnosticFrame(_memo); 030 try { 031 f.initComponents(); 032 } catch (Exception ex) { 033 log.error("Exception: {}", ex.toString()); 034 } 035 f.setVisible(true); 036 } 037 038 private final static Logger log = LoggerFactory.getLogger(DiagnosticAction.class); 039}