mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Check for a valid ITranslationUnit before making
the link to the Editor.
This commit is contained in:
parent
7dd6d81653
commit
c84084e3fa
1 changed files with 13 additions and 6 deletions
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.model.ICModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IParent;
|
import org.eclipse.cdt.core.model.IParent;
|
||||||
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.core.resources.MakeUtil;
|
import org.eclipse.cdt.core.resources.MakeUtil;
|
||||||
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
|
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
|
||||||
import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
|
import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
|
||||||
|
@ -1127,12 +1128,18 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
|
||||||
Object obj= selection.getFirstElement();
|
Object obj= selection.getFirstElement();
|
||||||
|
|
||||||
if (selection.size() == 1) {
|
if (selection.size() == 1) {
|
||||||
IEditorPart part= EditorUtility.isOpenInEditor(obj);
|
if (obj instanceof ISourceReference) {
|
||||||
if (part != null) {
|
ITranslationUnit tu = ((ISourceReference)obj).getTranslationUnit();
|
||||||
IWorkbenchPage page= getSite().getPage();
|
if (tu != null) {
|
||||||
page.bringToTop(part);
|
IEditorPart part= EditorUtility.isOpenInEditor(obj);
|
||||||
if (obj instanceof ICElement)
|
if (part != null) {
|
||||||
EditorUtility.revealInEditor(part, (ICElement) obj);
|
IWorkbenchPage page= getSite().getPage();
|
||||||
|
page.bringToTop(part);
|
||||||
|
if (obj instanceof ICElement) {
|
||||||
|
EditorUtility.revealInEditor(part, (ICElement) obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue