public final class SearchInfoUtils extends Object
Modifier and Type | Field and Description |
---|---|
static List<SearchFilter> |
DEFAULT_FILTERS
Immutable list of default search filters.
|
static SearchFilter |
SHARABILITY_FILTER
Filter for skipping unsharable files.
|
static SearchFilter |
VISIBILITY_FILTER
Filter for skipping invisible files.
|
Constructor and Description |
---|
SearchInfoUtils() |
Modifier and Type | Method and Description |
---|---|
static SearchInfo |
createCompoundSearchInfo(SearchInfo... delegates)
Creates a
SearchInfo compound of the given delegates. |
static SearchInfo |
createEmptySearchInfo()
Create a SearchInfo instance that is always unsearchable.
|
static SearchInfo |
createForDefinition(SearchInfoDefinition definition)
Create a new SearchInfo for a
SearchInfoDefinition instance. |
static SearchInfo |
createSearchInfoForRoot(FileObject root)
Create a search info for a FileObject.
|
static SearchInfo |
createSearchInfoForRoots(FileObject[] roots)
Create a search info for an array of FileObjects.
|
static SearchInfo |
createSearchInfoForRoots(FileObject[] roots,
boolean useDefaultFilters,
SearchFilterDefinition... extraFilters)
Create a search info for an array of FileObjects.
|
static SearchInfo |
findDefinedSearchInfo(Node node)
Get a search info for a node, if it was explicitly defined in node's
lookup, or in lookup of a ancestor node.
|
static SearchInfo |
getSearchInfoForNode(Node node)
Gets a search info for node.
|
public static final SearchFilter VISIBILITY_FILTER
public static final SearchFilter SHARABILITY_FILTER
public static final List<SearchFilter> DEFAULT_FILTERS
@CheckForNull public static SearchInfo getSearchInfoForNode(@NonNull Node node)
Algorithm for getting search info:
FileObject
(possibly as primary file of a DataObject
) in its lookup,
and, if so, create search info for recursive searching in the file
object, using filters defined in found SubTreeSearchOptions
.
FileObject
(possibly as primary file of a DataObject
) in is lookup. If
so, create default search info for that file object. Default means
that the file object will be searched recursively, using default
filters.
FileObject
,
DataObject
,
SearchInfoDefinition
,
SubTreeSearchOptions
,
SearchInfoUtils.findDefinedSearchInfo(org.openide.nodes.Node)
@CheckForNull public static SearchInfo findDefinedSearchInfo(@NonNull Node node)
SearchInfoUtils.getSearchInfoForNode(org.openide.nodes.Node)
@NonNull public static SearchInfo createForDefinition(@NonNull SearchInfoDefinition definition)
SearchInfoDefinition
instance.definition
- Search info definition.@NonNull public static SearchInfo createCompoundSearchInfo(@NonNull SearchInfo... delegates)
SearchInfo
compound of the given delegates. It combines the
delegates such that: SearchInfo.canSearch()
returns
true
if and only if at least one of the delegate's
canSearch()
returns
true
SearchInfo.createFilesToSearchIterator(SearchScopeOptions, SearchListener, AtomicBoolean)
chains iterators of the delegates, skipping those delegates whose
canSearch()
method returns
false
delegates
- delegates the compound
SearchInfo
should delegate toSearchInfo
NullPointerException
- if the argument is
null
@NonNull public static SearchInfo createEmptySearchInfo()
SearchInfo.canSearch()
returns always
null.@NonNull public static SearchInfo createSearchInfoForRoot(@NonNull FileObject root)
root
- File of folder where recursive searching should start.@NonNull public static SearchInfo createSearchInfoForRoots(@NonNull FileObject[] roots)
Using this method is preferable to creating several SearchInfo
instances for individual roots using
SearchInfoUtils.createSearchInfoForRoot(FileObject)
and then combining them with
SearchInfoUtils.createCompoundSearchInfo(SearchInfo[])
.
roots
- Array of root files or folders.@NonNull public static SearchInfo createSearchInfoForRoots(@NonNull FileObject[] roots, boolean useDefaultFilters, @NonNull SearchFilterDefinition... extraFilters)
useDefaultFilters
- True if default filters (visibility filter and
sharability filter) should be used, false otherwise.extraFilters
- Array of extra custom filters.