Examples of DisabledAction


Examples of ca.nengo.ui.lib.actions.DisabledAction

            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
                    // 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");
        }

        editMenu.addAction(copyAction, KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C,
                MENU_SHORTCUT_KEY_MASK));
        editMenu.addAction(cutAction, KeyEvent.VK_X, KeyStroke.getKeyStroke(KeyEvent.VK_X,
View Full Code Here

Examples of ca.nengo.ui.lib.actions.DisabledAction

            UINetwork network = (UINetwork) node;

            simulateAction = new RunSimulatorAction("Simulate " + network.getName(), network);
            interactivePlotsAction = new RunInteractivePlotsAction(network);
        } else {
            simulateAction = new DisabledAction("Simulate", "No object selected");
            interactivePlotsAction = new DisabledAction("Interactive Plots", "No object selected");
        }

        runMenu.addAction(simulateAction, KeyEvent.VK_F4, KeyStroke.getKeyStroke(KeyEvent.VK_F4,
                0));
        runMenu.addAction(interactivePlotsAction, KeyEvent.VK_F5, KeyStroke.getKeyStroke(KeyEvent.VK_F5,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.