Java 类org.antlr.v4.runtime.tree.gui.TreeViewer 实例源码

项目:contracts    文件:AstInspector.java   
private void updateParseTree(final TreeViewer treeViewer) {
    this.parseTreeViewer = treeViewer;
    if ( treeViewer == null ) {
        parseTreeContainer.setViewportView(null);
    }
    else {
        parseTreeContainer.setViewportView(treeViewer);
        treeViewer.setScale(parseTreeScale.getValue() / 1000.0 + 1.0);
        new DragScroller().install(treeViewer);
        treeViewer.addMouseWheelListener(new MouseAdapter() {
            @Override
            public void mouseWheelMoved(MouseWheelEvent e) {
                parseTreeScale.setValue(parseTreeScale.getValue() - e.getWheelRotation() * 100);
            }
        });
    }
}
项目:Mujeed-Arabic-Prolog    文件:Parser.java   
private static void showTree(ArabicPrologParser parser, ParseTree tree) {
    // TODO Auto-generated method stub
    JFrame frame = new JFrame("Antlr AST");
       JPanel panel = new JPanel();
       TreeViewer viewr = new TreeViewer(Arrays.asList(
               parser.getRuleNames()),tree);
       viewr.setScale(1.5);//scale a little
       panel.add(viewr);
       frame.add(panel);
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.setSize(200,200);
       frame.setVisible(true);

}
项目:Scratch-ApuC    文件:RuleContext.java   
public Future<JDialog> inspect(@Nullable List<String> ruleNames) {
    TreeViewer viewer = new TreeViewer(ruleNames, this);
    return viewer.open();
}