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:
parent
9ddde64119
commit
aa3df633a7
1 changed files with 13 additions and 2 deletions
|
@ -11,8 +11,11 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.search;
|
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.IFile;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
@ -39,7 +42,7 @@ public class CSearchElement implements IAdaptable {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof CSearchElement))
|
if (!(obj instanceof CSearchElement))
|
||||||
return false;
|
return false;
|
||||||
CSearchElement other = (CSearchElement)obj;
|
CSearchElement other = (CSearchElement) obj;
|
||||||
return location.equals(other.location);
|
return location.equals(other.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +58,14 @@ public class CSearchElement implements IAdaptable {
|
||||||
if (fullPath != null) {
|
if (fullPath != null) {
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath));
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue