Class NewSearchUI
- Since:
- 3.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringId of the Search action set (value"org.eclipse.search.searchActionSet").static final StringSearch Plug-in Id (value"org.eclipse.search").static final StringSearch marker type (value"org.eclipse.search.searchmarker").static final StringId of the new Search view (value"org.eclipse.search.ui.views.SearchView").
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic ISearchResultViewPartActivates a search result view in the current workbench window page.static voidRegisters the given listener to receive notification of changes to queries.static booleanReturns the preference whether a search engine is allowed to report potential matches or not.static voidcancelQuery(ISearchQuery query) Sends a 'cancel' command to the given query running in background.static StringReturns the ID of the default perspective.static ISearchQuery[]Returns all search queries know to the search UI (i.e. registered viarunQuery()orrunQueryInForeground()).static ISearchResultViewPartGets the search result view shown in the current workbench window.static booleanisQueryRunning(ISearchQuery query) Returns whether the given query is currently running.static voidopenSearchDialog(IWorkbenchWindow window, String pageId) Opens the search dialog.static voidremoveQuery(ISearchQuery query) Removes the given search query.static voidRemoves the given query listener.static booleanReturns the preference whether editors should be reused when showing search results.static voidrunQuery(ISearchQuery query) Deprecated.deprecated in 3.1.static voidrunQueryInBackground(ISearchQuery query) Runs the given search query.static voidrunQueryInBackground(ISearchQuery query, ISearchResultViewPart view) Runs the given search query.static IStatusrunQueryInForeground(IRunnableContext context, ISearchQuery query) Runs the given search query.static IStatusrunQueryInForeground(IRunnableContext context, ISearchQuery query, ISearchResultViewPart view) Runs the given search query.
- 
Field Details- 
PLUGIN_IDSearch Plug-in Id (value"org.eclipse.search").- See Also:
 
- 
SEARCH_MARKERSearch marker type (value"org.eclipse.search.searchmarker").- See Also:
 
- 
SEARCH_VIEW_IDId of the new Search view (value"org.eclipse.search.ui.views.SearchView").- See Also:
 
- 
ACTION_SET_IDId of the Search action set (value"org.eclipse.search.searchActionSet").- See Also:
 
 
- 
- 
Constructor Details- 
NewSearchUIpublic NewSearchUI()
 
- 
- 
Method Details- 
activateSearchResultViewActivates a search result view in the current workbench window page. If a search view is already open in the current workbench window page, it is activated. Otherwise a new search view is opened and activated.- Returns:
- the activate search result view or nullif the search result view couldn't be activated
 
- 
getSearchResultViewGets the search result view shown in the current workbench window.- Returns:
- the search result view or null, if none is open in the current workbench window page
 
- 
runQueryDeprecated.deprecated in 3.1. UserunQueryInBackground(ISearchQuery)to run a query in background orrunQueryInForeground(IRunnableContext, ISearchQuery)to run it in foregroundRuns the given search query. This method may run the given query in a separate thread ifISearchQuery#canRunInBackground()returnstrue. Running a query adds it to the set of known queries and notifies any registeredIQueryListeners about the addition.- Parameters:
- query- the query to execute
 
- 
runQueryInBackgroundRuns the given search query. This method will execute the query in a background thread and not block until the search is finished. Running a query adds it to the set of known queries and notifies any registeredIQueryListeners about the addition.The search view that shows the result will be activated. That means a call to activateSearchResultView()is not required.- Parameters:
- query- the query to execute. The query must be able to run in background, that means- ISearchQuery.canRunInBackground()must be- true
- Throws:
- IllegalArgumentException- Thrown when the passed query is not able to run in background
- Since:
- 3.1
 
- 
runQueryInBackgroundpublic static void runQueryInBackground(ISearchQuery query, ISearchResultViewPart view) throws IllegalArgumentException Runs the given search query. This method will execute the query in a background thread and not block until the search is finished. Running a query adds it to the set of known queries and notifies any registeredIQueryListeners about the addition.The result will be shown in the given search result view which will be activated. A call to to activateSearchResultView()is not required.- Parameters:
- query- the query to execute. The query must be able to run in background, that means- ISearchQuery.canRunInBackground()must be- true
- view- the search result view to show the result in. If- nullis passed in, the default activation mechanism is used to open a new result view or to select the view to be reused.
- Throws:
- IllegalArgumentException- Thrown when the passed query is not able to run in background
- Since:
- 3.2
 
- 
runQueryInForegroundRuns the given search query. This method will execute the query in the same thread as the caller. This method blocks until the query is finished. Running a query adds it to the set of known queries and notifies any registeredIQueryListeners about the addition.The result will be shown in a search view that will be activated. That means a call to activateSearchResultView()is not required.- Parameters:
- context- the runnable context to run the query in
- query- the query to execute
- Returns:
- a status indicating whether the query ran correctly, including IStatus.CANCELto signal that the query was canceled.
 
- 
runQueryInForegroundpublic static IStatus runQueryInForeground(IRunnableContext context, ISearchQuery query, ISearchResultViewPart view) Runs the given search query. This method will execute the query in the same thread as the caller. This method blocks until the query is finished. Running a query adds it to the set of known queries and notifies any registeredIQueryListeners about the addition.The result will be shown in the given search result view which will be activated. A call to to activateSearchResultView()is not required.- Parameters:
- context- the runnable context to run the query in
- query- the query to execute
- view- the search result view to show the result in. If- nullis passed in, the default activation mechanism is used to open a new result view or to select the view to be reused.
- Returns:
- a status indicating whether the query ran correctly, including IStatus.CANCELto signal that the query was canceled.
- Since:
- 3.2
 
- 
addQueryListenerRegisters the given listener to receive notification of changes to queries. The listener will be notified whenever a query has been added, removed, is starting or has finished. Has no effect if an identical listener is already registered.- Parameters:
- l- the listener to be added
 
- 
removeQueryListenerRemoves the given query listener. Does nothing if the listener is not present.- Parameters:
- l- the listener to be removed.
 
- 
getQueriesReturns all search queries know to the search UI (i.e. registered viarunQuery()orrunQueryInForeground()).- Returns:
- all search results
 
- 
isQueryRunningReturns whether the given query is currently running. Queries may be run by client request or by actions in the search UI.- Parameters:
- query- the query
- Returns:
- whether the given query is currently running
- See Also:
 
- 
cancelQuerySends a 'cancel' command to the given query running in background. The call has no effect if the query is not running, not in background or is not cancelable.- Parameters:
- query- the query
- Since:
- 3.1
 
- 
removeQueryRemoves the given search query.- Parameters:
- query- the query to be removed
- Since:
- 3.5
 
- 
openSearchDialogOpens the search dialog. IfpageIdis specified and a corresponding page is found then it is brought to top.- Parameters:
- window- the parent window
- pageId- the page to select or- nullif the best fitting page should be selected
 
- 
reuseEditorpublic static boolean reuseEditor()Returns the preference whether editors should be reused when showing search results. The goto action can decide to use or ignore this preference.- Returns:
- trueif editors should be reused for showing search results
 
- 
arePotentialMatchesIgnoredpublic static boolean arePotentialMatchesIgnored()Returns the preference whether a search engine is allowed to report potential matches or not.Search engines which can report inexact matches must respect this preference i.e. they should not report inexact matches if this method returns true- Returns:
- trueif search engine must not report inexact matches
 
- 
getDefaultPerspectiveIdReturns the ID of the default perspective.The perspective with this ID will be used to show the Search view. If no default perspective is set then the Search view will appear in the current perspective. - Returns:
- the ID of the default perspective nullif no default perspective is set
 
 
-