handle range indication when no structure objects are found for selection
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java
index e34ec7b..29bd223 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java
@@ -2660,9 +2660,14 @@
void updateRangeIndication(ISelection selection) {
if (selection instanceof IStructuredSelection && !((IStructuredSelection) selection).isEmpty()) {
Object[] objects = ((IStructuredSelection) selection).toArray();
- int start = ((IndexedRegion) objects[0]).getStartOffset();
- int end = ((IndexedRegion) objects[objects.length - 1]).getEndOffset();
- getSourceViewer().setRangeIndication(start, end - start, false);
+ if (objects.length > 0) {
+ int start = ((IndexedRegion) objects[0]).getStartOffset();
+ int end = ((IndexedRegion) objects[objects.length - 1]).getEndOffset();
+ getSourceViewer().setRangeIndication(start, end - start, false);
+ }
+ else {
+ getSourceViewer().removeRangeIndication();
+ }
}
else {
getSourceViewer().removeRangeIndication();