/*
 * @(#)CutCommand.java 5.1
 *
 */

package CH.ifa.draw.standard;


/**
 * Delete the selection and move the selected figures to
 * the clipboard.
 * See {@link CH.ifa.draw.util.Clipboard}.
 * @deprecated This class is not to be used externally and will later be hidden.
 */
@Deprecated(since = "5.0", forRemoval = true)
@SuppressWarnings("removal")
public class CutCommand extends FigureTransferCommand {

    /**
     * Constructs a cut command.
     * @param name the command name
     */
    public CutCommand(String name) {
        super(name);
    }

    @Override
    public boolean executeUndoable() {
        copySelection();
        deleteSelection();
        getEditor().view().checkDamage();
        return true;
    }

    @Override
    public boolean isExecutable() {
        if (!super.isExecutable()) {
            return false;
        }
        return getEditor().view().selectionCount() > 0;
    }
}