Author: estherbin
Date: 2008-08-04 11:53:18 -0400 (Mon, 04 Aug 2008)
New Revision: 9498
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
Log:
Fix JBIDE-2582 issue.
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-04
15:29:34 UTC (rev 9497)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-08-04
15:53:18 UTC (rev 9498)
@@ -87,18 +87,6 @@
int start = NodesManagingUtil.getStartOffsetNode(node);
- //added by estherbin fix bug JBIDE-2010 with selection.
- if (start == 0 || start == 1) {
- final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
-
- if (file != null) {
- final String findString = ElService.getInstance().reverseReplace(file,
node.getNodeValue());
-
- if ((findString != null) &&
(pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText() !=
null)) {
- start =
pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(findString);
- }
- }
- }
pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(start +
offset, length);
pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(
start + offset, length);
@@ -204,8 +192,11 @@
//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;
+ if (sourceNode != null) {
+ 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