001package jmri.jmrit.operations.automation.gui; 002 003import java.awt.Frame; 004import java.awt.event.ActionEvent; 005 006import javax.swing.AbstractAction; 007 008import jmri.jmrit.operations.automation.Automation; 009 010/** 011 * Action to reset an automation 012 * 013 * @author Daniel Boudreau Copyright (C) 2016 014 */ 015public class AutomationCopyAction extends AbstractAction { 016 017 private Automation _automation; 018 019 public AutomationCopyAction() { 020 super(Bundle.getMessage("MenuCopyAutomation")); 021 } 022 023 public AutomationCopyAction(Automation automation) { 024 super(Bundle.getMessage("MenuCopyAutomation")); 025 _automation = automation; 026 } 027 028 AutomationCopyFrame f = null; 029 030 @Override 031 public void actionPerformed(ActionEvent e) { 032 // create a copy train frame 033 if (f == null || !f.isVisible()) { 034 f = new AutomationCopyFrame(_automation); 035 } 036 f.setExtendedState(Frame.NORMAL); 037 f.setVisible(true); // this also brings the frame into focus 038 } 039}