📄 movenodecommand.java
字号:
package hellogef.command;
import hellogef.model.NodeModel;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
public class MoveNodeCommand extends Command {
private NodeModel node;
private Point oldPos;
private Point newPos;
public void setLocation(Point p) {
this.newPos = p;
}
public void setNode(NodeModel node) {
this.node = node;
}
public void execute() {
oldPos = this.node.getLocation();
node.setLocation(newPos);
}
public String getLabel() {
return "Move Node";
}
public void redo() {
this.node.setLocation(newPos);
}
public void undo() {
this.node.setLocation(oldPos);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -