Author: sdzmitrovich
Date: 2008-06-28 09:45:25 -0400 (Sat, 28 Jun 2008)
New Revision: 8997
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
Log:
was corrected selection's mechanism
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-06-28
11:02:23 UTC (rev 8996)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-06-28
13:45:25 UTC (rev 8997)
@@ -227,6 +227,9 @@
Point range = SelectionUtil.getSourceSelection(getSourceEditor());
+ if (range == null)
+ return;
+
int focus = range.x;
int anchor = focus + range.y;
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-06-28
11:02:23 UTC (rev 8996)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-06-28
13:45:25 UTC (rev 8997)
@@ -8,6 +8,7 @@
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
@@ -209,7 +210,13 @@
}
static public Point getSourceSelection(StructuredTextEditor sourceEditor) {
- return sourceEditor.getTextViewer().getSelectedRange();
+
+ StructuredTextViewer textViewer = sourceEditor.getTextViewer();
+
+ if (textViewer != null)
+ return textViewer.getSelectedRange();
+
+ return null;
}
}
Show replies by date