Java Code Examples for org.eclipse.search.ui.text.FileTextSearchScope#newWorkspaceScope()

The following examples show how to use org.eclipse.search.ui.text.FileTextSearchScope#newWorkspaceScope() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModulaSearchPage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public FileTextSearchScope createTextSearchScope() {
    // Setup search scope
    switch (container.getSelectedScope()) {
        case ISearchPageContainer.WORKSPACE_SCOPE:
            return FileTextSearchScope.newWorkspaceScope(new String[]{"*"}, false); //$NON-NLS-1$
        case ISearchPageContainer.SELECTION_SCOPE:
            return getSelectedResourcesScope();
        case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
            return getEnclosingProjectScope();
        case ISearchPageContainer.WORKING_SET_SCOPE:
            IWorkingSet[] workingSets= container.getSelectedWorkingSets();
            return FileTextSearchScope.newSearchScope(workingSets, new String[]{"*"}, false); //$NON-NLS-1$
        default:
            // unknown scope
            return FileTextSearchScope.newWorkspaceScope(new String[]{"*"}, false); //$NON-NLS-1$
    }
}
 
Example 2
Source File: GoSearchPage.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
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);
  }
}
 
Example 3
Source File: SearchWholeWordInProjectAction.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public FileTextSearchScope getScope() {
	IFile activeIFile = WorkbenchUtils.getActiveFile();
	if (activeIFile != null) {
		return FileTextSearchScope.newSearchScope(
				new IResource[] { activeIFile.getProject() },
				new String[] { "*.*" }, false); //$NON-NLS-1$
	}
	else{
		return FileTextSearchScope.newWorkspaceScope(new String[]{"*.*"}, false); //$NON-NLS-1$
	}
}
 
Example 4
Source File: ModulaSearchPage.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private FileTextSearchScope getEnclosingProjectScope() {
    String[] enclosingProjectName= container.getSelectedProjectNames();
    if (enclosingProjectName == null) {
        return FileTextSearchScope.newWorkspaceScope(new String[]{"*"}, false); //$NON-NLS-1$
    }

    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, new String[]{"*"}, false); //$NON-NLS-1$
}
 
Example 5
Source File: GoSearchPage.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: SearchWholeWordInWorkspaceAction.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public FileTextSearchScope getScope() {
	return FileTextSearchScope.newWorkspaceScope(new String[]{"*.*"}, false); //$NON-NLS-1$
}
 
Example 7
Source File: TagsSearchHandler.java    From e4macs with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Search workspace by default
 * 
 * @param editor
 * @return a workspace scope object
 */
protected FileTextSearchScope getInputObject(ITextEditor editor) {
	return FileTextSearchScope.newWorkspaceScope(new String[0], false);
}