mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 183482: C Editor always re-opens file which was alreay open
This commit is contained in:
parent
f8a2192e8b
commit
b48dbe507a
2 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,11 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.cview;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
|
@ -134,7 +137,7 @@ public class OpenFileGroup extends CViewActionGroup {
|
|||
if (part != null) {
|
||||
IWorkbenchPage page = getCView().getSite().getPage();
|
||||
page.bringToTop(part);
|
||||
if (celement instanceof ISourceReference) {
|
||||
if (celement instanceof ISourceReference && !(celement instanceof ITranslationUnit)) {
|
||||
EditorUtility.revealInEditor(part, celement);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.internal.ui.navigator;
|
|||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -47,7 +49,7 @@ public class OpenCElementAction extends OpenFileAction {
|
|||
IEditorPart part;
|
||||
try {
|
||||
part= EditorUtility.openInEditor(fOpenElement);
|
||||
if (fOpenElement instanceof ISourceReference) {
|
||||
if (fOpenElement instanceof ISourceReference && !(fOpenElement instanceof ITranslationUnit)) {
|
||||
EditorUtility.revealInEditor(part, fOpenElement);
|
||||
}
|
||||
} catch (CoreException exc) {
|
||||
|
|
Loading…
Add table
Reference in a new issue