@Override public int getEndColumn() { if (this.endColumn > 0) { return this.endColumn; } Node parent = jjtGetParent(); if (parent != null) { return parent.getEndColumn(); } throw new RuntimeException("Unable to determine ending column of Node."); }
private boolean isCommentNotWithin(FormalComment n1, Node n2, Node node) { if (n1 == null || n2 == null || node == null) { return true; } boolean isNotWithinNode2 = !(n1.getEndLine() < n2.getEndLine() || n1.getEndLine() == n2.getEndLine() && n1.getEndColumn() < n2.getEndColumn()); boolean isNotSameClass = node.getFirstParentOfType(ASTClassOrInterfaceBody.class) != n2 .getFirstParentOfType(ASTClassOrInterfaceBody.class); boolean isNodeWithinNode2 = node.getEndLine() < n2.getEndLine() || node.getEndLine() == n2.getEndLine() && node.getEndColumn() < n2.getEndColumn(); return isNotWithinNode2 || isNotSameClass || isNodeWithinNode2; }
private static boolean isAfter(Node n1, Node n2) { return n1.getBeginLine() > n2.getBeginLine() || n1.getBeginLine() == n2.getBeginLine() && n1.getBeginColumn() >= n2.getEndColumn(); }
public ParametricRuleViolation(Rule theRule, RuleContext ctx, T node, String message) { rule = theRule; description = message; filename = ctx.getSourceCodeFilename(); if (filename == null) { filename = ""; } if (node != null) { beginLine = node.getBeginLine(); beginColumn = node.getBeginColumn(); endLine = node.getEndLine(); endColumn = node.getEndColumn(); } // Apply Rule specific suppressions if (node != null && rule != null) { setSuppression(rule, node); } }
/** * Snapshots the absolute coordinates of the node in the code area * for the duration of the layering algorithm. */ // TODO I don't think there's any good reason for this laziness, // if anything, it may cause trouble if the layering algorithm uses // a snapshot taken too late, with outdated line and column coordinates // I originally wrote it like that because I didn't think enough about it, // and I don't have time to simplify it before 6.5.0 public PositionSnapshot snapshot() { int lastKnownStart = getAbsolutePosition(node.getBeginLine(), node.getBeginColumn() - 1); int lastKnownEnd = getAbsolutePosition(node.getEndLine(), node.getEndColumn()); return new PositionSnapshot(lastKnownStart, lastKnownEnd); }
public void select(Node node) { String[] lines = getLines(); if (node.getBeginLine() >= 0) { setSelectionStart(getPosition(lines, node.getBeginLine(), node.getBeginColumn())); setSelectionEnd(getPosition(lines, node.getEndLine(), node.getEndColumn()) + 1); } requestFocus(); } }
@Override public void run() { try { sourceCodeArea.getHighlighter().removeAllHighlights(); if (node == null) { return; } int startOffset = sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1) + node.getBeginColumn() - 1; int end = sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) + node.getEndColumn(); sourceCodeArea.getHighlighter().addHighlight(startOffset, end, new DefaultHighlighter.DefaultHighlightPainter(HIGHLIGHT_COLOR)); sourceCodeArea.moveCaretPosition(startOffset); } catch (BadLocationException exc) { throw new IllegalStateException(exc.getMessage()); } } });
if (argument.jjtGetChild(0).getEndColumn() > longestParameterEndColumn) { longestParameterEndColumn = argument.jjtGetChild(0).getEndColumn();
@Override public int getEndColumn() { if (this.endColumn > 0) { return this.endColumn; } Node parent = jjtGetParent(); if (parent != null) { return parent.getEndColumn(); } throw new RuntimeException("Unable to determine ending column of Node."); }
private boolean isCommentNotWithin(FormalComment n1, Node n2, Node node) { if (n1 == null || n2 == null || node == null) { return true; } boolean isNotWithinNode2 = !(n1.getEndLine() < n2.getEndLine() || n1.getEndLine() == n2.getEndLine() && n1.getEndColumn() < n2.getEndColumn()); boolean isNotSameClass = node.getFirstParentOfType(ASTClassOrInterfaceBody.class) != n2 .getFirstParentOfType(ASTClassOrInterfaceBody.class); boolean isNodeWithinNode2 = node.getEndLine() < n2.getEndLine() || node.getEndLine() == n2.getEndLine() && node.getEndColumn() < n2.getEndColumn(); return isNotWithinNode2 || isNotSameClass || isNodeWithinNode2; }
private static boolean isAfter(Node n1, Node n2) { return n1.getBeginLine() > n2.getBeginLine() || n1.getBeginLine() == n2.getBeginLine() && n1.getBeginColumn() >= n2.getEndColumn(); }
public ParametricRuleViolation(Rule theRule, RuleContext ctx, T node, String message) { rule = theRule; description = message; filename = ctx.getSourceCodeFilename(); if (filename == null) { filename = ""; } if (node != null) { beginLine = node.getBeginLine(); beginColumn = node.getBeginColumn(); endLine = node.getEndLine(); endColumn = node.getEndColumn(); } // Apply Rule specific suppressions if (node != null && rule != null) { setSuppression(rule, node); } }
public void select(Node node) { String[] lines = getLines(); if (node.getBeginLine() >= 0) { setSelectionStart(getPosition(lines, node.getBeginLine(), node.getBeginColumn())); setSelectionEnd(getPosition(lines, node.getEndLine(), node.getEndColumn()) + 1); } requestFocus(); } }
@Override public void run() { try { sourceCodeArea.getHighlighter().removeAllHighlights(); if (node == null) { return; } int startOffset = sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1) + node.getBeginColumn() - 1; int end = sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) + node.getEndColumn(); sourceCodeArea.getHighlighter().addHighlight(startOffset, end, new DefaultHighlighter.DefaultHighlightPainter(HIGHLIGHT_COLOR)); sourceCodeArea.moveCaretPosition(startOffset); } catch (BadLocationException exc) { throw new IllegalStateException(exc.getMessage()); } } });