public abstract class SearchInfoDefinition extends Object
FileObjects should be searched. Iterator returned by this
interface's method enumerates
FileObjects that should be searched.
SearchInfoDefinition objects are used in
action Find in Projects. Action obtains
SearchInfoDefinition from
Lookup
of nodes or projects the action was invoked on.
SubTreeSearchOptions).
In most cases, you do not need to create custom implementation. You can
use some factory method in SearchInfoDefinitionFactory.
Example:
import org.openide.util.lookup.Lookups;
public class MyNode extends AbstractNode {
public MyNode(FileObject folder) {
super(new MyNodeChildren(folder),
Lookups.singleton(
SearchInfoDescriptionFactory.createSearchInfo(
folder,
new SearchFilterDescription[] {
SearchInfoDescriptionFactory.VISIBILITY_FILTER
}
)
);
)
}
...
}
| Constructor and Description |
|---|
SearchInfoDefinition() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
canSearch()
Determines whether the object which provided this
SearchInfo can be searched. |
abstract Iterator<FileObject> |
filesToSearch(SearchScopeOptions options,
SearchListener listener,
AtomicBoolean terminated)
Specifies which
FileObjects should be searched. |
abstract List<SearchRoot> |
getSearchRoots()
Returns list of files or folders where the search starts.
|
Iterator<URI> |
urisToSearch(SearchScopeOptions options,
SearchListener listener,
AtomicBoolean terminated)
Specifies which
URIss should be searched. |
public abstract boolean canSearch()
SearchInfo can be searched. This method determines whether
the Find action should be enabled for the object or not.
This method must be very quick as it may be called frequently and its
speed may influence responsiveness of the whole application. If the exact
algorithm for determination of the result value should be slow, it is
better to return
true than make the method slow.false if the object is known that it cannot be searched;
true otherwise@NonNull public abstract Iterator<FileObject> filesToSearch(@NonNull SearchScopeOptions options, @NonNull SearchListener listener, @NonNull AtomicBoolean terminated)
FileObjects should be searched. The returned
Iterator needn't implement method remove()
(i.e. it may throw
UnsupportedOperationException instead of actual
implementation).options - File name pattern, traversing options and custom filters.listener - Listener that should be notified about important events
and progress.terminated - Object that can be asked whether the search has
been terminated by the user.FileObjects to be searched@NonNull public abstract List<SearchRoot> getSearchRoots()
@NonNull public Iterator<URI> urisToSearch(@NonNull SearchScopeOptions options, @NonNull SearchListener listener, @NonNull AtomicBoolean terminated)
URIss should be searched. The returned
Iterator needn't implement method
remove() (i.e. it may throw
UnsupportedOperationException instead of actual
implementation).
The default implementation uses internaly FileObject iterator returned by
SearchInfoDefinition.filesToSearch(SearchScopeOptions, SearchListener, AtomicBoolean)options - File name pattern, traversing options and custom filters.listener - Listener that should be notified about important events
and progress.terminated - Object that can be asked whether the search has been
terminated by the user.FileObjects to be searched