Author: estherbin
Date: 2008-08-01 06:44:13 -0400 (Fri, 01 Aug 2008)
New Revision: 9466
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
Log:
Fix NullPointerException.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-08-01
09:22:16 UTC (rev 9465)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-08-01
10:44:13 UTC (rev 9466)
@@ -93,8 +93,10 @@
if (file != null) {
final String findString = ElService.getInstance().reverseReplace(file,
node.getNodeValue());
-
- start =
pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(findString);
+
+ if ((findString != null) &&
(pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText() !=
null)) {
+ start =
pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(findString);
+ }
}
}
pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(start +
offset, length);
@@ -202,8 +204,8 @@
//gets visual selection range
Point sourceRange = new Point(0, 0);
//converts to source selection
- sourceRange.x = TextUtil.sourcePosition(sourceNode.getNodeValue(),
focusedNode.getNodeValue(), selection.getFocusOffset());
- sourceRange.y = TextUtil.sourcePosition(sourceNode.getNodeValue(),
focusedNode.getNodeValue(), selection.getAnchorOffset())-sourceRange.x;
+ sourceRange.x = TextUtil.sourcePosition(sourceNode.getNodeValue(),
focusedNode.getNodeValue(), selection.getFocusOffset());
+ sourceRange.y = TextUtil.sourcePosition(sourceNode.getNodeValue(),
focusedNode.getNodeValue(), selection.getAnchorOffset())-sourceRange.x;
return sourceRange;
}
Show replies by date