1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 302109: NPE on selection changes.

This commit is contained in:
Markus Schorn 2010-02-10 08:41:57 +00:00
parent a4fe48870e
commit 3e23c44676

View file

@ -89,15 +89,16 @@ public abstract class AbstractTargetAction
} else {
fContainer = null;
}
} else if (selection instanceof ITextSelection)
{ // key binding pressed inside active text editor
} else if (selection instanceof ITextSelection) {
// Key binding pressed inside active text editor
fContainer= null;
IWorkbenchPart part = fPart != null ? fPart : fWindow.getActivePage().getActivePart();
if ( part instanceof TextEditor ) {
if (part instanceof TextEditor) {
IFile file = org.eclipse.ui.ide.ResourceUtil.getFile(((EditorPart) part).getEditorInput());
fContainer = file.getParent();
} else {
fContainer = null;
}
if (file != null) {
fContainer = file.getParent();
}
}
}
if (fContainer != null && MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(fContainer.getProject())) {
isEnabled = true;