本文整理汇总了Java中org.eclipse.search.ui.text.AbstractTextSearchResult类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTextSearchResult类的具体用法?Java AbstractTextSearchResult怎么用?Java AbstractTextSearchResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTextSearchResult类属于org.eclipse.search.ui.text包,在下文中一共展示了AbstractTextSearchResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
startTime = System.currentTimeMillis();
AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
textResult.removeAll();
try {
IContainer dir = configFile.getParent();
dir.accept(new AbstractSectionPatternVisitor(section) {
@Override
protected void collect(IResourceProxy proxy) {
Match match = new FileMatch((IFile) proxy.requestResource());
result.addMatch(match);
}
}, IResource.NONE);
return Status.OK_STATUS;
} catch (Exception ex) {
return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
}
}
示例2: getLabel
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public String getLabel() {
String label= super.getLabel();
StructuredViewer viewer= getViewer();
if (viewer instanceof TableViewer) {
TableViewer tv= (TableViewer) viewer;
AbstractTextSearchResult result= getInput();
if (result != null) {
int itemCount= ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
if (showLineMatches()) {
int matchCount= getInput().getMatchCount();
if (itemCount < matchCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[]{label, new Integer(itemCount), new Integer(matchCount)});
}
} else {
int fileCount= getInput().getElements().length;
if (itemCount < fileCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[]{label, new Integer(itemCount), new Integer(fileCount)});
}
}
}
}
return label;
}
示例3: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private synchronized void initialize(AbstractTextSearchResult result) {
fResult= result;
fChildrenMap= new HashMap();
boolean showLineMatches= true; //!((TypeScriptSearchQuery) fResult.getQuery()).isFileNameSearch();
if (result != null) {
Object[] elements= result.getElements();
for (int i= 0; i < elements.length; i++) {
if (showLineMatches) {
Match[] matches= result.getMatches(elements[i]);
for (int j= 0; j < matches.length; j++) {
insert(((TypeScriptMatch) matches[j]).getLineElement(), false);
}
} else {
insert(elements[i], false);
}
}
}
}
示例4: getLabelProvider
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private ILabelProvider getLabelProvider(Object element) {
AbstractTextSearchResult input= fPage.getInput();
if (!(input instanceof JavaSearchResult))
return null;
IMatchPresentation participant= ((JavaSearchResult) input).getSearchParticpant(element);
if (participant == null)
return null;
ILabelProvider lp= fLabelProviderMap.get(participant);
if (lp == null) {
lp= participant.createLabelProvider();
fLabelProviderMap.put(participant, lp);
Object[] listeners= fListeners.getListeners();
for (int i= 0; i < listeners.length; i++) {
lp.addListener((ILabelProviderListener) listeners[i]);
}
}
return lp;
}
示例5: computeContainedMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
//TODO same code in JavaSearchResult
IEditorInput editorInput= editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput;
return computeContainedMatches(result, fileEditorInput.getFile());
} else if (editorInput instanceof IClassFileEditorInput) {
IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput;
IClassFile classFile= classFileEditorInput.getClassFile();
Object[] elements= getElements();
if (elements.length == 0)
return NO_MATCHES;
//all matches from same file:
JavaElementLine jel= (JavaElementLine) elements[0];
if (jel.getJavaElement().equals(classFile))
return collectMatches(elements);
}
return NO_MATCHES;
}
示例6: getElements
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public Object[] getElements(Object inputElement) {
if (inputElement instanceof AbstractTextSearchResult) {
Set<Object> filteredElements= new HashSet<Object>();
Object[] rawElements= ((AbstractTextSearchResult)inputElement).getElements();
int limit= getPage().getElementLimit().intValue();
for (int i= 0; i < rawElements.length; i++) {
if (getPage().getDisplayedMatchCount(rawElements[i]) > 0) {
filteredElements.add(rawElements[i]);
if (limit != -1 && limit < filteredElements.size()) {
break;
}
}
}
return filteredElements.toArray();
}
return EMPTY_ARR;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:JavaSearchTableContentProvider.java
示例7: createMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public void createMatches(IDocument doc, String text, StringMatcherWithIndexSemantics stringMatcher,
IFile workspaceFile,
AbstractTextSearchResult searchResult, ModulesKey modulesKey) {
StringMatcherWithIndexSemantics.Position find = stringMatcher.find(text, 0);
while (find != null) {
int offset = find.getStart();
int end = find.getEnd();
int length = end - offset;
PySelection ps = new PySelection(doc, offset);
int lineNumber = ps.getLineOfOffset();
String lineContents = ps.getLine(lineNumber);
int lineStartOffset = ps.getLineOffset(lineNumber);
PyModuleLineElement element = new PyModuleLineElement(workspaceFile, lineNumber, lineStartOffset,
lineContents,
modulesKey);
searchResult.addMatch(new PyModuleMatch(workspaceFile, offset, length, element, modulesKey));
find = stringMatcher.find(text, end);
}
}
示例8: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private synchronized void initialize(AbstractTextSearchResult result) {
fResult = result;
fChildrenMap = new HashMap<Object, Set>();
boolean showLineMatches = !((AbstractPythonSearchQuery) fResult.getQuery()).isFileNameSearch();
if (result != null) {
Object[] elements = result.getElements();
for (int i = 0; i < elements.length; i++) {
if (showLineMatches) {
Match[] matches = result.getMatches(elements[i]);
for (int j = 0; j < matches.length; j++) {
insert(((FileMatch) matches[j]).getLineElement(), false);
}
} else {
insert(elements[i], false);
}
}
}
}
示例9: getColoredLabelWithCounts
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private String getColoredLabelWithCounts(Object element, String coloredName) {
AbstractTextSearchResult result = fPage.getInput();
if (result == null) {
return coloredName;
}
int matchCount = result.getMatchCount(element);
if (matchCount <= 1) {
return coloredName;
}
String countInfo = MessageFormat.format(SearchMessages.FileLabelProvider_count_format, matchCount);
coloredName += " ";
coloredName += countInfo;
return coloredName;
}
示例10: getLabel
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public String getLabel() {
String label = super.getLabel();
StructuredViewer viewer = getViewer();
if (viewer instanceof TableViewer) {
TableViewer tv = (TableViewer) viewer;
AbstractTextSearchResult result = getInput();
if (result != null) {
int itemCount = ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
if (showLineMatches()) {
int matchCount = getInput().getMatchCount();
if (itemCount < matchCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[] { label, new Integer(itemCount),
new Integer(matchCount) });
}
} else {
int fileCount = getInput().getElements().length;
if (itemCount < fileCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[] { label, new Integer(itemCount),
new Integer(fileCount) });
}
}
}
}
return label;
}
示例11: computeContainedMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
@Override
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
IEditorInput ei = editor.getEditorInput();
if (ei instanceof IFileEditorInput) {
IFileEditorInput fi = (IFileEditorInput) ei;
return getMatches(fi.getFile());
}
return NO_MATCHES;
}
示例12: getMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public TypeScriptMatch[] getMatches(AbstractTextSearchResult result) {
ArrayList res= new ArrayList();
Match[] matches= result.getMatches(fParent);
for (int i= 0; i < matches.length; i++) {
TypeScriptMatch curr= (TypeScriptMatch) matches[i];
if (curr.getLineElement() == this) {
res.add(curr);
}
}
return (TypeScriptMatch[]) res.toArray(new TypeScriptMatch[res.size()]);
}
示例13: getNumberOfMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public int getNumberOfMatches(AbstractTextSearchResult result) {
int count= 0;
Match[] matches= result.getMatches(fParent);
for (int i= 0; i < matches.length; i++) {
TypeScriptMatch curr= (TypeScriptMatch) matches[i];
if (curr.getLineElement() == this) {
count++;
}
}
return count;
}
示例14: getColoredLabelWithCounts
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private StyledString getColoredLabelWithCounts(Object element, StyledString coloredName) {
AbstractTextSearchResult result= fPage.getInput();
if (result == null)
return coloredName;
int matchCount= result.getMatchCount(element);
if (matchCount <= 1)
return coloredName;
String countInfo= Messages.format(SearchMessages.FileLabelProvider_count_format, new Integer(matchCount));
coloredName.append(' ').append(countInfo, StyledString.COUNTER_STYLER);
return coloredName;
}
示例15: computeContainedMatches
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
//TODO: copied from JavaSearchResult:
IEditorInput editorInput= editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput;
return computeContainedMatches(result, fileEditorInput.getFile());
} else if (editorInput instanceof IClassFileEditorInput) {
IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput;
Set<Match> matches= new HashSet<Match>();
collectMatches(matches, classFileEditorInput.getClassFile());
return matches.toArray(new Match[matches.size()]);
}
return NO_MATCHES;
}