mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,11 +7,14 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
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.actions.SelectionConverter;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
@ -134,7 +137,7 @@ public class OpenFileGroup extends CViewActionGroup {
|
||||||
if (part != null) {
|
if (part != null) {
|
||||||
IWorkbenchPage page = getCView().getSite().getPage();
|
IWorkbenchPage page = getCView().getSite().getPage();
|
||||||
page.bringToTop(part);
|
page.bringToTop(part);
|
||||||
if (celement instanceof ISourceReference) {
|
if (celement instanceof ISourceReference && !(celement instanceof ITranslationUnit)) {
|
||||||
EditorUtility.revealInEditor(part, celement);
|
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.IBinary;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
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.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -47,7 +49,7 @@ public class OpenCElementAction extends OpenFileAction {
|
||||||
IEditorPart part;
|
IEditorPart part;
|
||||||
try {
|
try {
|
||||||
part= EditorUtility.openInEditor(fOpenElement);
|
part= EditorUtility.openInEditor(fOpenElement);
|
||||||
if (fOpenElement instanceof ISourceReference) {
|
if (fOpenElement instanceof ISourceReference && !(fOpenElement instanceof ITranslationUnit)) {
|
||||||
EditorUtility.revealInEditor(part, fOpenElement);
|
EditorUtility.revealInEditor(part, fOpenElement);
|
||||||
}
|
}
|
||||||
} catch (CoreException exc) {
|
} catch (CoreException exc) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue