1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for Bug 158193 - [navigation] incorrect editor opened for external files

This commit is contained in:
Anton Leherbauer 2006-12-05 14:56:39 +00:00
parent e36cb0d76f
commit ba0d37b4a8

View file

@ -210,23 +210,22 @@ public class EditorUtility {
private static IEditorInput getEditorInput(ICElement element) throws CModelException {
while (element != null) {
if (element instanceof IWorkingCopy && ((IWorkingCopy) element).isWorkingCopy())
element= ((IWorkingCopy) element).getOriginalElement();
if (element instanceof ISourceReference) {
ITranslationUnit tu = ((ISourceReference)element).getTranslationUnit();
if (tu != null) {
element = tu;
}
}
if (element instanceof IWorkingCopy && ((IWorkingCopy) element).isWorkingCopy())
element= ((IWorkingCopy) element).getOriginalElement();
if (element instanceof ITranslationUnit) {
ITranslationUnit unit= (ITranslationUnit) element;
IResource resource= unit.getResource();
if (resource instanceof IFile) {
return new FileEditorInput((IFile) resource);
}
return new ExternalEditorInput(unit, getStorage(unit));
return new ExternalEditorInput(unit, new FileStorage(unit.getPath()));
}
if (element instanceof IBinary) {