CopyCommand.java
/*
* @(#)CopyCommand.java
*
* Project: JHotdraw - a GUI framework for technical drawings
* http://www.jhotdraw.org
* http://jhotdraw.sourceforge.net
* Copyright: © by the original author(s) and all contributors
* License: Lesser GNU Public License (LGPL)
* http://www.opensource.org/licenses/lgpl-license.html
*/
package CH.ifa.draw.standard;
import java.util.*;
import Testing.RunToTest;
import CH.ifa.draw.util.*;
import CH.ifa.draw.framework.*;
/**
* Copy the selection to the clipboard.
*
* @see Clipboard
*
* @version <$CURRENT_VERSION$>
*/
public class CopyCommand extends FigureTransferCommand {
/**
* Constructs a copy command.
* @param name the command name
* @param newDrawingEditor the DrawingEditor which manages the views
*/
public CopyCommand(String name, DrawingEditor newDrawingEditor) {
super(name, newDrawingEditor);
}
public void execute() {
super.execute();
//System.out.println("start-copyFigures");
RunToTest.endStartSeparation("#doStart");
RunToTest.endStartSeparation("copyFigures");
copyFigures(view().selectionElements(), view().selectionCount());
RunToTest.endStartSeparation("#doStop");
//System.out.println("end-copyFigures");
}
protected boolean isExecutableWithView() {
return view().selectionCount() > 0;
}
}