当前位置: 首页>>代码示例>>Java>>正文


Java AbstractTextSearchResult类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:24,代码来源:EditorConfigSearchQuery.java

示例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;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:25,代码来源:TypeScriptSearchResultPage.java

示例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);
			}
		}
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:20,代码来源:TypeScriptSearchTreeContentProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:SearchLabelProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:OccurrencesSearchResult.java

示例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);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:PySearchIndexQuery.java

示例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);
            }
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:FileTreeContentProvider.java

示例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;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:FileLabelProvider.java

示例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;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:27,代码来源:UrnTextSearchViewPage.java

示例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;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:10,代码来源:TypeScriptSearchResult.java

示例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()]);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:12,代码来源:LineElement.java

示例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;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:12,代码来源:LineElement.java

示例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;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:14,代码来源:TypeScriptSearchLabelProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:NLSSearchResult.java


注:本文中的org.eclipse.search.ui.text.AbstractTextSearchResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。