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

FIXED - bug 256815: Refactoring error when using "Implement Method..."

https://bugs.eclipse.org/bugs/show_bug.cgi?id=256815
This commit is contained in:
Emanuel Graf 2009-01-05 09:25:27 +00:00
parent a27a1df93d
commit 4966785528

View file

@ -12,11 +12,14 @@
package org.eclipse.cdt.internal.ui.refactoring.utils; package org.eclipse.cdt.internal.ui.refactoring.utils;
import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.CDOM; import org.eclipse.cdt.core.dom.CDOM;
@ -52,9 +55,13 @@ public class TranslationUnitHelper {
public static IASTTranslationUnit loadTranslationUnit(String filename, boolean useIndex) throws CoreException{ public static IASTTranslationUnit loadTranslationUnit(String filename, boolean useIndex) throws CoreException{
if (filename != null) { if (filename != null) {
IPath path = new Path(filename); IFile[] tmpFile = null;
IFile tmpFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); try {
return loadTranslationUnit(tmpFile, useIndex); tmpFile = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new URI("file://" + filename)); //$NON-NLS-1$
} catch (URISyntaxException e) {
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, e.getMessage(), e));
}
return loadTranslationUnit(tmpFile[0], useIndex);
} }
return null; return null;