MCPcopy Index your code
hub / github.com/antlr/codebuff / open

Method open

output/java/1.4.17/STViz.java:99–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 }
98
99 public void open() {
100 viewFrame = new STViewFrame();
101 updateStack(currentScope, viewFrame);
102 updateAttributes(currentScope, viewFrame);
103 List<InterpEvent> events = currentScope.events;
104 tmodel = new JTreeSTModel(interp, (EvalTemplateEvent)events.get(events.size()-1));
105 viewFrame.tree.setModel(tmodel);
106 viewFrame.tree.addTreeSelectionListener(new TreeSelectionListener() {
107 @Override
108 public void valueChanged(TreeSelectionEvent treeSelectionEvent) {
109 int depth = updateDepth.incrementAndGet();
110 try {
111 if ( depth!=1 ) {
112 return;
113 }
114 currentEvent = ((JTreeSTModel.Wrapper)viewFrame.tree.getLastSelectedPathComponent()).event;
115 currentScope = currentEvent.scope;
116 updateCurrentST(viewFrame);
117 }
118 finally {
119 updateDepth.decrementAndGet();
120 }
121 }
122 });
123 JTreeASTModel astModel = new JTreeASTModel(new CommonTreeAdaptor(), currentScope.st.impl.ast);
124 viewFrame.ast.setModel(astModel);
125 viewFrame.ast.addTreeSelectionListener(new TreeSelectionListener() {
126 @Override
127 public void valueChanged(TreeSelectionEvent treeSelectionEvent) {
128 int depth = updateDepth.incrementAndGet();
129 try {
130 if ( depth!=1 ) {
131 return;
132 }
133 TreePath path = treeSelectionEvent.getNewLeadSelectionPath();
134 if ( path==null ) return;
135 CommonTree node = (CommonTree)treeSelectionEvent.getNewLeadSelectionPath().getLastPathComponent();
136 //System.out.println("select AST: "+node);
137 CommonToken a = (CommonToken)currentScope.st.impl.tokens.get(node.getTokenStartIndex());
138 CommonToken b = (CommonToken)currentScope.st.impl.tokens.get(node.getTokenStopIndex());
139 highlight(viewFrame.template, a.getStartIndex(), b.getStopIndex());
140 }
141 finally {
142 updateDepth.decrementAndGet();
143 }
144 }
145 });
146
147 // Track selection of attr but do nothing for now
148// viewFrame.attributes.addListSelectionListener(
149// new ListSelectionListener() {
150// public void valueChanged(ListSelectionEvent e) {
151// int minIndex = viewFrame.attributes.getMinSelectionIndex();
152// int maxIndex = viewFrame.attributes.getMaxSelectionIndex();
153// for (int i = minIndex; i <= maxIndex; i++) {
154// if (viewFrame.attributes.isSelectedIndex(i)) {
155// //System.out.println("index="+i);
156// }

Callers 1

inspectMethod · 0.95

Calls 9

updateStackMethod · 0.95
updateAttributesMethod · 0.95
setTextMethod · 0.95
joinMethod · 0.95
setSizeMethod · 0.80
getMethod · 0.65
sizeMethod · 0.65
iteratorMethod · 0.65
disasmMethod · 0.45

Tested by

no test coverage detected