package com.fr.design.actions.file;

import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.menu.KeySetUtils;

import java.awt.event.ActionEvent;

/**
 * Author : daisy
 * Date: 13-8-16
 * Time: 下午3:23
 */
public class CloseCurrentTemplateAction extends UpdateAction {

	public CloseCurrentTemplateAction() {
        this.setMenuKeySet(KeySetUtils.CLOSE_CURRENT_TEMPLATE);
        this.setName(getMenuKeySet().getMenuKeySetName());
        this.setMnemonic(getMenuKeySet().getMnemonic());
        this.setAccelerator(getMenuKeySet().getKeyStroke());
	}

    /**
     * 动作
     * @param e 事件
     */
	public void actionPerformed(ActionEvent e) {
		MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
		MutilTempalteTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
		MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
	}
}