@Override
protected void action() {
// look for the active mouse handler. If it exists, it should contain
// the current mouse position (from the mousemoved event), so use this
// to create a new PasteEvent
PasteAction a;
MouseHandler mh = MouseHandler.getActiveMouseHandler();
if (mh != null) {
a = new PasteAction("Paste", (NodeContainer)mh.getWorld(), true);
Point2D pos = mh.getMouseMovedRelativePosition();
if (pos != null) {
a.setPosition(pos.getX(), pos.getY());
}
} else {
a = new PasteAction("Paste", NengoGraphics.getInstance(), true);
}
a.doAction();
}
};
} else {
pasteAction = new DisabledAction("Paste", "No object is in the clipboard");
}