org.eclipse.xtext.ui.editor.findrefs
Class ReferenceQuery

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.findrefs.ReferenceQuery
All Implemented Interfaces:
org.eclipse.search.ui.ISearchQuery

public class ReferenceQuery
extends java.lang.Object
implements org.eclipse.search.ui.ISearchQuery

Author:
Jan Koehnlein - Initial contribution and API

Field Summary
protected  EditorResourceAccess localContextProvider
           
 
Constructor Summary
ReferenceQuery()
           
 
Method Summary
 boolean canRerun()
          Returns whether the query can be run more than once.
 boolean canRunInBackground()
          Returns whether this query can be run in the background.
protected  ReferenceSearchResult createSearchResult()
           
 java.lang.String getLabel()
          Returns a user readable label for this query.
 org.eclipse.search.ui.ISearchResult getSearchResult()
          Returns the search result associated with this query.
 void init(IReferenceFinder.IQueryData queryData)
           
 org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
          This is the method that actually does the work, i.e. finds the results of the search query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localContextProvider

@Inject
protected EditorResourceAccess localContextProvider
Constructor Detail

ReferenceQuery

public ReferenceQuery()
Method Detail

init

public void init(IReferenceFinder.IQueryData queryData)

canRerun

public boolean canRerun()
Description copied from interface: org.eclipse.search.ui.ISearchQuery
Returns whether the query can be run more than once. Some queries may depend on transient information and return false.

Specified by:
canRerun in interface org.eclipse.search.ui.ISearchQuery
Returns:
whether this query can be run more than once

canRunInBackground

public boolean canRunInBackground()
Description copied from interface: org.eclipse.search.ui.ISearchQuery
Returns whether this query can be run in the background. Note that queries must do proper locking when they are run in the background (e.g. get the appropriate workspace locks).

Specified by:
canRunInBackground in interface org.eclipse.search.ui.ISearchQuery
Returns:
whether this query can be run in the background

getLabel

public java.lang.String getLabel()
Description copied from interface: org.eclipse.search.ui.ISearchQuery
Returns a user readable label for this query. This will be used, for example to set the Job name if this query is executed in the background. Note that progress notification (for example, the number of matches found) should be done via the progress monitor passed into the run(IProgressMonitor) method

Specified by:
getLabel in interface org.eclipse.search.ui.ISearchQuery
Returns:
the user readable label of this query

getSearchResult

public org.eclipse.search.ui.ISearchResult getSearchResult()
Description copied from interface: org.eclipse.search.ui.ISearchQuery
Returns the search result associated with this query. This method can be called before run is called.

Specified by:
getSearchResult in interface org.eclipse.search.ui.ISearchQuery
Returns:
this query's search result

run

public org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
                                     throws org.eclipse.core.runtime.OperationCanceledException
Description copied from interface: org.eclipse.search.ui.ISearchQuery
This is the method that actually does the work, i.e. finds the results of the search query.

Specified by:
run in interface org.eclipse.search.ui.ISearchQuery
Parameters:
monitor - the progress monitor to be used
Returns:
the status after completion of the search job.
Throws:
org.eclipse.core.runtime.OperationCanceledException - Thrown when the search query has been canceled.

createSearchResult

protected ReferenceSearchResult createSearchResult()