int position = -1;
int length = -1;
ISelection selection = getViewer().getSelection();
if (selection != null) {
if (getViewer().isInRangeMode()) {
DesignRange range = (DesignRange) selection;
if (range.isValid()) {
IDOMPosition domPos = DOMPositionHelper.toDOMPosition(range
.getStartPosition());
IDOMPosition domEnd = DOMPositionHelper.toDOMPosition(range
.getEndPosition());
if (EditValidateUtil.validPosition(domPos)
&& EditValidateUtil.validPosition(domEnd)) {
position = EditModelQuery
.getIndexedRegionLocation(domPos);