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

Java FileTextSearchScope类代码示例

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

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



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

示例1: getTextInput

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
/**
 * Set up the search object
 * 
 * @param searchStr
 * @param scope
 * @return
 */
private TextSearchInput getTextInput(final String searchStr, final boolean caseSensitive, final FileTextSearchScope scope) {
	return new TextSearchInput() {

		public String getSearchText() {
			return searchStr;
		}

		public boolean isCaseSensitiveSearch() {
			return caseSensitive;
		}

		public boolean isRegExSearch() {
			return true;
		}

		public FileTextSearchScope getScope() {
			return scope;
		}
	};
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:28,代码来源:TagsSearchHandler.java


示例2: createTextSearchScope

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
public FileTextSearchScope createTextSearchScope() {
    // Setup search scope
    switch (getContainer().getSelectedScope()) {
    case ISearchPageContainer.WORKSPACE_SCOPE:
        return FileTextSearchScope.newWorkspaceScope(getExtensions(), fSearchDerived);
    case ISearchPageContainer.SELECTION_SCOPE:
        return getSelectedResourcesScope();
    case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
        return getEnclosingProjectScope();
    case ISearchPageContainer.WORKING_SET_SCOPE:
        IWorkingSet[] workingSets = getContainer().getSelectedWorkingSets();
        return FileTextSearchScope.newSearchScope(workingSets, getExtensions(), fSearchDerived);
    default:
        // unknown scope
        return FileTextSearchScope.newWorkspaceScope(getExtensions(), fSearchDerived);
    }
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:18,代码来源:UrnSearchPage.java


示例3: createTextSearchScope

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
public FileTextSearchScope createTextSearchScope() {
  // Setup search scope
  switch (getContainer().getSelectedScope()) {
    case ISearchPageContainer.WORKSPACE_SCOPE:
      return FileTextSearchScope.newWorkspaceScope(getExtensions(), false);
    case ISearchPageContainer.SELECTION_SCOPE:
      return getSelectedResourcesScope();
    case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
      return getEnclosingProjectScope();
    case ISearchPageContainer.WORKING_SET_SCOPE:
      IWorkingSet[] workingSets = getContainer().getSelectedWorkingSets();
      return FileTextSearchScope.newSearchScope(workingSets, getExtensions(), false);
    default:
      // unknown scope
      return FileTextSearchScope.newWorkspaceScope(getExtensions(), false);
  }
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:18,代码来源:GoSearchPage.java


示例4: createRenameChangeForTestImplementation

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的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


示例5: createRenameChangeForTestInterface

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的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


示例6: createMoveChangeForTestImplementation

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的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


示例7: createMoveChangeForTestInterface

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的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


示例8: findInWorkspace

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
/**
 * The active editor's project is used as the search scope
 */
public static void findInWorkspace(final String searchText, final boolean caseSensitive, final boolean wholeWord,
		final boolean isRegEx, IStatusLineManager statusLineManager)
{
	if (getActivePage(statusLineManager) == null)
	{
		return;
	}

	performFind(searchText, caseSensitive, isRegEx, FileTextSearchScope.newSearchScope(
			new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, new String[] { "*" }, true)); //$NON-NLS-1$
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:15,代码来源:FindHelper.java


示例9: performFind

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
private static void performFind(final String searchText, final boolean caseSensitive, final boolean isRegEx,
		final FileTextSearchScope searchScope)
{
	try
	{
		ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput()
		{

			public boolean isRegExSearch()
			{
				return isRegEx;
			}

			public boolean isCaseSensitiveSearch()
			{
				return caseSensitive;
			}

			public String getSearchText()
			{
				return searchText;
			}

			public FileTextSearchScope getScope()
			{
				return searchScope; //$NON-NLS-1$
			}
		});
		NewSearchUI.runQueryInBackground(query);
	}
	catch (CoreException e1)
	{
		FindBarPlugin.log(e1);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:36,代码来源:FindHelper.java


示例10: editFullyQualifiedRef

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
private void editFullyQualifiedRef(RefactoringStatus result)
{
	String[] fileNamePatterns = new String[]{
		"*.xml"
	};
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[]{
		info.getProject().getProject()
	}, fileNamePatterns, false);
	XmlAttrEditRequestor requestor = new XmlAttrEditRequestor("refid",
		"\"" + info.getNamespace() + "." + info.getNewId() + "\"", editsPerFiles);
	Pattern pattern = Pattern
		.compile("\"" + info.getNamespace() + "." + info.getOldId() + "\"");
	TextSearchEngine.create().search(scope, requestor, pattern, monitor);
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:15,代码来源:SqlRenameEditCollector.java


示例11: editXmlFullyQualifiedRef

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
private void editXmlFullyQualifiedRef(RefactoringStatus result)
{
	String[] fileNamePatterns = new String[]{
		"*.xml"
	};
	FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[]{
		info.getProject().getProject()
	}, fileNamePatterns, false);
	XmlAttrEditRequestor requestor = new XmlAttrEditRequestor(
		Arrays.asList("resultMap", "extends"), info.getNamespace() + "." + info.getNewId(),
		editsPerFiles);
	Pattern pattern = Pattern.compile(info.getNamespace() + "." + info.getOldId());
	TextSearchEngine.create().search(scope, requestor, pattern, monitor);
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:15,代码来源:ResultMapRenameEditCollector.java


示例12: getInputObject

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
@Override
protected FileTextSearchScope getInputObject(ITextEditor editor) {
	// TODO Auto-generated method stub
	IResource file = getCurrentResource(editor);
	if (file != null) {
		return FileTextSearchScope.newSearchScope(new IResource[]{file}, new String[]{((IFile)file).getName()}, false);
	} else {
		return super.getInputObject(editor);
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:11,代码来源:OccurHandler.java


示例13: getInputObject

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
/**
 * Set up project search scope
 * 
 * @see com.mulgasoft.emacsplus.commands.TagsSearchHandler#getInputObject(org.eclipse.ui.texteditor.ITextEditor)
 */
protected FileTextSearchScope getInputObject(ITextEditor editor) {
	IProject project= getCurrentProject(editor);
	if (project != null) {
		return FileTextSearchScope.newSearchScope(new IProject[] { project }, new String[0], false);			
	} else {
		return super.getInputObject(editor);
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:14,代码来源:TagsProjectHandler.java


示例14: getInputObject

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
/**
 * Set up working set scope, if present, else workspace
 * 
 * @see com.mulgasoft.emacsplus.commands.TagsSearchHandler#getInputObject(org.eclipse.ui.texteditor.ITextEditor)
 */
protected FileTextSearchScope getInputObject(ITextEditor editor) {
	IWorkingSet set = (wset != null ? wset : getWorkingSet(editor));
	if (set != null) {
		return FileTextSearchScope.newSearchScope(new IWorkingSet[] { set }, new String[0], false);			
	} else {
		return super.getInputObject(editor);
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:14,代码来源:TagsSetHandler.java


示例15: AbstractPythonSearchQuery

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
public AbstractPythonSearchQuery(String searchText, boolean isRegEx, boolean isCaseSensitive, boolean isWholeWord,
        FileTextSearchScope scope) {
    fSearchText = searchText;
    fIsRegEx = isRegEx;
    fIsCaseSensitive = isCaseSensitive;
    fIsWholeWord = isWholeWord;
    fScope = scope;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:9,代码来源:AbstractPythonSearchQuery.java


示例16: getEnclosingProjectScope

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
private FileTextSearchScope getEnclosingProjectScope() {
    String[] enclosingProjectName = getContainer().getSelectedProjectNames();
    if (enclosingProjectName == null) {
        return FileTextSearchScope.newWorkspaceScope(getExtensions(), fSearchDerived);
    }

    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IResource[] res = new IResource[enclosingProjectName.length];
    for (int i = 0; i < res.length; i++) {
        res[i] = root.getProject(enclosingProjectName[i]);
    }

    return FileTextSearchScope.newSearchScope(res, getExtensions(), fSearchDerived);
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:15,代码来源:UrnSearchPage.java


示例17: TextSearchPageInput

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
public TextSearchPageInput(String searchText, boolean isCaseSensitive, boolean isRegEx,
    FileTextSearchScope scope) {
  fSearchText = searchText;
  fIsCaseSensitive = isCaseSensitive;
  fIsRegEx = isRegEx;
  fScope = scope;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:8,代码来源:GoSearchPage.java


示例18: getEnclosingProjectScope

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
private FileTextSearchScope getEnclosingProjectScope() {
  String[] enclosingProjectName = getContainer().getSelectedProjectNames();
  if (enclosingProjectName == null) {
    return FileTextSearchScope.newWorkspaceScope(getExtensions(), false);
  }

  IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
  IResource[] res = new IResource[enclosingProjectName.length];
  for (int i = 0; i < res.length; i++) {
    res[i] = root.getProject(enclosingProjectName[i]);
  }

  return FileTextSearchScope.newSearchScope(res, getExtensions(), false);
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:15,代码来源:GoSearchPage.java


示例19: getSearchScope

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
public FileTextSearchScope getSearchScope() {
    return fScope;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:4,代码来源:AbstractPythonSearchQuery.java


示例20: findInOpenDocuments

import org.eclipse.search.ui.text.FileTextSearchScope; //导入依赖的package包/类
/**
 * Here, all the editors available will be gotten and searched (if possible).
 *
 * Note that editors that are not in the workspace may not be searched (it should be possible
 * to do, but one may have to reimplement large portions of the search for that to work).
 */
public static void findInOpenDocuments(final String searchText, final boolean caseSensitive,
        final boolean wholeWord, final boolean isRegEx, IStatusLineManager statusLineManager) {

    final List<Object> opened = EditorUtils.getFilesInOpenEditors(statusLineManager);
    final List<IFile> files = new ArrayList<>(opened.size());
    for (Object object : opened) {
        if (object instanceof IFile) {
            files.add((IFile) object);
        }
    }

    if (files.size() == 0) {
        if (statusLineManager != null) {
            statusLineManager
                    .setMessage(
                            "No file was found to perform the search (editors not in the workspace cannot be searched).");
        }
        return;
    }

    try {
        ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput() {

            @Override
            public boolean isRegExSearch() {
                return isRegEx;
            }

            @Override
            public boolean isCaseSensitiveSearch() {
                return caseSensitive;
            }

            @Override
            public String getSearchText() {
                return searchText;
            }

            @Override
            public FileTextSearchScope getScope() {
                return FileTextSearchScope.newSearchScope(files.toArray(new IResource[files.size()]),
                        new String[] { "*" }, true);
            }
        });
        NewSearchUI.runQueryInBackground(query);
    } catch (CoreException e1) {
        Log.log(e1);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:56,代码来源:FindInOpenDocuments.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ResponseDefinition类代码示例发布时间:2022-05-22
下一篇:
Java FastJsonObjectOutput类代码示例发布时间: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