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:
parent
a27a1df93d
commit
4966785528
1 changed files with 12 additions and 5 deletions
|
@ -12,11 +12,14 @@
|
|||
|
||||
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.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.CDOM;
|
||||
|
@ -52,9 +55,13 @@ public class TranslationUnitHelper {
|
|||
public static IASTTranslationUnit loadTranslationUnit(String filename, boolean useIndex) throws CoreException{
|
||||
|
||||
if (filename != null) {
|
||||
IPath path = new Path(filename);
|
||||
IFile tmpFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
|
||||
return loadTranslationUnit(tmpFile, useIndex);
|
||||
IFile[] tmpFile = null;
|
||||
try {
|
||||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue