public JTabbedPane createParseTreeAndProfileTabbedPanel() { JBTabbedPane tabbedPane = new JBTabbedPane(); LOG.info("createParseTreePanel" + " " + project.getName()); Pair<UberTreeViewer, JPanel> pair = createParseTreePanel(); treeViewer = pair.a; tabbedPane.addTab("Parse tree", pair.b); profilerPanel = new ProfilerPanel(project); tabbedPane.addTab("Profiler", profilerPanel.$$$getRootComponent$$$()); return tabbedPane; }
/** Notify the preview tool window contents that the grammar file has changed */ public void grammarFileSaved(VirtualFile grammarFile) { String grammarFileName = grammarFile.getPath(); LOG.info("grammarFileSaved " + grammarFileName + " " + project.getName()); ANTLRv4PluginController controller = ANTLRv4PluginController.getInstance(project); PreviewState previewState = controller.getPreviewState(grammarFile); ensureStartRuleExists(grammarFile); inputPanel.grammarFileSaved(grammarFile); // if the saved grammar is not a pure lexer and there is a start rule, reparse // means that switching grammars must refresh preview if (previewState.g != null && previewState.startRuleName != null) { updateParseTreeFromDoc(previewState.grammarFile); } else { setParseTree(Collections.<String>emptyList(), null); // blank tree } profilerPanel.grammarFileSaved(previewState, grammarFile); }
/** Load grammars and set editor component. */ public void switchToGrammar(VirtualFile oldFile, VirtualFile grammarFile) { String grammarFileName = grammarFile.getPath(); LOG.info("switchToGrammar " + grammarFileName + " " + project.getName()); ANTLRv4PluginController controller = ANTLRv4PluginController.getInstance(project); PreviewState previewState = controller.getPreviewState(grammarFile); inputPanel.switchToGrammar(grammarFile); if (previewState.startRuleName != null) { updateParseTreeFromDoc(grammarFile); } else { setParseTree(Collections.<String>emptyList(), null); // blank tree } profilerPanel.switchToGrammar(previewState, grammarFile); if (previewState.g == null && previewState.lg != null) { setEnabled(false); } else { setEnabled(true); } }