int startLine = ((ITextSelection) selection).getStartLine() + 1;
int endLine = ((ITextSelection) selection).getEndLine() + 1;
IStructuredSelection sel = (IStructuredSelection) selection;
for (Object obj : sel.toArray()) {
// Try to resolve to a better node instead of working with text
if (obj instanceof Text && ((IDOMNode) obj).getOwnerDocument() != null) {
IDOMNode sibling = (IDOMNode) ((Text) obj).getNextSibling();
if (sibling != null) {
int siblingStartLine = ((IDOMDocument) sibling.getOwnerDocument())