public class NewSearchUI extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_SET_ID
Id of the Search action set
(value
"org.eclipse.search.searchActionSet" ). |
static String |
PLUGIN_ID
Search Plug-in Id (value
"org.eclipse.search" ). |
static String |
SEARCH_MARKER
Search marker type (value
"org.eclipse.search.searchmarker" ). |
static String |
SEARCH_VIEW_ID
Id of the new Search view
(value
"org.eclipse.search.ui.views.SearchView" ). |
Constructor and Description |
---|
NewSearchUI() |
Modifier and Type | Method and Description |
---|---|
static ISearchResultViewPart |
activateSearchResultView()
Activates a search result view in the current workbench window page.
|
static void |
addQueryListener(IQueryListener l)
Registers the given listener to receive notification of changes to
queries.
|
static boolean |
arePotentialMatchesIgnored()
Returns the preference whether a search engine is
allowed to report potential matches or not.
|
static void |
cancelQuery(ISearchQuery query)
Sends a 'cancel' command to the given query running in background.
|
static String |
getDefaultPerspectiveId()
Returns the ID of the default perspective.
|
static ISearchQuery[] |
getQueries()
Returns all search queries know to the search UI (i.e. registered via
runQuery() or runQueryInForeground()) . |
static ISearchResultViewPart |
getSearchResultView()
Gets the search result view shown in the current workbench window.
|
static boolean |
isQueryRunning(ISearchQuery query)
Returns whether the given query is currently running.
|
static void |
openSearchDialog(IWorkbenchWindow window,
String pageId)
Opens the search dialog.
|
static void |
removeQuery(ISearchQuery query)
Removes the given search query.
|
static void |
removeQueryListener(IQueryListener l)
Removes the given query listener.
|
static boolean |
reuseEditor()
Returns the preference whether editors should be reused
when showing search results.
|
static void |
runQuery(ISearchQuery query)
Deprecated.
deprecated in 3.1.
Use
runQueryInBackground(ISearchQuery) to run a query in background
or runQueryInForeground(IRunnableContext, ISearchQuery) to run it in foreground |
static void |
runQueryInBackground(ISearchQuery query)
Runs the given search query.
|
static void |
runQueryInBackground(ISearchQuery query,
ISearchResultViewPart view)
Runs the given search query.
|
static IStatus |
runQueryInForeground(IRunnableContext context,
ISearchQuery query)
Runs the given search query.
|
static IStatus |
runQueryInForeground(IRunnableContext context,
ISearchQuery query,
ISearchResultViewPart view)
Runs the given search query.
|
public static final String PLUGIN_ID
"org.eclipse.search"
).public static final String SEARCH_MARKER
"org.eclipse.search.searchmarker"
).IMarker
,
Constant Field Valuespublic static final String SEARCH_VIEW_ID
"org.eclipse.search.ui.views.SearchView"
).public static final String ACTION_SET_ID
"org.eclipse.search.searchActionSet"
).public static ISearchResultViewPart activateSearchResultView()
null
if the
search result view couldn't be activatedpublic static ISearchResultViewPart getSearchResultView()
null
, if none is open
in the current workbench window page@Deprecated public static void runQuery(ISearchQuery query)
runQueryInBackground(ISearchQuery)
to run a query in background
or runQueryInForeground(IRunnableContext, ISearchQuery)
to run it in foregroundISearchQuery#canRunInBackground()
returns true
. Running a query adds it to the set of known
queries and notifies any registered IQueryListener
s about
the addition.query
- the query to executepublic static void runQueryInBackground(ISearchQuery query) throws IllegalArgumentException
IQueryListener
s about the addition.
The search view that shows the result will be activated. That means a call
to activateSearchResultView()
is not required.
query
- the query to execute. The query must be able to run in background, that means
ISearchQuery.canRunInBackground()
must be true
IllegalArgumentException
- Thrown when the passed query is not able to run in backgroundpublic static void runQueryInBackground(ISearchQuery query, ISearchResultViewPart view) throws IllegalArgumentException
IQueryListener
s 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.
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 null
is passed in, the default activation
mechanism is used to open a new result view or to select the view to be reused.IllegalArgumentException
- Thrown when the passed query is not able to run in backgroundpublic static IStatus runQueryInForeground(IRunnableContext context, ISearchQuery query)
IQueryListener
s 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.
context
- the runnable context to run the query inquery
- the query to executeIStatus.CANCEL
to signal
that the query was canceled.public static IStatus runQueryInForeground(IRunnableContext context, ISearchQuery query, ISearchResultViewPart view)
IQueryListener
s 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.
context
- the runnable context to run the query inquery
- the query to executeview
- the search result view to show the result in. If null
is passed in, the default activation
mechanism is used to open a new result view or to select the view to be reused.IStatus.CANCEL
to signal
that the query was canceled.public static void addQueryListener(IQueryListener l)
l
- the listener to be addedpublic static void removeQueryListener(IQueryListener l)
l
- the listener to be removed.public static ISearchQuery[] getQueries()
runQuery()
or runQueryInForeground())
.public static boolean isQueryRunning(ISearchQuery query)
query
- the queryrunQueryInBackground(ISearchQuery)
,
runQueryInForeground(IRunnableContext, ISearchQuery)
public static void cancelQuery(ISearchQuery query)
query
- the querypublic static void removeQuery(ISearchQuery query)
query
- the query to be removedpublic static void openSearchDialog(IWorkbenchWindow window, String pageId)
pageId
is specified and a corresponding page
is found then it is brought to top.window
- the parent windowpageId
- the page to select or null
if the best fitting page should be selectedpublic static boolean reuseEditor()
true
if editors should be reused for showing search resultspublic static boolean arePotentialMatchesIgnored()
Search engines which can report inexact matches must
respect this preference i.e. they should not report
inexact matches if this method returns true
true
if search engine must not report inexact matchespublic static String getDefaultPerspectiveId()
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.
null
if no default perspective is set
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.