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:
parent
e36cb0d76f
commit
ba0d37b4a8
1 changed files with 4 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue