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

Java TextSearchRequestor类代码示例

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

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



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

示例1: createRenameChangeForTestImplementation

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public Change createRenameChangeForTestImplementation(IProgressMonitor pm) {
	IResource[] roots = { getProject() };
	String[] fileNamePatterns = new String[] { "*.java" };
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
	IPath path = Helper.buildGeneratedAnnotationValue(getOriginalFile());
	Pattern pattern = Pattern.compile(Helper.getGeneratedAnnotationRegExp(path));
	List<Change> changes = new ArrayList<Change>();
	TextSearchRequestor collector = new TextSearchRequestor() {
		@Override
		public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
			IFile file = matchAccess.getFile();
			Change rename = new RenameCompilationUnitChange(getProject(),file.getFullPath(), getNewName(),CompilationUnitType.TEST_IMPLEMENTATION);
			changes.add(rename);
			return true;
		}
	};

	TextSearchEngine.create().search(scope, collector, pattern, pm);

	if (changes.isEmpty())
		return null;

	CompositeChange result = new CompositeChange("Rename GraphWalker Test Implementation(s)");
	Map<IPath,IPath> maps = new HashMap<IPath,IPath> ();
	for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
		RenameCompilationUnitChange mc = (RenameCompilationUnitChange)iter.next();
		IPath mcPath = mc.getTargetFilePath();
		IPath p = maps.get(mcPath);
		if (p!=null) {
			String[] parts = mc.getNewName().split(Pattern.quote("."));
			String newValue = parts[0] + System.currentTimeMillis() + "." + parts[1];
			mc.setNewName(newValue);
		}
		maps.put(mc.getTargetFilePath(),mc.getTargetFilePath());
		result.add(mc);
	}

	return result;		
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:40,代码来源:RenameChange.java


示例2: createRenameChangeForTestInterface

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public Change createRenameChangeForTestInterface(IProgressMonitor pm) {
	IResource[] roots = { getProject() };
	String[] fileNamePatterns = new String[] { "*.java" };
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
	IPath path = Helper.buildModelAnnotationValue(originalFile);
	Pattern pattern = Pattern.compile(Helper.getModelAnnotationRegExp(path));
	List<Change> changes = new ArrayList<Change>();
	TextSearchRequestor collector = new TextSearchRequestor() {
		@Override
		public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
			IFile file = matchAccess.getFile();
			Change rename = new RenameCompilationUnitChange(getProject(),file.getFullPath(), getNewName(),CompilationUnitType.TEST_INTERFACE);
			changes.add(rename);
			return true;
		} 
	};

	TextSearchEngine.create().search(scope, collector, pattern, pm);

	if (changes.isEmpty())
		return null;

	CompositeChange result = new CompositeChange("Rename GraphWalker Test Interface(s)");
	Map<IPath,IPath> maps = new HashMap<IPath,IPath> ();
	for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
		RenameCompilationUnitChange mc = (RenameCompilationUnitChange)iter.next();
		IPath p = maps.get(mc.getTargetFilePath());
		if (p!=null) {
			String[] parts = mc.getNewName().split(Pattern.quote("."));
			mc.setNewName(parts[0] + System.currentTimeMillis() + "." + parts[1]);
		}
		result.add(mc);
	}

	return result;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:37,代码来源:RenameChange.java


示例3: createMoveChangeForTestImplementation

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public Change createMoveChangeForTestImplementation(IProgressMonitor pm) {
	IResource[] roots = { originalFile.getProject() };
	String[] fileNamePatterns = new String[] { "*.java" };
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
	IPath path = Helper.buildGeneratedAnnotationValue(originalFile);
	Pattern pattern = Pattern.compile(Helper.getGeneratedAnnotationRegExp(path));
	List<Change> changes = new ArrayList<Change>();
	TextSearchRequestor collector = new TextSearchRequestor() {
		@Override
		public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
			IFile file = matchAccess.getFile();
			MoveChange move = new MoveCompilationUnitChange(originalFile,file, destination,CompilationUnitType.TEST_IMPLEMENTATION);
			changes.add(move);
			return true;
		}
	};

	TextSearchEngine.create().search(scope, collector, pattern, pm);

	if (changes.isEmpty())
		return null;

	CompositeChange result = new CompositeChange("Move GraphWalker Test Implementation(s)");
	for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
		Change mc = iter.next();
		result.add(mc);
	}

	return result;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:31,代码来源:MoveChange.java


示例4: createMoveChangeForTestInterface

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public Change createMoveChangeForTestInterface(IProgressMonitor pm) {
	IResource[] roots = { originalFile.getProject() };
	String[] fileNamePatterns = new String[] { "*.java" };
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
	IPath path = Helper.buildModelAnnotationValue(originalFile);
	Pattern pattern = Pattern.compile(Helper.getModelAnnotationRegExp(path));
	List<Change> changes = new ArrayList<Change>();
	TextSearchRequestor collector = new TextSearchRequestor() {
		@Override
		public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
			IFile file = matchAccess.getFile();
			MoveChange move = new MoveCompilationUnitChange(originalFile,file, destination,CompilationUnitType.TEST_INTERFACE);
			changes.add(move);
			return true;
		}
	};

	TextSearchEngine.create().search(scope, collector, pattern, pm);

	if (changes.isEmpty())
		return null;

	CompositeChange result = new CompositeChange("Move GraphWalker Test Interface(s)");
	for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
		Change mc = iter.next();
		result.add(mc);
	}

	return result;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:31,代码来源:MoveChange.java


示例5: TextSearchVisitor

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public TextSearchVisitor(TextSearchRequestor collector, Pattern searchPattern) {
  fCollector = collector;
  fStatus =
      new MultiStatus(
          NewSearchUI.PLUGIN_ID, IStatus.OK, SearchMessages.TextSearchEngine_statusMessage, null);

  fMatcher = searchPattern.pattern().length() == 0 ? null : searchPattern.matcher(new String());

  fFileCharSequenceProvider = new FileCharSequenceProvider();
  fMatchAccess = new ReusableMatchAccess();
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:TextSearchVisitor.java


示例6: getMatchOffsets

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
/**
 * @return a list with the offsets for the match in the full string.
 * Note that the offsets will be ordered
 * @throws CoreException
 */
public static ArrayList<Integer> getMatchOffsets(String match, String fullString) throws CoreException {
    final ArrayList<Integer> offsets = new ArrayList<Integer>();
    TextSearchRequestor textSearchRequestor = new TextSearchRequestor() {
        @Override
        public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
            offsets.add(matchAccess.getMatchOffset());
            return true;
        }
    };
    TokenMatching matching = new TokenMatching(textSearchRequestor, match);
    matching.collectMatches(null, fullString, new NullProgressMonitor(), false);

    return offsets;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:TokenMatching.java


示例7: testMatches

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public void testMatches() throws Exception {
    final ArrayList<Integer> offsets = new ArrayList<Integer>();
    TextSearchRequestor textSearchRequestor = new TextSearchRequestor() {
        @Override
        public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
            offsets.add(matchAccess.getMatchOffset());
            return true;
        }
    };
    TokenMatching matching = new TokenMatching(textSearchRequestor, "foo");
    matching.collectMatches(null, "foo , foo fooba, afoo, foo)a", new NullProgressMonitor(), false);
    compare(new Integer[] { 0, 6, 23 }, offsets);

    compare(new Integer[] { 0, 6, 23 }, TokenMatching.getMatchOffsets("foo", "foo , foo fooba, afoo, foo)a"));
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:16,代码来源:TokenMatchingTest.java


示例8: PatternTextSearchVisitor

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public PatternTextSearchVisitor(TextSearchRequestor collector, Pattern searchPattern) {
  fCollector = collector;
  fStatus = new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, SearchMessages.TextSearchEngine_statusMessage, null);

  fMatcher = searchPattern.pattern().length() == 0 ? null : searchPattern.matcher(new String());

  fFileCharSequenceProvider = new FileCharSequenceProvider();
  fMatchAccess = new ReusableMatchAccess();
}
 
开发者ID:agusevas,项目名称:logan,代码行数:10,代码来源:PatternTextSearchVisitor.java


示例9: PlainTextSearchVisitor

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public PlainTextSearchVisitor(TextSearchRequestor collector, String searchPattern, boolean ignoreCase) {
  fCollector = collector;
  this.searchPattern = searchPattern;
  this.ignoreCase = ignoreCase;
  fStatus = new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, SearchMessages.TextSearchEngine_statusMessage, null);

  fFileCharSequenceProvider = new FileCharSequenceProvider();
  fMatchAccess = new ReusableMatchAccess();
}
 
开发者ID:agusevas,项目名称:logan,代码行数:10,代码来源:PlainTextSearchVisitor.java


示例10: TokenMatching

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
public TokenMatching(TextSearchRequestor collector, ReusableMatchAccess matchAccess, CharSequence searchText) {
    this.fCollector = collector;
    this.fMatchAccess = matchAccess;
    this.fSearchText = searchText;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:6,代码来源:TokenMatching.java


示例11: search

import org.eclipse.search.core.text.TextSearchRequestor; //导入依赖的package包/类
@Override
public IStatus search(IFile[] scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor) {
  return new PatternTextSearchVisitor(requestor, searchPattern).search(scope, monitor);
}
 
开发者ID:agusevas,项目名称:logan,代码行数:5,代码来源:LoganalyserTextSearchEngine.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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