Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
Expand Down Expand Up @@ -523,7 +524,19 @@ public static RefactoringStatusContext getStatusContext(IASTNode node1, IASTNode
}

String filename = node1.getTranslationUnit().getFileLocation().getFileName();
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(filename));

IWorkspace workspace;
try {
workspace = ResourcesPlugin.getWorkspace();
}
catch(IllegalStateException e) {
/* this can only happen if the workspace is not open -
* in particular, if we're in the CLI
* */
return null;
}

IFile file = workspace.getRoot().getFileForLocation(new Path(filename));
if (file == null) {
return null;
}
Expand Down