package net.sourceforge.ganttproject.action;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.Action;
import javax.swing.KeyStroke;

import net.sourceforge.ganttproject.GanttProject;
import net.sourceforge.ganttproject.GanttTree2;
import net.sourceforge.ganttproject.language.GanttLanguage;

public class CopyAction extends GPAction implements RolloverAction {
	/*private GanttTree2 myTree = null;

    public CopyAction(GanttTree2 tree, String iconSize) {
        super(null, iconSize);
        myTree = tree;
        this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
                KeyEvent.VK_C, GPAction.MENU_MASK));
    }*/

	private GanttProject gp = null;
	
    public CopyAction(GanttProject gp, String iconSize)
    {
    	super(null, iconSize);
    	this.gp = gp;
    	this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
                KeyEvent.VK_C, GPAction.MENU_MASK));
    }
    
    protected String getIconFilePrefix() {
        return "copy_";
    }

    /*public void actionPerformed(ActionEvent arg0) {
        myTree.copySelectedNode();
        
    }*/
    
    public void actionPerformed(ActionEvent arg0)
    {
    	this.gp.copyAction();
    }
    
    public void isIconVisible(boolean isNull) {
        setIconVisible(true);

    }

    public void setIconSize(String iconSize) {
        putValue(Action.SMALL_ICON, createIcon("16"));
    }

    protected String getLocalizedName() {
        return GanttProject.correctLabel(GanttLanguage.getInstance().getText(
                "copy"));
    }
}
