package Action;

import IHM.WorkingImage;
import Window.Interface;

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

public class ActionCloseProject extends AbstractAction {

    public ActionCloseProject(String name, String desc, Integer mnemonic) {
        super(name);
        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().reset();
        Interface.getInstance().createWindow();
        Interface.getInstance().showWindow();
    }
}