Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelozerr2018-08-20 05:48:16 -0400
committerangelozerr2018-08-20 05:48:16 -0400
commite3dd06713021ad1e52ffa80d591ee7c584e12af2 (patch)
treec9e39b394914da35574985f4cf405bff27d03c98 /org.eclipse.ui.workbench.texteditor
parent6e6b1a7ddf05890a00d21f1248f08c32cb79a154 (diff)
downloadeclipse.platform.text-e3dd06713021ad1e52ffa80d591ee7c584e12af2.tar.gz
eclipse.platform.text-e3dd06713021ad1e52ffa80d591ee7c584e12af2.tar.xz
eclipse.platform.text-e3dd06713021ad1e52ffa80d591ee7c584e12af2.zip
Bug 538024 - Debug Source Display has encountered a problem - Index OutI20180820-2000
of Bounds Change-Id: I9ec937ae2f3807669c59b2deea50c35c6a1e4146 Signed-off-by: angelozerr <angelo.zerr@gmail.com>
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor')
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/views/minimap/MinimapWidget.java42
1 files changed, 39 insertions, 3 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/views/minimap/MinimapWidget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/views/minimap/MinimapWidget.java
index 0aaea1b31..c2d569433 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/views/minimap/MinimapWidget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/views/minimap/MinimapWidget.java
@@ -41,7 +41,12 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextInputListener;
import org.eclipse.jface.text.ITextPresentationListener;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension4;
@@ -52,6 +57,8 @@ import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.TextViewer;
+import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
+
/**
* Minimap widget which displays scaled content of the given text editor.
*
@@ -68,7 +75,8 @@ public class MinimapWidget {
* Editor tracker used to track text changed and styles changes of the
* editor content.
*/
- class EditorTracker implements TextChangeListener, ControlListener, ITextPresentationListener, IViewportListener {
+ class EditorTracker implements TextChangeListener, ControlListener, ITextPresentationListener, ITextInputListener,
+ IViewportListener {
private Map<Font, Font> fScaledFonts;
@@ -79,7 +87,14 @@ public class MinimapWidget {
@Override
public void textChanging(TextChangingEvent event) {
- fMinimapTracker.replaceTextRange(event);
+ try {
+ fMinimapTracker.replaceTextRange(event);
+ } catch (Exception e) {
+ IStatus status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK,
+ "Minimap text content synchronization failed", e); //$NON-NLS-1$
+ TextEditorPlugin.getDefault().getLog().log(status);
+ synchText();
+ }
}
@Override
@@ -89,7 +104,14 @@ public class MinimapWidget {
@Override
public void applyTextPresentation(TextPresentation presentation) {
- addPresentation(presentation);
+ try {
+ addPresentation(presentation);
+ } catch (Exception e) {
+ synchTextAndStyles();
+ IStatus status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK,
+ "Minimap styles synchronization failed", e); //$NON-NLS-1$
+ TextEditorPlugin.getDefault().getLog().log(status);
+ }
}
private StyleRange modelStyleRange2WidgetStyleRange(StyleRange range) {
@@ -204,6 +226,18 @@ public class MinimapWidget {
}
@Override
+ public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
+ if (oldInput != newInput) {
+ synchTextAndStyles();
+ }
+ }
+
+ @Override
+ public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
+ // Do nothing
+ }
+
+ @Override
public void viewportChanged(int verticalOffset) {
fMinimapTextWidget.getDisplay().asyncExec(() -> {
if (!fMinimapTextWidget.isDisposed()) {
@@ -243,6 +277,7 @@ public class MinimapWidget {
if (fEditorViewer instanceof ITextViewerExtension4) {
((ITextViewerExtension4) fEditorViewer).addTextPresentationListener(this);
}
+ fEditorViewer.addTextInputListener(this);
// track changed of vertical bar scroll to update highlight
// Viewport.
fEditorViewer.addViewportListener(this);
@@ -281,6 +316,7 @@ public class MinimapWidget {
if (fEditorViewer instanceof ITextViewerExtension4) {
((ITextViewerExtension4) fEditorViewer).removeTextPresentationListener(this);
}
+ fEditorViewer.removeTextInputListener(this);
// track changed of vertical bar scroll to update highlight
// Viewport.
fEditorViewer.removeViewportListener(this);

Back to the top