/*
 * 作成日: 2005/09/25
 */
package asandatabasebrowser.action;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

import asandatabasebrowser.Global;
import asandatabasebrowser.view.IMenuEnable;
import asandatabasebrowser.view.JTabbedTextArea;




public class TabAddAction extends AbstractAction {
	JTabbedTextArea tab;
	public TabAddAction(JTabbedTextArea tab) {
		super("AddTab");
		putValue(SHORT_DESCRIPTION, "タブを追加");
		putValue(LONG_DESCRIPTION, "タブを追加");
		putValue(SMALL_ICON, Global.getImageIcon("/resources/Tab_add.png"));
		this.tab = tab;
	}

    public void actionPerformed(ActionEvent ev) {
    	tab.addTextArea(tab.getCurrentText());
    	if (tab.getTopLevelAncestor() instanceof IMenuEnable) {
    		IMenuEnable frame = (IMenuEnable) tab.getTopLevelAncestor();
	    	frame.updateActionState();
    	}
    }
}

