mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +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();
|
String tuName = memento.nextToken();
|
||||||
final IPath path= Path.fromPortableString(tuName);
|
final IPath path= Path.fromPortableString(tuName);
|
||||||
CElement tu= null;
|
CElement tu= null;
|
||||||
try {
|
if (!path.isAbsolute()) {
|
||||||
tu= (CElement) findElement(path);
|
try {
|
||||||
} catch (CModelException exc) {
|
tu= (CElement) findElement(path);
|
||||||
CCorePlugin.log(exc);
|
} catch (CModelException exc) {
|
||||||
}
|
CCorePlugin.log(exc);
|
||||||
if (tu == null) {
|
}
|
||||||
|
} else {
|
||||||
tu= (CElement) CoreModel.getDefault().createTranslationUnitFrom(this, path);
|
tu= (CElement) CoreModel.getDefault().createTranslationUnitFrom(this, path);
|
||||||
}
|
}
|
||||||
if (tu != null) {
|
if (tu != null) {
|
||||||
|
|
|
@ -1074,7 +1074,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
if (getResource() == null) {
|
if (getResource() == null) {
|
||||||
((CElement)getCProject()).getHandleMemento(buff);
|
((CElement)getCProject()).getHandleMemento(buff);
|
||||||
buff.append(getHandleMementoDelimiter());
|
buff.append(getHandleMementoDelimiter());
|
||||||
escapeMementoName(buff, getPath().toPortableString());
|
final IPath location= getLocation();
|
||||||
|
if (location != null) {
|
||||||
|
escapeMementoName(buff, location.toPortableString());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
super.getHandleMemento(buff);
|
super.getHandleMemento(buff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,7 +638,15 @@ public class EditorUtility {
|
||||||
cProject= null;
|
cProject= null;
|
||||||
}
|
}
|
||||||
} else if (input instanceof ITranslationUnitEditorInput) {
|
} 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;
|
return cProject;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue