Author: dazarov
Date: 2012-06-27 14:28:45 -0400 (Wed, 27 Jun 2012)
New Revision: 42254
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java
Log:
fixed NPE:
java.lang.NullPointerException
at
org.jboss.tools.jst.jsp.selection.SourceSelectionBuilder.getSelection(SourceSelectionBuilder.java:35)
at org.jboss.tools.jst.jsp.selection.bar.SelectionBar.updateNodes(SelectionBar.java:266)
at
org.jboss.tools.jst.jsp.selection.bar.NodeListener$SelectionBarUpdateJob.runInUIThread(SelectionBar.java:865)
at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3529)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3182)
at org.jboss.tools.test.util.JobUtils.delay(JobUtils.java:57)
at org.jboss.tools.test.util.JobUtils.waitForIdle(JobUtils.java:36)
at org.jboss.tools.test.util.JobUtils.waitForIdle(JobUtils.java:30)
at org.jboss.tools.test.util.JobUtils.waitForIdle(JobUtils.java:26)
at
org.jboss.tools.test.util.ProjectImportTestSetup.tearDown(ProjectImportTestSetup.java:85)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java 2012-06-27
18:27:31 UTC (rev 42253)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java 2012-06-27
18:28:45 UTC (rev 42254)
@@ -32,6 +32,9 @@
}
public SourceSelection getSelection() {
+ if(sourceEditor == null || sourceEditor.getTextViewer() == null){
+ return null;
+ }
Point range = sourceEditor.getTextViewer().getSelectedRange();
int anchorPosition = range.x;
int focusPosition = range.x + range.y;