Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-10-20 11:34:48 +0000
committerAndrey Loskutov2016-10-20 11:38:47 +0000
commit869e6e8f1c7d9b0be6ca0d8f3bd22573913848b0 (patch)
treeb8052b0c05fb123aeb876919a739959bde9a702f
parent9e81f5ff60dca59cfd31ba8a1cef5df509411024 (diff)
downloadeclipse.platform.text-869e6e8f1c7d9b0be6ca0d8f3bd22573913848b0.tar.gz
eclipse.platform.text-869e6e8f1c7d9b0be6ca0d8f3bd22573913848b0.tar.xz
eclipse.platform.text-869e6e8f1c7d9b0be6ca0d8f3bd22573913848b0.zip
Bug 505940 - NPE on overview ruler on editor for IFileRevision on plainY20161020-1800
text file Fixed regression in org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.findSelectedOverviewRulerAnnotationLabel(), introduced via commit b6ac8fd637f7fa7343820fdff40b9b2cfd6bc54b. Updated javadoc of ISourceViewer to make clear that null return is possible. Change-Id: I0fa6b83a79499b9b2b59edc2527166e8e1fa80b1 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java5
2 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java
index d22f2fec6..caa4ce9b6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java
@@ -155,7 +155,7 @@ public interface ISourceViewer extends ITextViewer {
* {@link ISourceViewerExtension2#getVisualAnnotationModel()}in order to
* get access to the viewer's visual annotation model.
*
- * @return this viewer's annotation model
+ * @return this viewer's annotation model, or <code>null</code> if none could be determined
*/
IAnnotationModel getAnnotationModel();
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
index 04dfd8f97..ca16934ef 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
@@ -1788,8 +1788,11 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
}
private String findSelectedOverviewRulerAnnotationLabel() {
- Point selection= getSourceViewer().getSelectedRange();
IAnnotationModel model= getSourceViewer().getAnnotationModel();
+ if (model == null) {
+ return null;
+ }
+ Point selection= getSourceViewer().getSelectedRange();
Annotation annotation= null;
Iterator<Annotation> iter= model.getAnnotationIterator();
while (iter.hasNext()) {

Back to the top