Package org.antlr.works.editor

Examples of org.antlr.works.editor.GrammarWindowTab


    }

    public void exportAsImage() {
        StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_EXPORT_AS_BITMAP);

        GrammarWindowTab tab = window.getSelectedTab();
        if(!tab.canExportToBitmap())
            return;

        if(tab instanceof SyntaxDiagramTab)
            exportRuleAsImage();
        else
            exportGViewAsImage(tab.getExportableGView());
    }
View Full Code Here


    }

    public void exportAsEPS() {
        StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_EXPORT_AS_EPS);

        GrammarWindowTab tab = window.getSelectedTab();
        if(!tab.canExportToEPS())
            return;

        if(tab instanceof SyntaxDiagramTab)
            exportRuleAsEPS();
        else
            exportGViewAsEPS(tab.getExportableGView());
    }
View Full Code Here

    }

    public void exportAsDOT() {
        StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_EXPORT_AS_DOT);

        GrammarWindowTab tab = window.getSelectedTab();
        if(!tab.canExportToDOT())
            return;

        if(!XJFileChooser.shared().displaySaveDialog(window.getJavaContainer(), "dot", "DOT file", false))
            return;

        String file = XJFileChooser.shared().getSelectedFilePath();
        if(file == null)
            return;

        try {
            XJUtils.writeStringToFile(tab.getDOTString(), file);
        } catch (Exception e) {
            window.consoleTab.println(e);
            XJAlert.display(window.getJavaContainer(), "Error", "Cannot export to DOT file: "+file+"\nError: "+e);
        }
    }
View Full Code Here

        return factory.menu;
    }

    public void menuItemState(final XJMenuItem item) {
        GrammarWindowTab tab = window.getSelectedTab();

        switch(item.getTag()) {
            case XJMainMenuBar.MI_UNDO:
            case XJMainMenuBar.MI_REDO:
                if(isDebuggerRunning()) {
                    // FIX AW-79
                    // Note: that's weird, but I have to invoke this later otherwise the menu is not disabled
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            item.setEnabled(false);
                        }
                    });
                }
                break;

            case XJMainMenuBar.MI_CUT:
            case XJMainMenuBar.MI_PASTE:
                item.setEnabled(window.isFileWritable());
                break;

            case MI_RENAME:
            case MI_REPLACE_LITERAL_WITH_TOKEN_LABEL:
            case MI_LITERAL_TO_SINGLEQUOTE:
            case MI_LITERAL_TO_DOUBLEQUOTE:
            case MI_LITERAL_TO_CSTYLEQUOTE:
            case MI_REMOVE_LEFT_RECURSION:
            case MI_REMOVE_ALL_LEFT_RECURSION:
            case MI_EXTRACT_RULE:
            case MI_INLINE_RULE:
            case MI_GROUP_RULE:
            case MI_UNGROUP_RULE:
            case MI_EXPAND_COLLAPSE_RULE:
            case MI_EXPAND_COLLAPSE_ACTION:
            case MI_CHECK_GRAMMAR:
            case MI_FIND:
            case MI_RUN_INTERPRETER:
                item.setEnabled(!isDebuggerRunning());
                break;

            case MI_DEBUG_AGAIN:
                item.setEnabled(!isDebuggerRunning() && debugMenu.canDebugAgain());
                break;

            case MI_EDIT_TEST_RIG:
                item.setTitle(getEditTestRigTitle());
                boolean enabled = (XJApplication.shared().getActiveWindow() != null) &&
                        (XJApplication.shared().getActiveWindow().getDocument() != null) &&
                        XJApplication.shared().getActiveWindow().getDocument().getDocumentName() != null;
                item.setEnabled(!isDebuggerRunning() && enabled);
                break;

            case MI_RUN:
            case MI_DEBUG:
            case MI_DEBUG_REMOTE:
                item.setEnabled(!isDebuggerRunning());
                break;

            case MI_GOTO_BACK:
                item.setEnabled(window.goToHistory.canGoBack());
                break;
            case MI_GOTO_FORWARD:
                item.setEnabled(window.goToHistory.canGoForward());
                break;

            case MI_EXPORT_AS_IMAGE:
                item.setEnabled(tab != null && tab.canExportToBitmap());
                break;

            case MI_EXPORT_AS_EPS:
                item.setEnabled(tab != null && tab.canExportToEPS());
                break;

            case MI_EXPORT_AS_DOT:
                item.setEnabled(tab != null && tab.canExportToDOT());
                break;

            case MI_DEBUG_SHOW_INPUT_TOKENS:
                item.setTitle(debugMenu.isInputTokenVisible()?
                        resourceBundle.getString("menu.item.hideInputTokens") : resourceBundle.getString("menu.item.showInputTokens"));
View Full Code Here

TOP

Related Classes of org.antlr.works.editor.GrammarWindowTab

Copyright © 2018 www.massapicom. 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.