# Class TextSearchQueryProvider

java.lang.Object
org.eclipse.search.ui.text.TextSearchQueryProvider

public abstract class TextSearchQueryProvider extends Object
Abstract base class for text search query providers supplied via the `org.eclipse.search.textSearchQueryProvider` extension point. The plug-in preference `org.eclipse.search.textSearchQueryProvider` defines the preferred query provider. It is intended that only products choose a preferred query provider.

Since:
  3.2

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`TextSearchQueryProvider.TextSearchInput`
Specified the input for a search query.

## Constructor Summary

Constructors
Constructor
Description
`TextSearchQueryProvider()`

## Method Summary

Modifier and Type
Method
Description
`abstract ISearchQuery`
`createQuery(String selectedText)`
Create a query to search for the selected text in the workspace.
`abstract ISearchQuery`
`createQuery(String selectedText, IResource[] resources)`
Create a query to search for the selected text in the given resources.
`abstract ISearchQuery`
`createQuery(String selectedText, IWorkingSet[] ws)`
Create a query to search for the selected text in the given working sets.
`abstract ISearchQuery`
`createQuery(TextSearchQueryProvider.TextSearchInput textSearchInput)`
Create a query for the input with the given information.
`static TextSearchQueryProvider`
`getPreferred()`
Returns the preferred query provider.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TextSearchQueryProvider

public TextSearchQueryProvider()

## Method Details

### getPreferred

public static TextSearchQueryProvider getPreferred()
Returns the preferred query provider. The preferred query provider is typically configured by the product and defined by the search plug-in preference 'org.eclipse.search.textSearchQueryProvider'. It is not intended that query providers change at runtime, but clients should always use this method to access the query provider.

Returns:
  the preferred `TextSearchQueryProvider`.

### createQuery

public abstract ISearchQuery createQuery(TextSearchQueryProvider.TextSearchInput textSearchInput) throws CoreException
Create a query for the input with the given information.

Parameters:
  `textSearchInput` - the search input
Returns:
  returns the created search query
Throws:
  `CoreException` - a `CoreException` can be thrown when the query provider can not create a query for the given input.

### createQuery

public abstract ISearchQuery createQuery(String selectedText) throws CoreException
Create a query to search for the selected text in the workspace.

Parameters:
  `selectedText` - the text to search for
Returns:
  returns the created search query
Throws:
  `CoreException` - a `CoreException` can be thrown when the query provider can not create a query for the given input.

### createQuery

public abstract ISearchQuery createQuery(String selectedText, IResource[] resources) throws CoreException
Create a query to search for the selected text in the given resources.

Parameters:
  `selectedText` - the text to search for
  `resources` - the resources to search in
Returns:
  returns the created search query
Throws:
  `CoreException` - a `CoreException` can be thrown when the query provider can not create a query for the given input.

### createQuery

public abstract ISearchQuery createQuery(String selectedText, IWorkingSet[] ws) throws CoreException
Create a query to search for the selected text in the given working sets.

Parameters:
  `selectedText` - the text to search for
  `ws` - the working sets to search in
Returns:
  returns the created search query
Throws:
  `CoreException` - a `CoreException` can be thrown when the query provider can not create a query for the given input.