1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Allow CSearchElement to adapt to IFileStore and to IIndexFileLocation.

This commit is contained in:
Sergey Prigogin 2014-02-05 11:28:55 -08:00
parent 9ddde64119
commit aa3df633a7

View file

@ -11,8 +11,11 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.search;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Path;
@ -55,6 +58,14 @@ public class CSearchElement implements IAdaptable {
if (fullPath != null) {
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath));
}
} else if (adapterType.isAssignableFrom(IFileStore.class)) {
try {
return EFS.getStore(location.getURI());
} catch (CoreException e) {
return null;
}
} else if (adapterType.isAssignableFrom(IIndexFileLocation.class)) {
return location;
}
return null;
}