mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix translation unit restore for external includes
This commit is contained in:
parent
f0495f62d0
commit
8cfa0b6b69
3 changed files with 20 additions and 8 deletions
|
@ -776,12 +776,13 @@ public class CProject extends Openable implements ICProject {
|
|||
String tuName = memento.nextToken();
|
||||
final IPath path= Path.fromPortableString(tuName);
|
||||
CElement tu= null;
|
||||
try {
|
||||
tu= (CElement) findElement(path);
|
||||
} catch (CModelException exc) {
|
||||
CCorePlugin.log(exc);
|
||||
}
|
||||
if (tu == null) {
|
||||
if (!path.isAbsolute()) {
|
||||
try {
|
||||
tu= (CElement) findElement(path);
|
||||
} catch (CModelException exc) {
|
||||
CCorePlugin.log(exc);
|
||||
}
|
||||
} else {
|
||||
tu= (CElement) CoreModel.getDefault().createTranslationUnitFrom(this, path);
|
||||
}
|
||||
if (tu != null) {
|
||||
|
|
|
@ -1074,7 +1074,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
if (getResource() == null) {
|
||||
((CElement)getCProject()).getHandleMemento(buff);
|
||||
buff.append(getHandleMementoDelimiter());
|
||||
escapeMementoName(buff, getPath().toPortableString());
|
||||
final IPath location= getLocation();
|
||||
if (location != null) {
|
||||
escapeMementoName(buff, location.toPortableString());
|
||||
}
|
||||
} else {
|
||||
super.getHandleMemento(buff);
|
||||
}
|
||||
|
|
|
@ -638,7 +638,15 @@ public class EditorUtility {
|
|||
cProject= null;
|
||||
}
|
||||
} else if (input instanceof ITranslationUnitEditorInput) {
|
||||
cProject= ((ITranslationUnitEditorInput)input).getTranslationUnit().getCProject();
|
||||
final ITranslationUnit tu= ((ITranslationUnitEditorInput)input).getTranslationUnit();
|
||||
if (tu != null) {
|
||||
cProject= tu.getCProject();
|
||||
} else if (input instanceof ExternalEditorInput) {
|
||||
IResource resource= ((ExternalEditorInput) input).getMarkerResource();
|
||||
if (resource instanceof IProject) {
|
||||
cProject= CoreModel.getDefault().create((IProject) resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cProject;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue