Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not handle absent external translation units #596

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2023 Wind River Systems, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -11,6 +11,7 @@
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Ed Swartz (Nokia)
* John Dallaway - do not handle absent external translation units (#563)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.navigator;

Expand Down Expand Up @@ -76,7 +77,10 @@ protected boolean updateSelection(IStructuredSelection selection) {
element = ((IAdaptable) element).getAdapter(ICElement.class);
}
if (element instanceof ICElement && (element instanceof ISourceReference || element instanceof IBinary)) {
fOpenElement = (ICElement) element;
// do not handle absent external translation units
if (!(element instanceof ITranslationUnit tu) || (null != tu.getResource()) || tu.exists()) {
fOpenElement = (ICElement) element;
}
}
}
return fOpenElement != null || super.updateSelection(selection);
Expand Down