Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-14 03:09:29 -0500
committerAnton Leherbauer2008-02-14 03:09:29 -0500
commit7ba72ab68cfb38f4fd3deb7204ac22802259ebb0 (patch)
tree802a649dfe8accd448aa467a9d0550cd13e24638
parent732d6ace34e072ee924b11de01c63426c1ccb478 (diff)
downloadorg.eclipse.cdt-7ba72ab68cfb38f4fd3deb7204ac22802259ebb0.tar.gz
org.eclipse.cdt-7ba72ab68cfb38f4fd3deb7204ac22802259ebb0.tar.xz
org.eclipse.cdt-7ba72ab68cfb38f4fd3deb7204ac22802259ebb0.zip
Fix for 218266: [patch] Wrong path returned for ExternalTranslationUnit working copies (patch by Warren Paul)
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ExternalTranslationUnit.java7
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java12
2 files changed, 12 insertions, 7 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 799b2787e20..fc1ea8c1dc5 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;
@@ -27,9 +28,5 @@ public class ExternalTranslationUnit extends TranslationUnit {
public ExternalTranslationUnit(ICElement parent, IPath path, String contentTypeID) {
super(parent, path, 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 61adf23500d..f09ab63956e 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
@@ -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
@@ -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;
@@ -297,7 +298,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
if (file != null) {
location = file.getLocation();
} else {
- return getPath();
+ return null;
}
}
return location;
@@ -902,4 +903,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
final ILanguage result= fLanguageOfContext;
return result != null ? result : getLanguage();
}
+
+ public IPath getPath() {
+ if (getFile() != null) {
+ return super.getPath();
+ }
+ return getLocation();
+ }
}

Back to the top