use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class RemoveMatchAction method getMarkers.
private IMarker[] getMarkers(ISelection s) {
if (!(s instanceof IStructuredSelection) || s.isEmpty())
return null;
IStructuredSelection selection = (IStructuredSelection) s;
int size = selection.size();
if (size != 1)
return null;
if (selection.getFirstElement() instanceof ISearchResultViewEntry) {
IMarker marker = ((ISearchResultViewEntry) selection.getFirstElement()).getSelectedMarker();
if (marker != null)
return new IMarker[] { marker };
}
return null;
}
use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class FileLabelProvider method getText.
@Override
public String getText(Object element) {
if (!(element instanceof ISearchResultViewEntry))
// $NON-NLS-1$
return "";
IResource resource = ((ISearchResultViewEntry) element).getResource();
String text = null;
if (resource == null || !resource.exists())
text = SearchMessages.SearchResultView_removed_resource;
else {
IPath path = resource.getFullPath().removeLastSegments(1);
if (path.getDevice() == null)
path = path.makeRelative();
if (fOrder == SHOW_LABEL || fOrder == SHOW_LABEL_PATH) {
text = fLabelProvider.getText(resource);
if (path != null && fOrder == SHOW_LABEL_PATH) {
fArgs[0] = text;
fArgs[1] = path.toString();
text = MessageFormat.format(fgSeparatorFormat, fArgs);
}
} else {
if (path != null)
text = path.toString();
else
// $NON-NLS-1$
text = "";
if (fOrder == SHOW_PATH_LABEL) {
fArgs[0] = text;
fArgs[1] = fLabelProvider.getText(resource);
text = MessageFormat.format(fgSeparatorFormat, fArgs);
}
}
}
// Do the decoration
if (fDecorator != null) {
String decoratedText = fDecorator.decorateText(text, resource);
if (decoratedText != null)
return decoratedText;
}
return text;
}
Aggregations