@Override
protected void updateEditMenu() {
super.updateEditMenu();
StandardAction copyAction = null;
StandardAction cutAction = null;
StandardAction pasteAction = null;
StandardAction removeAction = null;
Collection<WorldObject> selectedObjects = SelectionHandler.getActiveSelection();
if (selectedObjects != null && selectedObjects.size() > 0) {
ArrayList<UINeoNode> selectedArray = new ArrayList<UINeoNode>();
ArrayList<ModelObject> selectedModelObjects = new ArrayList<ModelObject>();
for (WorldObject obj : selectedObjects) {
if (obj instanceof UINeoNode) {
selectedArray.add((UINeoNode)obj);
}
if (obj instanceof ModelObject) {
selectedModelObjects.add((ModelObject)obj);
}
}
cutAction = new CutAction("Cut", selectedArray);
copyAction = new CopyAction("Copy", selectedArray);
removeAction = new RemoveModelAction("Remove", selectedModelObjects);
} else {
cutAction = new DisabledAction("Cut", "No object selected");
copyAction = new DisabledAction("Copy", "No object selected");
removeAction = new DisabledAction("Remove", "No objects to remove");
}
if (getClipboard().hasContents()) {
pasteAction = new StandardAction("Paste") {
private static final long serialVersionUID = 1L;
@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