package Action;

import IHM.WorkingImage;
import Window.Interface;

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

public class ActionUndo extends AbstractAction {

    public ActionUndo(String text, String desc, Integer mnemonic) {
        super(text);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(Action.MNEMONIC_KEY, mnemonic);
        if (WorkingImage.getInstance().getImages().size() == 0)
            setEnabled(false);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        WorkingImage.getInstance().undo();
        Interface.getInstance().showWindow();
    }
}