From 91cdaecd4c2a0818e8aac85457b52d43943bf233 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Wed, 10 Feb 2010 02:50:43 +0000 Subject: [PATCH] bug 302272: When clicked on a bookmark in bookmark window focus in edit window goes to the file which was bookmarked but to a different line --- .../org/eclipse/cdt/internal/ui/editor/CEditor.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index f637a0d191d..d3d620ae1e4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -228,7 +228,9 @@ import org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWithASTManager; */ public class CEditor extends TextEditor implements ISelectionChangedListener, ICReconcilingListener { + /** Marker used for synchronization from Problems View to the editor on double-click. */ private IMarker fSyncProblemsViewMarker = null; + /** * A slightly modified implementation of IGotomarker compared to AbstractDecoratedTextEditor. * @@ -245,8 +247,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC if (getSourceViewer() == null) return; - fSyncProblemsViewMarker = marker; - int start= MarkerUtilities.getCharStart(marker); int end= MarkerUtilities.getCharEnd(marker); @@ -297,7 +297,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC int length= document.getLength(); if (end - 1 < length && start < length) { - fIsUpdatingMarkerViews= true; + fSyncProblemsViewMarker = marker; selectAndReveal(start, end - start); } } @@ -2511,14 +2511,16 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC protected void updateStatusLine() { ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection(); Annotation annotation = getAnnotation(selection.getOffset(), selection.getLength(), fSyncProblemsViewMarker); - fSyncProblemsViewMarker = null; setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { - updateMarkerViews(annotation); + if (fSyncProblemsViewMarker==null) { + updateMarkerViews(annotation); + } if (annotation instanceof ICAnnotation && ((ICAnnotation) annotation).isProblem()) setStatusLineMessage(annotation.getText()); } + fSyncProblemsViewMarker = null; } /**