From e44330ce843f7bcd249217ab0ac39c8cb61372c4 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 27 May 2004 14:39:27 +0000 Subject: [PATCH] Fix from Chris Wiebe --- .../ui/browser/opentype/OpenTypeAction.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/OpenTypeAction.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/OpenTypeAction.java index 2e41338018c..ae72e4d8d54 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/OpenTypeAction.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/OpenTypeAction.java @@ -19,7 +19,6 @@ import org.eclipse.cdt.core.browser.TypeSearchScope; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.resources.FileStorage; -import org.eclipse.cdt.internal.ui.editor.CEditor; import org.eclipse.cdt.internal.ui.util.EditorUtility; import org.eclipse.cdt.internal.ui.util.ExceptionHandler; import org.eclipse.cdt.ui.CUIPlugin; @@ -161,8 +160,13 @@ public class OpenTypeAction implements IWorkbenchWindowActionDelegate { editorPart = EditorUtility.openInEditor(storage); } } - if (editorPart == null) - return false; + + // highlight the type in the editor + if (editorPart != null && editorPart instanceof ITextEditor) { + ITextEditor editor = (ITextEditor) editorPart; + editor.selectAndReveal(location.getOffset(), location.getLength()); + return true; + } } catch (CModelException ex) { ex.printStackTrace(); return false; @@ -171,16 +175,6 @@ public class OpenTypeAction implements IWorkbenchWindowActionDelegate { return false; } - // highlight the type in the editor - if (cElement != null && editorPart instanceof CEditor) { - CEditor editor = (CEditor) editorPart; - editor.setSelection(cElement); - return true; - } else if (editorPart instanceof ITextEditor) { - ITextEditor editor = (ITextEditor) editorPart; - editor.selectAndReveal(location.getOffset(), location.getLength()); - return true; - } return false; }