@Override protected IJavaElement getElementAt(int offset) { return getElementAt(offset, true); }
@Override protected IJavaElement getElementAt(int offset) { return getElementAt(offset, true); }
protected IJavaElement getElementAt(int offset) { return getElementAt(offset, true); }
/** * Returns the offset used to reveal the given element based on the given selection offset. * @param element the element * @param offset the selection offset * @return the offset to reveal the given element based on the given selection offset */ public int getRevealOffset(IJavaElement element, int offset) { if (element == null || offset == -1) return -1; if (containsOffset(element, offset)) { if (offset > 0) { IJavaElement alternateElement= getElementAt(offset, false); if (element.getHandleIdentifier().equals(alternateElement.getParent().getHandleIdentifier())) return offset - 1; // Solves test case 2 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 } return offset; } else if (offset > 0 && containsOffset(element, offset - 1)) return offset - 1; // Solves test case 1 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 return -1; }
/** * Returns the offset used to reveal the given element based on the given selection offset. * @param element the element * @param offset the selection offset * @return the offset to reveal the given element based on the given selection offset */ public int getRevealOffset(IJavaElement element, int offset) { if (element == null || offset == -1) return -1; if (containsOffset(element, offset)) { if (offset > 0) { IJavaElement alternateElement= getElementAt(offset, false); if (element.getHandleIdentifier().equals(alternateElement.getParent().getHandleIdentifier())) return offset - 1; // Solves test case 2 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 } return offset; } else if (offset > 0 && containsOffset(element, offset - 1)) return offset - 1; // Solves test case 1 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 return -1; }
/** * Returns the offset used to reveal the given element based on the given selection offset. * @param element the element * @param offset the selection offset * @return the offset to reveal the given element based on the given selection offset */ public int getRevealOffset(IJavaElement element, int offset) { if (element == null || offset == -1) return -1; if (containsOffset(element, offset)) { if (offset > 0) { IJavaElement alternateElement= getElementAt(offset, false); if (element.getHandleIdentifier().equals(alternateElement.getParent().getHandleIdentifier())) return offset - 1; // Solves test case 2 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 } return offset; } else if (offset > 0 && containsOffset(element, offset - 1)) return offset - 1; // Solves test case 1 from https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3 return -1; }
/** * Store visual properties of the given offset. * * @param offset Offset in the document */ public void setOffset(int offset) { try { IDocument document= getSourceViewer().getDocument(); fLine= document.getLineOfOffset(offset); fColumn= offset - document.getLineOffset(fLine); fElement= getElementAt(offset, true); fElementLine= getElementLine(document, fElement); } catch (BadLocationException e) { // should not happen JavaPlugin.log(e); clear(); } catch (JavaModelException e) { // should not happen JavaPlugin.log(e.getStatus()); clear(); } }
/** * Store visual properties of the given offset. * * @param offset Offset in the document */ public void setOffset(int offset) { try { IDocument document= getSourceViewer().getDocument(); fLine= document.getLineOfOffset(offset); fColumn= offset - document.getLineOffset(fLine); fElement= getElementAt(offset, true); fElementLine= getElementLine(document, fElement); } catch (BadLocationException e) { // should not happen JavaPlugin.log(e); clear(); } catch (JavaModelException e) { // should not happen JavaPlugin.log(e.getStatus()); clear(); } }
/** * Store visual properties of the given offset. * * @param offset Offset in the document */ public void setOffset(int offset) { try { IDocument document= getSourceViewer().getDocument(); fLine= document.getLineOfOffset(offset); fColumn= offset - document.getLineOffset(fLine); fElement= getElementAt(offset, true); fElementLine= getElementLine(document, fElement); } catch (BadLocationException e) { // should not happen JavaPlugin.log(e); clear(); } catch (JavaModelException e) { // should not happen JavaPlugin.log(e.getStatus()); clear(); } }