本文整理汇总了Java中org.eclipse.search.ui.text.FileTextSearchScope.newSearchScope方法的典型用法代码示例。如果您正苦于以下问题:Java FileTextSearchScope.newSearchScope方法的具体用法?Java FileTextSearchScope.newSearchScope怎么用?Java FileTextSearchScope.newSearchScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.search.ui.text.FileTextSearchScope
的用法示例。
在下文中一共展示了FileTextSearchScope.newSearchScope方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例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(), 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);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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);
}
示例13: 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);
}