/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; } /**
/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; }
/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; } /**
/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; } /**
/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; }
/** * Finds the deepest <code>IJavaElement</code> in the hierarchy of * <code>elt</elt>'s children (including <code>elt</code> itself) * which has a source range that encloses <code>position</code> * according to <code>mapper</code>. */ protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper) { SourceRange range = mapper.getSourceRange(elt); if (range == null || position < range.getOffset() || range.getOffset() + range.getLength() - 1 < position) { return null; } if (elt instanceof IParent) { try { IJavaElement[] children = ((IParent) elt).getChildren(); for (int i = 0; i < children.length; i++) { IJavaElement match = findElement(children[i], position, mapper); if (match != null) { return match; } } } catch (JavaModelException npe) { // elt doesn't exist: return the element } } return elt; } /**
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end
int newStart = range.getOffset(); int newEnd = newStart + range.getLength() - 1; if(newStart > start && newEnd < end