From f91408d15a5730c845b56fc036472cda8e9622c9 Mon Sep 17 00:00:00 2001 From: Mike Kucera Date: Thu, 16 Oct 2008 19:50:32 +0000 Subject: [PATCH] fix for bug 250972 --- .../org/eclipse/cdt/internal/core/model/CModelManager.java | 3 ++- .../org/eclipse/cdt/internal/core/model/TranslationUnit.java | 4 +++- .../eclipse/cdt/internal/ui/util/ExternalEditorInput.java | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java index 546c1f1440f..d6cf33aea81 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java @@ -473,7 +473,8 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe // crecoskie // TODO FIXME: include entries don't handle URIs yet - if (includeReference.isOnIncludeEntry(URIUtil.toPath(locationURI))) { + IPath path = URIUtil.toPath(locationURI); + if (path != null && includeReference.isOnIncludeEntry(path)) { String headerContentTypeId= contentTypeId; if (headerContentTypeId == null) { headerContentTypeId= CoreModel.hasCCNature(project) ? CCorePlugin.CONTENT_TYPE_CXXHEADER : CCorePlugin.CONTENT_TYPE_CHEADER; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java index 95faec1b33f..836afd66a4c 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java @@ -85,6 +85,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.content.IContentType; /** @@ -753,7 +754,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit { language = LanguageManager.getInstance().getLanguageForFile(file, configuration, contentTypeId); } else { - language = LanguageManager.getInstance().getLanguageForFile(getLocation(), getCProject().getProject(), configuration, contentTypeId); + String filename = getElementName(); + language = LanguageManager.getInstance().getLanguageForFile(new Path(filename), getCProject().getProject(), configuration, contentTypeId); } return language; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java index f20afe18b4b..9fd808ccc1b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java @@ -115,7 +115,10 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis * @see IEditorInput#getToolTipText() */ public String getToolTipText() { - return externalFile.getFullPath().toString(); + IPath path = externalFile.getFullPath(); + if(path != null) + return path.toString(); + return unit.getLocationURI().toString(); } /* (non-Javadoc)