use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class RemoveResultAction method usePluralLabel.
private boolean usePluralLabel() {
ISelection s = fSelectionProvider.getSelection();
if (s == null || s.isEmpty() || !(s instanceof IStructuredSelection))
return false;
IStructuredSelection selection = (IStructuredSelection) s;
if (selection.size() != 1)
return true;
Object firstElement = selection.getFirstElement();
if (firstElement instanceof ISearchResultViewEntry)
return ((ISearchResultViewEntry) firstElement).getMatchCount() > 1;
return false;
}
use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class SearchResultViewEntryAdapterFactory method getAdapter.
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object element, Class<T> key) {
ISearchResultViewEntry entry = (ISearchResultViewEntry) element;
if (IMarker.class.equals(key)) {
return (T) entry.getSelectedMarker();
}
if (IResource.class.equals(key)) {
IResource resource = entry.getResource();
/*
* This is a trick to filter out dummy markers that
* have been attached to a project because there is no
* corresponding resource in the workspace.
*/
int type = resource.getType();
if (type != IResource.PROJECT && type != IResource.ROOT)
return (T) resource;
}
return null;
}
use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class SearchResultViewer method isPotentialMatchSelected.
private boolean isPotentialMatchSelected() {
if (getSelectedEntriesCount() == 0)
return false;
Iterator<?> iter = Collections.emptyList().iterator();
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection)
iter = ((IStructuredSelection) selection).iterator();
while (iter.hasNext()) {
Object entry = iter.next();
if (entry instanceof ISearchResultViewEntry) {
IMarker marker = ((ISearchResultViewEntry) entry).getSelectedMarker();
if (marker != null && marker.getAttribute(SearchUI.POTENTIAL_MATCH, false))
return true;
}
}
return false;
}
use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class SearchResultViewer method updateStatusLine.
void updateStatusLine() {
boolean hasSingleSelection = getSelectedEntriesCount() == 1;
// $NON-NLS-1$
String location = "";
if (hasSingleSelection) {
ISearchResultViewEntry entry = (ISearchResultViewEntry) getTable().getItem(getTable().getSelectionIndex()).getData();
IPath path = entry.getResource().getFullPath();
if (path != null)
location = path.makeRelative().toString();
}
setStatusLineMessage(location);
}
use of org.eclipse.search.ui.ISearchResultViewEntry in project eclipse.platform.text by eclipse.
the class FileLabelProvider method getImage.
@Override
public Image getImage(Object element) {
if (!(element instanceof ISearchResultViewEntry))
return null;
IResource resource = ((ISearchResultViewEntry) element).getResource();
Image image = fLabelProvider.getImage(resource);
if (fDecorator != null) {
Image decoratedImage = fDecorator.decorateImage(image, resource);
if (decoratedImage != null)
return decoratedImage;
}
return image;
}
Aggregations