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

Fix for 235289: [mylyn] AssertionFailedException when expanding binaries

This commit is contained in:
Anton Leherbauer 2008-06-19 08:26:08 +00:00
parent 8758582793
commit e8b7f79fc4

View file

@ -41,6 +41,7 @@ import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.CoreModelUtil;
import org.eclipse.cdt.core.model.IBuffer;
import org.eclipse.cdt.core.model.ICContainer;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IContributedModelBuilder;
@ -1088,14 +1089,25 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override
public void getHandleMemento(StringBuilder buff) {
if (getResource() == null) {
// external translation unit
((CElement)getCProject()).getHandleMemento(buff);
buff.append(getHandleMementoDelimiter());
final IPath location= getLocation();
if (location != null) {
escapeMementoName(buff, location.toPortableString());
final IPath fileLocation= getLocation();
if (fileLocation != null) {
escapeMementoName(buff, fileLocation.toPortableString());
}
} else {
} else if (getParent() instanceof ICContainer) {
// regular case: translation unit under source container
super.getHandleMemento(buff);
} else {
// translation unit below a binary
((CElement)getCProject()).getHandleMemento(buff);
buff.append(getHandleMementoDelimiter());
// project relative path
final IPath projectPath= getResource().getFullPath().removeFirstSegments(1);
if (projectPath != null) {
escapeMementoName(buff, projectPath.toPortableString());
}
}
}