Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-14 08:10:37 +0000
committerAnton Leherbauer2008-02-14 08:10:37 +0000
commita3aab7e451687aa22aecb0288b8776e1eaeda4f2 (patch)
tree0a7c965748a63af1965f6173e521b60575178ae4 /core/org.eclipse.cdt.core/model/org
parent8ece714199b5faaece6d699359628be84309d559 (diff)
downloadorg.eclipse.cdt-a3aab7e451687aa22aecb0288b8776e1eaeda4f2.tar.gz
org.eclipse.cdt-a3aab7e451687aa22aecb0288b8776e1eaeda4f2.tar.xz
org.eclipse.cdt-a3aab7e451687aa22aecb0288b8776e1eaeda4f2.zip
Fix for 218266: [patch] Wrong path returned for ExternalTranslationUnit working copies (patch by Warren Paul)
Diffstat (limited to 'core/org.eclipse.cdt.core/model/org')
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java8
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java11
2 files changed, 13 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java
index ebeac1b4ca8..5cb8466a25c 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 QNX Software Systems and others.
+ * Copyright (c) 2000, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems)
+ * Warren Paul (Nokia) - Bug 218266
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
@@ -15,7 +16,6 @@ package org.eclipse.cdt.internal.core.model;
import java.net.URI;
import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.core.runtime.IPath;
/**
* ExternalTranslationUnit
@@ -29,9 +29,5 @@ public class ExternalTranslationUnit extends TranslationUnit {
public ExternalTranslationUnit(ICElement parent, URI uri, String contentTypeID) {
super(parent, uri, contentTypeID);
}
-
- public IPath getPath() {
- return getLocation();
- }
}
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 1286f89ed0d..a962a18ce1c 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
@@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Anton Leherbauer (Wind River Systems)
+ * Warren Paul (Nokia) - Bug 218266
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
@@ -928,5 +929,15 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return result != null ? result : getLanguage();
}
+ public IPath getPath() {
+ if (getFile() != null) {
+ return super.getPath();
+ }
+ IPath path= getLocation();
+ if (path != null) {
+ return path;
+ }
+ return super.getPath();
+ }
}

Back to the top