protected void selectInEditor(Token token) { int line = token.getLine(); line--; // -1 because SableCC lines are 1-based WorkingCopy workingCopy = editor.getWorkingCopy(); IDocument document = workingCopy.getDocument(); try { int start = document.getLineOffset(line); editor.selectAndReveal(start, 0); } catch (BadLocationException e) { UIUtils.log(e); } }
public void refresh() { if (editor == null) return; WorkingCopy workingCopy = editor.getWorkingCopy(); if (workingCopy == null) return; ASTNode<Token, Node> root = workingCopy.getRootASTNode(); if (root == null) return; TextUMLTreeNode node = new TextUMLTreeNode(UIModelObject.createModelObject(null, root)); viewer.setInput(node.getChildren()); }