Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.search.ui
Class NewSearchUI

java.lang.Object
  extended by 
org.eclipse.search.ui.NewSearchUI

public class NewSearchUI
extends Object

A facade for access to the new search UI facilities.

Since:
3.0

Field Summary
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 Summary
NewSearchUI ()
           
 
Method Summary
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.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_ID

public static final 
String PLUGIN_ID
Search Plug-in Id (value "org.eclipse.search").

See Also:
Constant Field Values

SEARCH_MARKER

public static final 
String SEARCH_MARKER
Search marker type (value "org.eclipse.search.searchmarker").

See Also:
IMarker, Constant Field Values

SEARCH_VIEW_ID

public static final 
String SEARCH_VIEW_ID
Id of the new Search view (value "org.eclipse.search.ui.views.SearchView").

See Also:
Constant Field Values

ACTION_SET_ID

public static final 
String ACTION_SET_ID
Id of the Search action set (value "org.eclipse.search.searchActionSet").

See Also:
Constant Field Values
Constructor Detail

NewSearchUI

public NewSearchUI()
Method Detail

activateSearchResultView

public static 
ISearchResultViewPart activateSearchResultView()
Activates 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 null if the search result view couldn't be activated

getSearchResultView

public static 
ISearchResultViewPart getSearchResultView()
Gets 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

runQuery

public 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

Runs the given search query. This method may run the given query in a separate thread if ISearchQuery#canRunInBackground() returns true. Running a query adds it to the set of known queries and notifies any registered IQueryListeners about the addition.

Parameters:
query - the query to execute

runQueryInBackground

public static void runQueryInBackground(
ISearchQuery query)
                                 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 registered IQueryListeners 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

runQueryInBackground

public 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 registered IQueryListeners 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 null is 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

runQueryInForeground

public static 
IStatus runQueryInForeground(
IRunnableContext context,
                                           
ISearchQuery query)
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 registered IQueryListeners 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.CANCEL to signal that the query was canceled.

runQueryInForeground

public 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 registered IQueryListeners 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 null is 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.CANCEL to signal that the query was canceled.
Since:
3.2

addQueryListener

public static void addQueryListener(
IQueryListener l)
Registers 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

removeQueryListener

public static void removeQueryListener(
IQueryListener l)
Removes the given query listener. Does nothing if the listener is not present.

Parameters:
l - the listener to be removed.

getQueries

public static 
ISearchQuery[] getQueries()
Returns all search queries know to the search UI (i.e. registered via runQuery() or runQueryInForeground()).

Returns:
all search results

isQueryRunning

public static boolean isQueryRunning(
ISearchQuery query)
Returns 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:
runQueryInBackground(ISearchQuery), runQueryInForeground(IRunnableContext, ISearchQuery)

cancelQuery

public static void cancelQuery(
ISearchQuery query)
Sends 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

removeQuery

public static void removeQuery(
ISearchQuery query)
Removes the given search query.

Parameters:
query - the query to be removed
Since:
3.5

openSearchDialog

public static void openSearchDialog(
IWorkbenchWindow window,
                                    
String pageId)
Opens the search dialog. If pageId is specified and a corresponding page is found then it is brought to top.

Parameters:
window - the parent window
pageId - the page to select or null if the best fitting page should be selected

reuseEditor

public 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:
true if editors should be reused for showing search results

arePotentialMatchesIgnored

public 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:
true if search engine must not report inexact matches

getDefaultPerspectiveId

public static 
String getDefaultPerspectiveId()
Returns 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 null if no default perspective is set

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire