• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AbstractTextSearchResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.search.ui.text.AbstractTextSearchResult的典型用法代码示例。如果您正苦于以下问题:Java AbstractTextSearchResult类的具体用法?Java AbstractTextSearchResult怎么用?Java AbstractTextSearchResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AbstractTextSearchResult类属于org.eclipse.search.ui.text包,在下文中一共展示了AbstractTextSearchResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: getNumberOfPotentialMatches

import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
protected final int getNumberOfPotentialMatches(Object element) {
	int res= 0;
	AbstractTextSearchResult result= fPage.getInput();
	if (result != null) {
		Match[] matches= result.getMatches(element);
		for (int i = 0; i < matches.length; i++) {
			if ((matches[i]) instanceof JavaElementMatch) {
				if (((JavaElementMatch)matches[i]).getAccuracy() == SearchMatch.A_INACCURATE)
					res++;
			}
		}
	}
	return res;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:SearchLabelProvider.java


示例17: initialize

import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
@Override
protected synchronized void initialize(AbstractTextSearchResult result) {
	super.initialize(result);
	fChildrenMap= new HashMap<Object, Set<Object>>();
	if (result != null) {
		Object[] elements= result.getElements();
		for (int i= 0; i < elements.length; i++) {
			if (getPage().getDisplayedMatchCount(elements[i]) > 0) {
				insert(null, null, elements[i]);
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:LevelTreeContentProvider.java


示例18: preformEditorSelectionChanged

import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private void preformEditorSelectionChanged(ITextSelection selection, CompilationUnit astRoot) {
	if (!isLinkingEnabled()) {
		return;
	}
	IOccurrencesFinder finder;

	AbstractTextSearchResult input= getInput();
	if (input == null) {
		finder= new OccurrencesFinder();
	} else {
		String id= ((OccurrencesSearchQuery) input.getQuery()).getFinderId();
		if (id == OccurrencesFinder.ID) {
			finder= new OccurrencesFinder();
		} else if (id == ExceptionOccurrencesFinder.ID) {
			finder= new ExceptionOccurrencesFinder();
		} else {
			finder= new ImplementOccurrencesFinder();
		}
	}

	int offset= selection.getOffset();
	int length= selection.getLength();
	if (finder.initialize(astRoot, offset, length) == null) {
		final OccurrencesSearchQuery query= new OccurrencesSearchQuery(finder, astRoot.getTypeRoot());
		query.run(null);
		OccurrencesSearchResult result= (OccurrencesSearchResult) query.getSearchResult();
		final JavaElementLine line= getMatchingLine(result, offset, length);

		getSite().getShell().getDisplay().asyncExec(new Runnable() {
			public void run() {
				setInput(query.getSearchResult(), line == null ? null : new StructuredSelection(line));
			}
		});
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:OccurrencesSearchResultPage.java


示例19: isQueryRunning

import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
private boolean isQueryRunning() {
	AbstractTextSearchResult result= getInput();
	if (result != null) {
		return NewSearchUI.isQueryRunning(result.getQuery());
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:JavaSearchResultPage.java


示例20: getSearchResult

import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入依赖的package包/类
@Override
public AbstractTextSearchResult getSearchResult() {
    final ReferenceLibrarySearchResult existingSearchResult = searchResult.get();
    if (existingSearchResult == null) {
        final ReferenceLibrarySearchResult newSearchResult = new ReferenceLibrarySearchResult(this);
        return searchResult.compareAndSet(null, newSearchResult) ? newSearchResult : searchResult.get();
    }
    return existingSearchResult;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:10,代码来源:ReferenceLibrarySearchQuery.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColoringAttributes类代码示例发布时间:2022-05-22
下一篇:
Java KafkaEmbedded类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap