Example usage for javax.swing JMenu setMnemonic

List of usage examples for javax.swing JMenu setMnemonic

Introduction

In this page you can find the example usage for javax.swing JMenu setMnemonic.

Prototype

@BeanProperty(visualUpdate = true, description = "the keyboard character mnemonic")
public void setMnemonic(int mnemonic) 

Source Link

Document

Sets the keyboard mnemonic on the current model.

Usage

From source file:com.marginallyclever.makelangelo.MainGUI.java

public void updateMenuBar() {
    JMenu menu, subMenu;
    ButtonGroup group;/*from   w w w .j av  a  2 s. c o m*/
    int i;

    if (settingsPane != null) {
        buttonAdjustMachineSize.setEnabled(!isrunning);
        buttonAdjustPulleySize.setEnabled(!isrunning);
        buttonJogMotors
                .setEnabled(connectionToRobot != null && connectionToRobot.isRobotConfirmed() && !isrunning);
        buttonChangeTool.setEnabled(!isrunning);
        buttonAdjustTool.setEnabled(!isrunning);
    }
    if (preparePane != null) {
        buttonHilbertCurve.setEnabled(!isrunning);
        buttonText2GCODE.setEnabled(!isrunning);
    }
    if (driveControls != null) {
        boolean x = connectionToRobot != null && connectionToRobot.isRobotConfirmed();
        driveControls.updateButtonAccess(x, isrunning);
    }

    menuBar.removeAll();

    // File menu
    menu = new JMenu(translator.get("MenuMakelangelo"));
    menu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(menu);

    subMenu = new JMenu(translator.get("MenuPreferences"));

    buttonAdjustSounds = new JMenuItem(translator.get("MenuSoundsTitle"));
    buttonAdjustSounds.addActionListener(this);
    subMenu.add(buttonAdjustSounds);

    buttonAdjustGraphics = new JMenuItem(translator.get("MenuGraphicsTitle"));
    buttonAdjustGraphics.addActionListener(this);
    subMenu.add(buttonAdjustGraphics);

    buttonAdjustLanguage = new JMenuItem(translator.get("MenuLanguageTitle"));
    buttonAdjustLanguage.addActionListener(this);
    subMenu.add(buttonAdjustLanguage);
    menu.add(subMenu);

    buttonCheckForUpdate = new JMenuItem(translator.get("MenuUpdate"), KeyEvent.VK_U);
    buttonCheckForUpdate.addActionListener(this);
    buttonCheckForUpdate.setEnabled(true);
    menu.add(buttonCheckForUpdate);

    buttonAbout = new JMenuItem(translator.get("MenuAbout"), KeyEvent.VK_A);
    buttonAbout.addActionListener(this);
    menu.add(buttonAbout);

    menu.addSeparator();

    buttonExit = new JMenuItem(translator.get("MenuQuit"), KeyEvent.VK_Q);
    buttonExit.addActionListener(this);
    menu.add(buttonExit);

    // Connect menu
    subMenu = new JMenu(translator.get("MenuConnect"));
    subMenu.setEnabled(!isrunning);
    group = new ButtonGroup();

    String[] connections = connectionManager.listConnections();
    buttonPorts = new JRadioButtonMenuItem[connections.length];
    for (i = 0; i < connections.length; ++i) {
        buttonPorts[i] = new JRadioButtonMenuItem(connections[i]);
        if (connectionToRobot != null && connectionToRobot.getRecentConnection().equals(connections[i])
                && connectionToRobot.isConnectionOpen()) {
            buttonPorts[i].setSelected(true);
        }
        buttonPorts[i].addActionListener(this);
        group.add(buttonPorts[i]);
        subMenu.add(buttonPorts[i]);
    }

    subMenu.addSeparator();

    buttonRescan = new JMenuItem(translator.get("MenuRescan"), KeyEvent.VK_N);
    buttonRescan.addActionListener(this);
    subMenu.add(buttonRescan);

    buttonDisconnect = new JMenuItem(translator.get("MenuDisconnect"), KeyEvent.VK_D);
    buttonDisconnect.addActionListener(this);
    buttonDisconnect.setEnabled(connectionToRobot != null && connectionToRobot.isConnectionOpen());
    subMenu.add(buttonDisconnect);

    menuBar.add(subMenu);

    // view menu
    menu = new JMenu(translator.get("MenuPreview"));
    buttonZoomOut = new JMenuItem(translator.get("ZoomOut"));
    buttonZoomOut.addActionListener(this);
    buttonZoomOut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, ActionEvent.ALT_MASK));
    menu.add(buttonZoomOut);

    buttonZoomIn = new JMenuItem(translator.get("ZoomIn"), KeyEvent.VK_EQUALS);
    buttonZoomIn.addActionListener(this);
    buttonZoomIn.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, ActionEvent.ALT_MASK));
    menu.add(buttonZoomIn);

    buttonZoomToFit = new JMenuItem(translator.get("ZoomFit"));
    buttonZoomToFit.addActionListener(this);
    menu.add(buttonZoomToFit);

    menuBar.add(menu);

    // finish
    menuBar.updateUI();
}

From source file:com.nikonhacker.gui.EmulatorUI.java

@SuppressWarnings("MagicConstant")
protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenuItem tmpMenuItem;/*from w w w .  j  a  v  a2  s .  c o  m*/

    //Set up the file menu.
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    //load image
    for (int chip = 0; chip < 2; chip++) {
        loadMenuItem[chip] = new JMenuItem("Load " + Constants.CHIP_LABEL[chip] + " firmware image");
        if (chip == Constants.CHIP_FR)
            loadMenuItem[chip].setMnemonic(KEY_EVENT_LOAD);
        loadMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_LOAD, KEY_CHIP_MODIFIER[chip]));
        loadMenuItem[chip].setActionCommand(COMMAND_IMAGE_LOAD[chip]);
        loadMenuItem[chip].addActionListener(this);
        fileMenu.add(loadMenuItem[chip]);
    }

    fileMenu.add(new JSeparator());

    //decoder
    tmpMenuItem = new JMenuItem("Decode firmware");
    tmpMenuItem.setMnemonic(KeyEvent.VK_D);
    tmpMenuItem.setActionCommand(COMMAND_DECODE);
    tmpMenuItem.addActionListener(this);
    fileMenu.add(tmpMenuItem);

    //encoder
    tmpMenuItem = new JMenuItem("Encode firmware (alpha)");
    tmpMenuItem.setMnemonic(KeyEvent.VK_E);
    tmpMenuItem.setActionCommand(COMMAND_ENCODE);
    tmpMenuItem.addActionListener(this);
    //        fileMenu.add(tmpMenuItem);

    fileMenu.add(new JSeparator());

    //decoder
    tmpMenuItem = new JMenuItem("Decode lens correction data");
    //tmpMenuItem.setMnemonic(KeyEvent.VK_D);
    tmpMenuItem.setActionCommand(COMMAND_DECODE_NKLD);
    tmpMenuItem.addActionListener(this);
    fileMenu.add(tmpMenuItem);

    fileMenu.add(new JSeparator());

    //Save state
    tmpMenuItem = new JMenuItem("Save state");
    tmpMenuItem.setActionCommand(COMMAND_SAVE_STATE);
    tmpMenuItem.addActionListener(this);
    fileMenu.add(tmpMenuItem);

    //Load state
    tmpMenuItem = new JMenuItem("Load state");
    tmpMenuItem.setActionCommand(COMMAND_LOAD_STATE);
    tmpMenuItem.addActionListener(this);
    fileMenu.add(tmpMenuItem);

    fileMenu.add(new JSeparator());

    //quit
    tmpMenuItem = new JMenuItem("Quit");
    tmpMenuItem.setMnemonic(KEY_EVENT_QUIT);
    tmpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_QUIT, ActionEvent.ALT_MASK));
    tmpMenuItem.setActionCommand(COMMAND_QUIT);
    tmpMenuItem.addActionListener(this);
    fileMenu.add(tmpMenuItem);

    //Set up the run menu.
    JMenu runMenu = new JMenu("Run");
    runMenu.setMnemonic(KeyEvent.VK_R);
    menuBar.add(runMenu);

    for (int chip = 0; chip < 2; chip++) {
        //emulator play
        playMenuItem[chip] = new JMenuItem("Start (or resume) " + Constants.CHIP_LABEL[chip] + " emulator");
        playMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_RUN[chip], ActionEvent.ALT_MASK));
        playMenuItem[chip].setActionCommand(COMMAND_EMULATOR_PLAY[chip]);
        playMenuItem[chip].addActionListener(this);
        runMenu.add(playMenuItem[chip]);

        //emulator debug
        debugMenuItem[chip] = new JMenuItem("Debug " + Constants.CHIP_LABEL[chip] + " emulator");
        debugMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_DEBUG[chip], ActionEvent.ALT_MASK));
        debugMenuItem[chip].setActionCommand(COMMAND_EMULATOR_DEBUG[chip]);
        debugMenuItem[chip].addActionListener(this);
        runMenu.add(debugMenuItem[chip]);

        //emulator pause
        pauseMenuItem[chip] = new JMenuItem("Pause " + Constants.CHIP_LABEL[chip] + " emulator");
        pauseMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_PAUSE[chip], ActionEvent.ALT_MASK));
        pauseMenuItem[chip].setActionCommand(COMMAND_EMULATOR_PAUSE[chip]);
        pauseMenuItem[chip].addActionListener(this);
        runMenu.add(pauseMenuItem[chip]);

        //emulator step
        stepMenuItem[chip] = new JMenuItem("Step " + Constants.CHIP_LABEL[chip] + " emulator");
        stepMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_STEP[chip], ActionEvent.ALT_MASK));
        stepMenuItem[chip].setActionCommand(COMMAND_EMULATOR_STEP[chip]);
        stepMenuItem[chip].addActionListener(this);
        runMenu.add(stepMenuItem[chip]);

        //emulator stop
        stopMenuItem[chip] = new JMenuItem("Stop and reset " + Constants.CHIP_LABEL[chip] + " emulator");
        stopMenuItem[chip].setActionCommand(COMMAND_EMULATOR_STOP[chip]);
        stopMenuItem[chip].addActionListener(this);
        runMenu.add(stopMenuItem[chip]);

        runMenu.add(new JSeparator());

        //setup breakpoints
        breakpointMenuItem[chip] = new JMenuItem("Setup " + Constants.CHIP_LABEL[chip] + " breakpoints");
        breakpointMenuItem[chip].setActionCommand(COMMAND_SETUP_BREAKPOINTS[chip]);
        breakpointMenuItem[chip].addActionListener(this);
        runMenu.add(breakpointMenuItem[chip]);

        if (chip == Constants.CHIP_FR) {
            runMenu.add(new JSeparator());
        }
    }

    //Set up the components menu.
    JMenu componentsMenu = new JMenu("Components");
    componentsMenu.setMnemonic(KeyEvent.VK_O);
    menuBar.add(componentsMenu);

    for (int chip = 0; chip < 2; chip++) {
        //CPU state
        cpuStateMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " CPU State window");
        if (chip == Constants.CHIP_FR)
            cpuStateMenuItem[chip].setMnemonic(KEY_EVENT_CPUSTATE);
        cpuStateMenuItem[chip]
                .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_CPUSTATE, KEY_CHIP_MODIFIER[chip]));
        cpuStateMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CPUSTATE_WINDOW[chip]);
        cpuStateMenuItem[chip].addActionListener(this);
        componentsMenu.add(cpuStateMenuItem[chip]);

        //memory hex editor
        memoryHexEditorMenuItem[chip] = new JCheckBoxMenuItem(
                Constants.CHIP_LABEL[chip] + " Memory hex editor");
        if (chip == Constants.CHIP_FR)
            memoryHexEditorMenuItem[chip].setMnemonic(KEY_EVENT_MEMORY);
        memoryHexEditorMenuItem[chip]
                .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_MEMORY, KEY_CHIP_MODIFIER[chip]));
        memoryHexEditorMenuItem[chip].setActionCommand(COMMAND_TOGGLE_MEMORY_HEX_EDITOR[chip]);
        memoryHexEditorMenuItem[chip].addActionListener(this);
        componentsMenu.add(memoryHexEditorMenuItem[chip]);

        //Interrupt controller
        interruptControllerMenuItem[chip] = new JCheckBoxMenuItem(
                Constants.CHIP_LABEL[chip] + " interrupt controller");
        interruptControllerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_INTERRUPT_CONTROLLER_WINDOW[chip]);
        interruptControllerMenuItem[chip].addActionListener(this);
        componentsMenu.add(interruptControllerMenuItem[chip]);

        //Programmble timers
        programmableTimersMenuItem[chip] = new JCheckBoxMenuItem(
                Constants.CHIP_LABEL[chip] + " programmable timers");
        programmableTimersMenuItem[chip].setActionCommand(COMMAND_TOGGLE_PROGRAMMABLE_TIMERS_WINDOW[chip]);
        programmableTimersMenuItem[chip].addActionListener(this);
        componentsMenu.add(programmableTimersMenuItem[chip]);

        //Serial interface
        serialInterfacesMenuItem[chip] = new JCheckBoxMenuItem(
                Constants.CHIP_LABEL[chip] + " serial interfaces");
        serialInterfacesMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SERIAL_INTERFACES[chip]);
        serialInterfacesMenuItem[chip].addActionListener(this);
        componentsMenu.add(serialInterfacesMenuItem[chip]);

        // I/O
        ioPortsMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " I/O ports");
        ioPortsMenuItem[chip].setActionCommand(COMMAND_TOGGLE_IO_PORTS_WINDOW[chip]);
        ioPortsMenuItem[chip].addActionListener(this);
        componentsMenu.add(ioPortsMenuItem[chip]);

        //Serial devices
        serialDevicesMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " serial devices");
        serialDevicesMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SERIAL_DEVICES[chip]);
        serialDevicesMenuItem[chip].addActionListener(this);
        componentsMenu.add(serialDevicesMenuItem[chip]);

        componentsMenu.add(new JSeparator());
    }

    //screen emulator: FR80 only
    screenEmulatorMenuItem = new JCheckBoxMenuItem("Screen emulator (FR only)");
    screenEmulatorMenuItem.setMnemonic(KEY_EVENT_SCREEN);
    screenEmulatorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_SCREEN, ActionEvent.ALT_MASK));
    screenEmulatorMenuItem.setActionCommand(COMMAND_TOGGLE_SCREEN_EMULATOR);
    screenEmulatorMenuItem.addActionListener(this);
    componentsMenu.add(screenEmulatorMenuItem);

    //Component 4006: FR80 only
    component4006MenuItem = new JCheckBoxMenuItem("Component 4006 window (FR only)");
    component4006MenuItem.setMnemonic(KeyEvent.VK_4);
    component4006MenuItem.setActionCommand(COMMAND_TOGGLE_COMPONENT_4006_WINDOW);
    component4006MenuItem.addActionListener(this);
    componentsMenu.add(component4006MenuItem);

    componentsMenu.add(new JSeparator());

    //A/D converter: TX19 only for now
    adConverterMenuItem[Constants.CHIP_TX] = new JCheckBoxMenuItem(
            Constants.CHIP_LABEL[Constants.CHIP_TX] + " A/D converter (TX only)");
    adConverterMenuItem[Constants.CHIP_TX].setActionCommand(COMMAND_TOGGLE_AD_CONVERTER[Constants.CHIP_TX]);
    adConverterMenuItem[Constants.CHIP_TX].addActionListener(this);
    componentsMenu.add(adConverterMenuItem[Constants.CHIP_TX]);

    //Front panel: TX19 only
    frontPanelMenuItem = new JCheckBoxMenuItem("Front panel (TX only)");
    frontPanelMenuItem.setActionCommand(COMMAND_TOGGLE_FRONT_PANEL);
    frontPanelMenuItem.addActionListener(this);
    componentsMenu.add(frontPanelMenuItem);

    //Set up the trace menu.
    JMenu traceMenu = new JMenu("Trace");
    traceMenu.setMnemonic(KeyEvent.VK_C);
    menuBar.add(traceMenu);

    for (int chip = 0; chip < 2; chip++) {
        //memory activity viewer
        memoryActivityViewerMenuItem[chip] = new JCheckBoxMenuItem(
                Constants.CHIP_LABEL[chip] + " Memory activity viewer");
        memoryActivityViewerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_MEMORY_ACTIVITY_VIEWER[chip]);
        memoryActivityViewerMenuItem[chip].addActionListener(this);
        traceMenu.add(memoryActivityViewerMenuItem[chip]);

        //disassembly
        disassemblyMenuItem[chip] = new JCheckBoxMenuItem(
                "Real-time " + Constants.CHIP_LABEL[chip] + " disassembly log");
        if (chip == Constants.CHIP_FR)
            disassemblyMenuItem[chip].setMnemonic(KEY_EVENT_REALTIME_DISASSEMBLY);
        disassemblyMenuItem[chip].setAccelerator(
                KeyStroke.getKeyStroke(KEY_EVENT_REALTIME_DISASSEMBLY, KEY_CHIP_MODIFIER[chip]));
        disassemblyMenuItem[chip].setActionCommand(COMMAND_TOGGLE_DISASSEMBLY_WINDOW[chip]);
        disassemblyMenuItem[chip].addActionListener(this);
        traceMenu.add(disassemblyMenuItem[chip]);

        //Custom logger
        customMemoryRangeLoggerMenuItem[chip] = new JCheckBoxMenuItem(
                "Custom " + Constants.CHIP_LABEL[chip] + " logger window");
        customMemoryRangeLoggerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CUSTOM_LOGGER_WINDOW[chip]);
        customMemoryRangeLoggerMenuItem[chip].addActionListener(this);
        traceMenu.add(customMemoryRangeLoggerMenuItem[chip]);

        //Call Stack logger
        callStackMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " Call stack logger");
        callStackMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CALL_STACK_WINDOW[chip]);
        callStackMenuItem[chip].addActionListener(this);
        traceMenu.add(callStackMenuItem[chip]);

        //ITRON Object
        iTronObjectMenuItem[chip] = new JCheckBoxMenuItem("ITRON " + Constants.CHIP_LABEL[chip] + " Objects");
        iTronObjectMenuItem[chip].setActionCommand(COMMAND_TOGGLE_ITRON_OBJECT_WINDOW[chip]);
        iTronObjectMenuItem[chip].addActionListener(this);
        traceMenu.add(iTronObjectMenuItem[chip]);

        //ITRON Return Stack
        iTronReturnStackMenuItem[chip] = new JCheckBoxMenuItem(
                "ITRON " + Constants.CHIP_LABEL[chip] + " Return stack");
        iTronReturnStackMenuItem[chip].setActionCommand(COMMAND_TOGGLE_ITRON_RETURN_STACK_WINDOW[chip]);
        iTronReturnStackMenuItem[chip].addActionListener(this);
        traceMenu.add(iTronReturnStackMenuItem[chip]);

        traceMenu.add(new JSeparator());
    }

    //Set up the source menu.
    JMenu sourceMenu = new JMenu("Source");
    sourceMenu.setMnemonic(KEY_EVENT_SCREEN);
    menuBar.add(sourceMenu);

    // FR syscall symbols
    generateSysSymbolsMenuItem = new JMenuItem(
            "Generate " + Constants.CHIP_LABEL[Constants.CHIP_FR] + " system call symbols");
    generateSysSymbolsMenuItem.setActionCommand(COMMAND_GENERATE_SYS_SYMBOLS);
    generateSysSymbolsMenuItem.addActionListener(this);
    sourceMenu.add(generateSysSymbolsMenuItem);

    for (int chip = 0; chip < 2; chip++) {

        sourceMenu.add(new JSeparator());

        //analyse / disassemble
        analyseMenuItem[chip] = new JMenuItem("Analyse / Disassemble " + Constants.CHIP_LABEL[chip] + " code");
        analyseMenuItem[chip].setActionCommand(COMMAND_ANALYSE_DISASSEMBLE[chip]);
        analyseMenuItem[chip].addActionListener(this);
        sourceMenu.add(analyseMenuItem[chip]);

        sourceMenu.add(new JSeparator());

        //code structure
        codeStructureMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " code structure");
        codeStructureMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CODE_STRUCTURE_WINDOW[chip]);
        codeStructureMenuItem[chip].addActionListener(this);
        sourceMenu.add(codeStructureMenuItem[chip]);

        //source code
        sourceCodeMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " source code");
        if (chip == Constants.CHIP_FR)
            sourceCodeMenuItem[chip].setMnemonic(KEY_EVENT_SOURCE);
        sourceCodeMenuItem[chip]
                .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_SOURCE, KEY_CHIP_MODIFIER[chip]));
        sourceCodeMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SOURCE_CODE_WINDOW[chip]);
        sourceCodeMenuItem[chip].addActionListener(this);
        sourceMenu.add(sourceCodeMenuItem[chip]);

        if (chip == Constants.CHIP_FR) {
            sourceMenu.add(new JSeparator());
        }
    }

    //Set up the tools menu.
    JMenu toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    menuBar.add(toolsMenu);

    for (int chip = 0; chip < 2; chip++) {
        // save/load memory area
        saveLoadMemoryMenuItem[chip] = new JMenuItem(
                "Save/Load " + Constants.CHIP_LABEL[chip] + " memory area");
        saveLoadMemoryMenuItem[chip].setActionCommand(COMMAND_SAVE_LOAD_MEMORY[chip]);
        saveLoadMemoryMenuItem[chip].addActionListener(this);
        toolsMenu.add(saveLoadMemoryMenuItem[chip]);

        //chip options
        chipOptionsMenuItem[chip] = new JMenuItem(Constants.CHIP_LABEL[chip] + " options");
        chipOptionsMenuItem[chip].setActionCommand(COMMAND_CHIP_OPTIONS[chip]);
        chipOptionsMenuItem[chip].addActionListener(this);
        toolsMenu.add(chipOptionsMenuItem[chip]);

        toolsMenu.add(new JSeparator());

    }

    //disassembly options
    uiOptionsMenuItem = new JMenuItem("Preferences");
    uiOptionsMenuItem.setActionCommand(COMMAND_UI_OPTIONS);
    uiOptionsMenuItem.addActionListener(this);
    toolsMenu.add(uiOptionsMenuItem);

    //Set up the help menu.
    JMenu helpMenu = new JMenu("?");
    menuBar.add(helpMenu);

    //about
    JMenuItem aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.setActionCommand(COMMAND_ABOUT);
    aboutMenuItem.addActionListener(this);
    helpMenu.add(aboutMenuItem);

    //        JMenuItem testMenuItem = new JMenuItem("Test");
    //        testMenuItem.setActionCommand(COMMAND_TEST);
    //        testMenuItem.addActionListener(this);
    //        helpMenu.add(testMenuItem);

    // Global "Keep in sync" setting
    menuBar.add(Box.createHorizontalGlue());
    final JCheckBox syncEmulators = new JCheckBox("Keep emulators in sync");
    syncEmulators.setSelected(prefs.isSyncPlay());
    framework.getMasterClock().setSyncPlay(prefs.isSyncPlay());
    syncEmulators.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            prefs.setSyncPlay(syncEmulators.isSelected());
            framework.getMasterClock().setSyncPlay(syncEmulators.isSelected());
        }
    });
    menuBar.add(syncEmulators);
    return menuBar;
}

From source file:de.huxhorn.lilith.swing.ViewActions.java

public ViewActions(MainFrame mainFrame) {
    this.mainFrame = mainFrame;

    containerChangeListener = new ChangeListener() {
        /**/* w  ww. j av  a2 s .com*/
         * Invoked when the target of the listener has changed its state.
         *
         * @param e a ChangeEvent object
         */
        public void stateChanged(ChangeEvent e) {
            updateActions();
        }
    };

    containerPropertyChangeListener = new PropertyChangeListener() {

        /**
         * This method gets called when a bound property is changed.
         *
         * @param evt A PropertyChangeEvent object describing the event source
         *            and the property that has changed.
         */

        public void propertyChange(PropertyChangeEvent evt) {
            if (ViewContainer.SELECTED_EVENT_PROPERTY_NAME.equals(evt.getPropertyName())) {
                setEventWrapper((EventWrapper) evt.getNewValue());
            }

        }
    };

    keyStrokeActionMapping = new HashMap<KeyStroke, CopyToClipboardAction>();
    // ##### Menu Actions #####
    // File
    OpenMenuAction openMenuAction = new OpenMenuAction();
    clearRecentFilesAction = new ClearRecentFilesAction();
    OpenInactiveLogMenuAction openInactiveLogMenuAction = new OpenInactiveLogMenuAction();
    ImportMenuAction importMenuAction = new ImportMenuAction();
    exportMenuAction = new ExportMenuAction();
    CleanAllInactiveLogsMenuAction cleanAllInactiveLogsMenuAction = new CleanAllInactiveLogsMenuAction();
    preferencesMenuAction = new PreferencesMenuAction();
    ExitMenuAction exitMenuAction = new ExitMenuAction();

    // Edit
    showUnfilteredEventAction = new ShowUnfilteredEventAction();
    gotoSourceAction = new GotoSourceAction();
    copySelectionAction = new CopySelectionAction();
    copyEventAction = new CopyToClipboardAction(new EventFormatter());
    copyLoggingActions = new ArrayList<CopyToClipboardAction>();
    copyLoggingActions.add(new CopyToClipboardAction(new EventJsonFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new EventXmlFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingMessageFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingMessagePatternFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingLoggerNameFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingThrowableFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingCallStackFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingCallLocationFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingMarkerFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingMdcFormatter()));
    copyLoggingActions.add(new CopyToClipboardAction(new LoggingNdcFormatter()));
    copyAccessActions = new ArrayList<CopyToClipboardAction>();
    copyAccessActions.add(new CopyToClipboardAction(new AccessUriFormatter()));

    prepareClipboardActions(copyLoggingActions, keyStrokeActionMapping);
    prepareClipboardActions(copyAccessActions, keyStrokeActionMapping);

    // Search
    findMenuAction = new FindMenuAction();
    findPreviousAction = new FindPreviousAction();
    findNextAction = new FindNextAction();
    findPreviousActiveAction = new FindPreviousActiveAction();
    findNextActiveAction = new FindNextActiveAction();
    resetFindAction = new ResetFindAction();

    // View
    scrollToBottomMenuAction = new ScrollToBottomMenuAction();
    pauseMenuAction = new PauseMenuAction();
    clearMenuAction = new ClearMenuAction();
    attachMenuAction = new AttachMenuAction();
    disconnectMenuAction = new DisconnectMenuAction();

    focusMessageAction = new FocusMessageAction();
    focusEventsAction = new FocusEventsAction();

    //statisticsMenuAction = new StatisticsMenuAction();
    editSourceNameMenuAction = new EditSourceNameMenuAction();
    saveLayoutAction = new SaveLayoutAction();
    resetLayoutAction = new ResetLayoutAction();
    saveConditionMenuAction = new SaveConditionMenuAction();

    zoomInMenuAction = new ZoomInMenuAction();
    zoomOutMenuAction = new ZoomOutMenuAction();
    resetZoomMenuAction = new ResetZoomMenuAction();

    previousTabAction = new PreviousTabAction();
    nextTabAction = new NextTabAction();
    closeFilterAction = new CloseFilterAction();
    closeOtherFiltersAction = new CloseOtherFiltersAction();
    closeAllFiltersAction = new CloseAllFiltersAction();

    // Window
    ShowTaskManagerAction showTaskManagerAction = new ShowTaskManagerAction();
    closeAllAction = new CloseAllAction();
    closeOtherAction = new CloseOtherAction();
    minimizeAllAction = new MinimizeAllAction();
    minimizeAllOtherAction = new MinimizeAllOtherAction();
    removeInactiveAction = new RemoveInactiveAction();
    //clearAndRemoveInactiveAction=new ClearAndRemoveInactiveAction();

    // Help
    KeyboardHelpAction keyboardHelpAction = new KeyboardHelpAction();
    ShowLoveMenuAction showLoveMenuAction = new ShowLoveMenuAction();
    TipOfTheDayAction tipOfTheDayAction = new TipOfTheDayAction();
    DebugAction debugAction = new DebugAction();
    aboutAction = new AboutAction();
    CheckForUpdateAction checkForUpdateAction = new CheckForUpdateAction();
    TroubleshootingAction troubleshootingAction = new TroubleshootingAction();

    // ##### ToolBar Actions #####
    scrollToBottomToolBarAction = new ScrollToBottomToolBarAction();
    pauseToolBarAction = new PauseToolBarAction();
    clearToolBarAction = new ClearToolBarAction();
    findToolBarAction = new FindToolBarAction();
    //statisticsToolBarAction = new StatisticsToolBarAction();
    attachToolBarAction = new AttachToolBarAction();
    disconnectToolBarAction = new DisconnectToolBarAction();

    showTaskManagerItem = new JMenuItem(showTaskManagerAction);
    closeAllItem = new JMenuItem(closeAllAction);
    closeAllOtherItem = new JMenuItem(closeOtherAction);
    minimizeAllItem = new JMenuItem(minimizeAllAction);
    minimizeAllOtherItem = new JMenuItem(minimizeAllOtherAction);
    removeInactiveItem = new JMenuItem(removeInactiveAction);
    //clearAndRemoveInactiveItem = new JMenuItem(clearAndRemoveInactiveAction);

    toolbar = new JToolBar(SwingConstants.HORIZONTAL);
    toolbar.setFloatable(false);

    scrollToBottomButton = new JToggleButton(scrollToBottomToolBarAction);
    toolbar.add(scrollToBottomButton);

    JButton pauseButton = new JButton(pauseToolBarAction);
    toolbar.add(pauseButton);

    JButton clearButton = new JButton(clearToolBarAction);
    toolbar.add(clearButton);

    JButton findButton = new JButton(findToolBarAction);
    toolbar.add(findButton);

    JButton disconnectButton = new JButton(disconnectToolBarAction);
    toolbar.add(disconnectButton);

    toolbar.addSeparator();

    //JButton statisticsButton = new JButton(statisticsToolBarAction);
    //toolbar.add(statisticsButton);
    //toolbar.addSeparator();

    JButton attachButton = new JButton(attachToolBarAction);
    toolbar.add(attachButton);

    toolbar.addSeparator();

    PreferencesToolBarAction preferencesToolBarAction = new PreferencesToolBarAction();
    JButton preferencesButton = new JButton(preferencesToolBarAction);
    toolbar.add(preferencesButton);

    toolbar.addSeparator();

    ShowLoveToolbarAction showLoveToolbarAction = new ShowLoveToolbarAction();
    JButton showLoveButton = new JButton(showLoveToolbarAction);
    toolbar.add(showLoveButton);

    recentFilesMenu = new JMenu("Recent Files");

    Application app = mainFrame.getApplication();

    menubar = new JMenuBar();

    // File
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('f');
    fileMenu.add(openMenuAction);
    fileMenu.add(recentFilesMenu);
    fileMenu.add(openInactiveLogMenuAction);
    fileMenu.add(cleanAllInactiveLogsMenuAction);
    fileMenu.add(importMenuAction);
    fileMenu.add(exportMenuAction);
    if (!app.isMac()) {
        fileMenu.addSeparator();
        fileMenu.add(preferencesMenuAction);
        fileMenu.addSeparator();
        fileMenu.add(exitMenuAction);
    }

    // Edit
    editMenu = new JMenu("Edit");
    editMenu.setMnemonic('e');
    editMenu.add(copySelectionAction);
    editMenu.addSeparator();
    editMenu.add(copyEventAction);
    editMenu.addSeparator();
    for (CopyToClipboardAction current : copyLoggingActions) {
        editMenu.add(current);
    }
    editMenu.addSeparator();
    for (CopyToClipboardAction current : copyAccessActions) {
        editMenu.add(current);
    }
    editMenu.addSeparator();
    customCopyMenu = new JMenu("Custom copy");
    customCopyPopupMenu = new JMenu("Custom copy");
    editMenu.add(customCopyMenu);
    editMenu.addSeparator();
    PasteStackTraceElementAction pasteStackTraceElementAction = new PasteStackTraceElementAction();
    editMenu.add(pasteStackTraceElementAction);

    // Search
    searchMenu = new JMenu("Search");
    searchMenu.setMnemonic('s');
    searchMenu.add(findMenuAction);
    searchMenu.add(resetFindAction);
    searchMenu.add(findPreviousAction);
    searchMenu.add(findNextAction);
    searchMenu.add(findPreviousActiveAction);
    searchMenu.add(findNextActiveAction);
    searchMenu.addSeparator();
    searchMenu.add(saveConditionMenuAction);
    searchMenu.addSeparator();

    focusMenu = new FocusMenu(mainFrame.getApplicationPreferences());
    excludeMenu = new ExcludeMenu(mainFrame.getApplicationPreferences());
    searchMenu.add(focusMenu);
    searchMenu.add(excludeMenu);

    // View
    viewMenu = new JMenu("View");
    viewMenu.setMnemonic('v');
    viewMenu.add(scrollToBottomMenuAction);
    viewMenu.add(pauseMenuAction);
    viewMenu.add(clearMenuAction);
    viewMenu.add(attachMenuAction);
    viewMenu.add(disconnectMenuAction);
    viewMenu.add(focusEventsAction);
    viewMenu.add(focusMessageAction);
    //viewMenu.add(statisticsMenuAction);
    viewMenu.add(editSourceNameMenuAction);
    viewMenu.addSeparator();
    viewMenu.add(zoomInMenuAction);
    viewMenu.add(zoomOutMenuAction);
    viewMenu.add(resetZoomMenuAction);
    viewMenu.addSeparator();
    JMenu layoutMenu = new JMenu("Layout");
    columnsMenu = new JMenu("Columns");
    layoutMenu.add(columnsMenu);
    layoutMenu.addSeparator();
    layoutMenu.add(saveLayoutAction);
    layoutMenu.add(resetLayoutAction);
    viewMenu.add(layoutMenu);
    viewMenu.addSeparator();
    viewMenu.add(previousTabAction);
    viewMenu.add(nextTabAction);
    viewMenu.addSeparator();
    viewMenu.add(closeFilterAction);
    viewMenu.add(closeOtherFiltersAction);
    viewMenu.add(closeAllFiltersAction);

    // Window
    windowMenu = new JMenu("Window");
    windowMenu.setMnemonic('w');

    // Help
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic('h');

    helpMenu.add(keyboardHelpAction);
    helpMenu.add(showLoveMenuAction);
    helpMenu.add(tipOfTheDayAction);
    helpMenu.add(checkForUpdateAction);
    helpMenu.add(troubleshootingAction);
    helpMenu.addSeparator();
    helpMenu.add(debugAction);
    if (!app.isMac()) {
        helpMenu.addSeparator();
        helpMenu.add(aboutAction);
    }

    menubar.add(fileMenu);
    menubar.add(editMenu);
    menubar.add(searchMenu);
    menubar.add(viewMenu);
    menubar.add(windowMenu);
    menubar.add(helpMenu);

    updateWindowMenu();
    updateRecentFiles();
    updateActions();
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the help menu//from w w  w.  ja  va  2  s .co m
 * 
 * @return The help menu
 */
private JMenu setupHelpMenu() {
    final JMenu menu = new JMenu("Help");

    menu.setMnemonic(KeyEvent.VK_H);
    menu.setToolTipText("Menu items related to user assistance");

    helpOverviewVideo = new JMenuItem("8 Minute Overview Video");
    helpOverviewVideo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.ALT_MASK));
    helpOverviewVideo.setMnemonic(KeyEvent.VK_V);
    helpOverviewVideo.setToolTipText("View an 8 minute overview of Semantic Workbench");
    helpOverviewVideo.addActionListener(new OverviewVideoListener());
    menu.add(helpOverviewVideo);

    helpAbout = new JMenuItem("About");
    helpAbout.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK));
    helpAbout.setMnemonic(KeyEvent.VK_A);
    helpAbout.setToolTipText("View version information");
    helpAbout.addActionListener(new AboutListener());
    menu.add(helpAbout);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the model menu/*from   w w w  . j a  v a2  s. c o m*/
 * 
 * @return The model menu
 */
private JMenu setupModelMenu() {
    final JMenu menu = new JMenu("Model");

    menu.setMnemonic(KeyEvent.VK_M);
    menu.setToolTipText("Menu items related to viewing the model");

    modelCreateTreeView = new JMenuItem("Create Tree");
    modelCreateTreeView.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK));
    modelCreateTreeView.setMnemonic(KeyEvent.VK_T);
    modelCreateTreeView.setToolTipText("Create tree representation of current model");
    modelCreateTreeView.addActionListener(new GenerateTreeListener());
    menu.add(modelCreateTreeView);

    modelListInferredTriples = new JMenuItem("Identify Inferred Triples");
    modelListInferredTriples.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.ALT_MASK));
    modelListInferredTriples.setMnemonic(KeyEvent.VK_I);
    modelListInferredTriples.setToolTipText("Create a list of inferred triples from the current model");
    modelListInferredTriples.addActionListener(new GenerateInferredTriplesListener());
    menu.add(modelListInferredTriples);

    menu.addSeparator();

    filterResetTree = new JMenuItem("Clear Tree");
    filterResetTree
            .setToolTipText("Remove the tree view of the ontology. This may help if memory is running low");
    filterResetTree.addActionListener(new ClearTreeModelListener());
    menu.add(filterResetTree);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the SPARQL server menu//from   ww w  . j a v  a2s .  com
 * 
 * @return The SPARQL server menu
 */
private JMenu setupSparqlServerMenu() {
    final JMenu menu = new JMenu("SPARQL Server");

    menu.setMnemonic(KeyEvent.VK_P);
    menu.setToolTipText("Options for using the SPARQL server");

    sparqlServerStartup = new JMenuItem("Startup SPARQL Server");
    sparqlServerStartup.setMnemonic(KeyEvent.VK_S);
    sparqlServerStartup.setToolTipText("Start the SPARQL server");
    sparqlServerStartup.addActionListener(new SparqlServerStartupListener());
    menu.add(sparqlServerStartup);

    sparqlServerShutdown = new JMenuItem("Shutdown SPARQL Server");
    sparqlServerShutdown.setMnemonic(KeyEvent.VK_H);
    sparqlServerShutdown.setToolTipText("Stop the SPARQL server");
    sparqlServerShutdown.addActionListener(new SparqlServerShutdownListener());
    menu.add(sparqlServerShutdown);

    menu.addSeparator();

    sparqlServerPublishCurrentModel = new JMenuItem("Publish Current Reasoned Model");
    sparqlServerPublishCurrentModel.setMnemonic(KeyEvent.VK_P);
    sparqlServerPublishCurrentModel
            .setToolTipText("Set the model for the SPARQL server to the current one reasoned");
    sparqlServerPublishCurrentModel.addActionListener(new SparqlServerPublishModelListener());
    menu.add(sparqlServerPublishCurrentModel);

    menu.addSeparator();

    sparqlServerConfig = new JMenuItem("Configure the SPARQL Server");
    sparqlServerConfig.setMnemonic(KeyEvent.VK_C);
    sparqlServerConfig.setToolTipText("Configure the server endpoint");
    sparqlServerConfig.addActionListener(new SparqlServerConfigurationListener());
    menu.add(sparqlServerConfig);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the filters menu// w  w w  . j  ava2s  .  c o  m
 * 
 * @return The filters menu
 */
private JMenu setupFiltersMenu() {
    final JMenu menu = new JMenu("Tree Filter");

    menu.setMnemonic(KeyEvent.VK_F);
    menu.setToolTipText("Menu items related to filtering values out of the model's tree");

    filterEnableFilters = new JCheckBoxMenuItem("Enable Filters");
    filterEnableFilters.setSelected(true);
    filterEnableFilters
            .setToolTipText("Enforce the filtered list of classes and properties when creating the tree view");
    menu.add(filterEnableFilters);

    filterShowAnonymousNodes = new JCheckBoxMenuItem("Show Anonymous Nodes");
    filterShowAnonymousNodes.setSelected(false);
    filterShowAnonymousNodes.setToolTipText("Include anonymous nodes in the tree view");
    menu.add(filterShowAnonymousNodes);

    showFqnInTree = new JCheckBoxMenuItem("Show FQN In Tree");
    showFqnInTree.setSelected(false);
    showFqnInTree
            .setToolTipText("Show the fully qualified name for classes, properties and objects in the tree");
    menu.add(showFqnInTree);

    menu.addSeparator();

    filterEditFilteredClasses = new JMenuItem("Edit List of Filtered Classes");
    filterEditFilteredClasses
            .setToolTipText("Present the list of filtered classes and allow them to be edited");
    filterEditFilteredClasses.addActionListener(new EditFilteredClassesListener());
    menu.add(filterEditFilteredClasses);

    filterEditFilteredProperties = new JMenuItem("Edit List of Filtered Properties");
    filterEditFilteredProperties
            .setToolTipText("Present the list of filtered properties and allow them to be edited");
    filterEditFilteredProperties.addActionListener(new EditFilteredPropertiesListener());
    menu.add(filterEditFilteredProperties);

    menu.addSeparator();

    filterSetMaximumIndividualsPerClassInTree = new JMenuItem("Set Maximum Individuals Per Class in Tree");
    filterSetMaximumIndividualsPerClassInTree
            .setToolTipText("Limit number of individuals shown for each class in the tree view.");
    filterSetMaximumIndividualsPerClassInTree
            .addActionListener(new SetMaximumIndividualsPerClassInTreeListener());
    menu.add(filterSetMaximumIndividualsPerClassInTree);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the edit menu/*from   w  w w  .ja v a 2s  .com*/
 * 
 * @return The edit menu
 */
private JMenu setupEditMenu() {
    final JMenu menu = new JMenu("Edit");

    menu.setMnemonic(KeyEvent.VK_E);
    menu.setToolTipText("Menu items related to editing the ontology");

    editFind = new JMenuItem("Find (in assertions)");
    editFind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK));
    editFind.setMnemonic(KeyEvent.VK_F);
    editFind.setToolTipText("Find text in the assertions editor");
    editFind.addActionListener(new FindAssertionsTextListener());
    menu.add(editFind);

    editFindNextMatch = new JMenuItem("Next (matching assertion text)");
    editFindNextMatch.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK));
    editFindNextMatch.setMnemonic(KeyEvent.VK_N);
    editFindNextMatch.setToolTipText("Find next text match in the assertions editor");
    editFindNextMatch.addActionListener(new FindNextAssertionsTextListener());
    menu.add(editFindNextMatch);

    menu.addSeparator();

    editCommentToggle = new JMenuItem("Toggle Comment");
    editCommentToggle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK));
    editCommentToggle.setMnemonic(KeyEvent.VK_T);
    editCommentToggle
            .setToolTipText("Switch the chosen assertion or query lines between commented and not commented");
    editCommentToggle.addActionListener(new CommentToggleListener());
    editCommentToggle.setEnabled(false);
    menu.add(editCommentToggle);

    editInsertPrefixes = new JMenuItem("Insert Prefixes");
    editInsertPrefixes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));
    editInsertPrefixes.setMnemonic(KeyEvent.VK_I);
    editInsertPrefixes.setToolTipText("Insert standard prefixes (namespaces)");
    editInsertPrefixes.addActionListener(new InsertPrefixesListener());
    menu.add(editInsertPrefixes);

    menu.addSeparator();

    editExpandAllTreeNodes = new JMenuItem("Expand Entire Tree");
    editExpandAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, ActionEvent.ALT_MASK));
    editExpandAllTreeNodes.setMnemonic(KeyEvent.VK_E);
    editExpandAllTreeNodes.setToolTipText("Expand all tree nodes");
    editExpandAllTreeNodes.addActionListener(new ExpandTreeListener());
    menu.add(editExpandAllTreeNodes);

    editCollapseAllTreeNodes = new JMenuItem("Collapse Entire Tree");
    editCollapseAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, ActionEvent.ALT_MASK));
    editCollapseAllTreeNodes.setMnemonic(KeyEvent.VK_C);
    editCollapseAllTreeNodes.setToolTipText("Expand all tree nodes");
    editCollapseAllTreeNodes.addActionListener(new CollapseTreeListener());
    menu.add(editCollapseAllTreeNodes);

    menu.addSeparator();

    editEditListOfSparqlServiceUrls = new JMenuItem("Edit SPARQL Service URLs List");
    editEditListOfSparqlServiceUrls.setMnemonic(KeyEvent.VK_S);
    editEditListOfSparqlServiceUrls.setToolTipText("Remove unwanted URLs from the dropdown list");
    editEditListOfSparqlServiceUrls.addActionListener(new EditListOfSparqlServiceUrls());
    menu.add(editEditListOfSparqlServiceUrls);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the configuration menu/*from w  ww. ja  v  a 2s.  co m*/
 * 
 * @return The configuration menu
 */
private JMenu setupConfigurationMenu() {
    final JMenu menu = new JMenu("Configure");
    ButtonGroup buttonGroup;

    menu.setMnemonic(KeyEvent.VK_C);
    menu.setToolTipText("Menu items related to configuration");

    buttonGroup = new ButtonGroup();
    setupOutputAssertionLanguage = new JCheckBoxMenuItem[FORMATS.length + 1];
    setupOutputAssertionLanguage[0] = new JCheckBoxMenuItem("Output Format: Auto");
    buttonGroup.add(setupOutputAssertionLanguage[0]);
    menu.add(setupOutputAssertionLanguage[0]);

    for (int index = 0; index < FORMATS.length; ++index) {
        setupOutputAssertionLanguage[index + 1] = new JCheckBoxMenuItem("Output Format: " + FORMATS[index]);
        buttonGroup.add(setupOutputAssertionLanguage[index + 1]);
        menu.add(setupOutputAssertionLanguage[index + 1]);
    }
    setupOutputAssertionLanguage[0].setSelected(true);

    menu.addSeparator();

    buttonGroup = new ButtonGroup();
    setupOutputModelTypeAssertions = new JCheckBoxMenuItem("Output Assertions Only");
    buttonGroup.add(setupOutputModelTypeAssertions);
    menu.add(setupOutputModelTypeAssertions);

    setupOutputModelTypeAssertionsAndInferences = new JCheckBoxMenuItem("Output Assertions and Inferences");
    buttonGroup.add(setupOutputModelTypeAssertionsAndInferences);
    menu.add(setupOutputModelTypeAssertionsAndInferences);

    setupOutputModelTypeAssertions.setSelected(true);

    menu.addSeparator();

    setupAllowMultilineResultOutput = new JCheckBoxMenuItem(
            "Allow Multiple Lines of Text Per Row in SPARQL Query Output");
    setupAllowMultilineResultOutput.setToolTipText("Wrap long values into multiple lines in a display cell");
    setupAllowMultilineResultOutput.setSelected(false);
    menu.add(setupAllowMultilineResultOutput);

    setupOutputFqnNamespaces = new JCheckBoxMenuItem("Show FQN Namespaces Instead of Prefixes in Query Output");
    setupOutputFqnNamespaces
            .setToolTipText("Use the fully qualified namespace. If unchecked use the prefix, if defined");
    setupOutputFqnNamespaces.setSelected(false);
    menu.add(setupOutputFqnNamespaces);

    setupOutputDatatypesForLiterals = new JCheckBoxMenuItem("Show Datatypes on Literals");
    setupOutputDatatypesForLiterals.setToolTipText("Display the datatype after the value, e.g. 4^^xsd:integer");
    setupOutputDatatypesForLiterals.setSelected(false);
    menu.add(setupOutputDatatypesForLiterals);

    setupOutputFlagLiteralValues = new JCheckBoxMenuItem("Flag Literal Values in Query Output");
    setupOutputFlagLiteralValues.setToolTipText("Includes the text 'Lit:' in front of any literal values");
    setupOutputFlagLiteralValues.setSelected(false);
    menu.add(setupOutputFlagLiteralValues);

    setupApplyFormattingToLiteralValues = new JCheckBoxMenuItem("Apply Formatting to Literal Values");
    setupApplyFormattingToLiteralValues.setToolTipText(
            "Apply the XSD-based formatting defined in the configuration to literal values in SPARQL results and tree view display");
    setupApplyFormattingToLiteralValues.setSelected(true);
    menu.add(setupApplyFormattingToLiteralValues);

    setupDisplayImagesInSparqlResults = new JCheckBoxMenuItem(
            "Display Images in Query Output (Slows Results Retrieval)");
    setupDisplayImagesInSparqlResults.setToolTipText("Attempts to download images linked in the results. "
            + "Can run very slowly depending on number and size of images");
    setupDisplayImagesInSparqlResults.setSelected(true);
    menu.add(setupDisplayImagesInSparqlResults);

    menu.addSeparator();

    buttonGroup = new ButtonGroup();
    setupExportSparqlResultsAsCsv = new JCheckBoxMenuItem(
            "Export SPARQL Results to " + EXPORT_FORMAT_LABEL_CSV);
    setupExportSparqlResultsAsCsv.setToolTipText("Export to Comma Separated Value format");
    buttonGroup.add(setupExportSparqlResultsAsCsv);
    menu.add(setupExportSparqlResultsAsCsv);

    setupExportSparqlResultsAsTsv = new JCheckBoxMenuItem(
            "Export SPARQL Results to " + EXPORT_FORMAT_LABEL_TSV);
    setupExportSparqlResultsAsTsv.setToolTipText("Export to Tab Separated Value format");
    buttonGroup.add(setupExportSparqlResultsAsTsv);
    menu.add(setupExportSparqlResultsAsTsv);

    menu.addSeparator();

    setupSparqlResultsToFile = new JCheckBoxMenuItem("Send SPARQL Results Directly to File");
    setupSparqlResultsToFile.setToolTipText(
            "For large results sets this permits writing to file without trying to render on screen");
    menu.add(setupSparqlResultsToFile);

    menu.addSeparator();

    setupEnableStrictMode = new JCheckBoxMenuItem("Enable Strict Checking Mode");
    setupEnableStrictMode.setSelected(true);
    setupEnableStrictMode.addActionListener(new ReasonerConfigurationChange());
    menu.add(setupEnableStrictMode);

    menu.addSeparator();

    setupFont = new JMenuItem("Font");
    setupFont.setMnemonic(KeyEvent.VK_F);
    setupFont.setToolTipText("Set the font used for the display");
    setupFont.addActionListener(new FontSetupListener());
    menu.add(setupFont);

    menu.addSeparator();

    setupProxyEnabled = new JCheckBoxMenuItem("Enable Proxy");
    setupProxyEnabled.setToolTipText("Pass network SPARQL requests through a proxy");
    setupProxyEnabled.addActionListener(new ProxyStatusChangeListener());
    menu.add(setupProxyEnabled);

    setupProxyConfiguration = new JMenuItem("Proxy Settings");
    setupProxyConfiguration.setToolTipText("Configure the proxy");
    setupProxyConfiguration.addActionListener(new ProxySetupListener());
    menu.add(setupProxyConfiguration);

    return menu;
}