Skip navigation links
org.netbeans.api.search 1.21

Search API
Stable

See: Description

Search API 
Package Description
org.netbeans.api.search
This package contains classes that can be used by modules that need to work with Search in Projects dialog, or want to share information about what data was recently searched.
org.netbeans.api.search.provider
Classes that you may need to work with if you are implementing a custom search provider.
org.netbeans.api.search.ui
Helpers for creating UI controls for your search provider that are similar to controls in the default provider.
org.netbeans.spi.search
This package contains classes that you can subclass and register to lookups of nodes if you want to specify how the nodes should be searched.
org.netbeans.spi.search.provider
This package contains classes that are needed to add a custom panel to Find in Projects dialog, that can have customized search criteria, search algorithm and results panel.

There are three goals:

The module also contains UI for Find (Replace) in Projects dialog and search results window, and implementation of default search provider.

What is New (see all changes)?

Use Cases

Search History

SearchHistory is synchronising history content through netbeans modules and it saves history to preferences.

There are two separate histories. One for search and another for replace. When you add your propertyListener to SearchHistory - you can listen for changes in histories.

SearchHistory has methods for adding new entries and getting whole history list.

SearchInfo API & SPI

This use-case was formerly covered by module org.openidex.search.

The SearchInfo API+SPI allows other modules to specify whether and how should nodes they define be searched.

The definition is represented by objects extending class SearchInfoDefinition . To customize searching on a custom node, a SearchInfoDefinition object must be added to the node's lookup. In most cases, there is no need to define own class extending the class - one can use factory methods of class SearchInfoDefinitionFactory .

In some cases implementators may need to apply the same set of SearchFilterDefinitions in the whole subtree of a node. If so, it is not needed to put SearchInfoDefinition to all nodes' lookups, but only one instance of SubTreeSearchOptions have to be put into the lookup of the root node.

Defines abstract classes SearchInfoDefinition, SearchFilterDefinition, SubTreeSearchOptions and a factory class SearchInfoDefinitionFactory
Enhance IDE searching features

People that want to enhance IDE searching features (with custom search criteria or specialized algorithms) can add a new tab to the "Search in Projects" dialog.

They need to implement several classes:

  • SearchProvider to register the new search feature to the IDE or platform application.
  • SearchProvider.Presenter that creates visual component for adding to the search dialog and that can interact with dialog buttons.
  • SearchResultsDisplayer to show search results to the user.
  • SearchComposition that encapsulates setting and state of searches, provide access to result displayer, and is able to start and terminate the search.
Defines abstract classes that need to be implemented when creating custom providers: SearchProvider, SearchProvider.Presenter, SearchResultsDisplayer, SearchComposition and relative classes. Classes usually used by search providers. Contains class SearchInfo, that defines which files should be searched (it can be retrieved from methods in SearchInfoUtils, or UI component controller ScopeController), SearchListener that you should inform about events that happen during searching, and helper classes SearchInfoUtils (getting SearchInfo objects for nodes) and FileNameMatcher (filtering files by file name). Several UI components that can be used in presenters of search providers, and factory method for creating them.
Search in Projects API

This API enables other modules to open Find in Projects dialog with some pre-defined criteria and to start searching programatically.

Contains classes for controlling search, passing search criteria, and some helper classes.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
SearchInfoSPIExportedStable .../netbeans/spi/search/package-summary.html

Defines abstract classes SearchInfoDefinition, SearchFilterDefinition, SubTreeSearchOptions and a factory class SearchInfoDefinitionFactory

SearchProviderSPIExportedStable .../spi/search/provider/package-summary.html

Defines abstract classes that need to be implemented when creating custom providers: SearchProvider, SearchProvider.Presenter, SearchResultsDisplayer, SearchComposition and relative classes.

SearchProviderAPIExportedStable .../api/search/provider/package-summary.html

Classes usually used by search providers. Contains class SearchInfo, that defines which files should be searched (it can be retrieved from methods in SearchInfoUtils, or UI component controller ScopeController), SearchListener that you should inform about events that happen during searching, and helper classes SearchInfoUtils (getting SearchInfo objects for nodes) and FileNameMatcher (filtering files by file name).

SearchProviderUIAPIExportedStable .../api/search/ui/package-summary.html

Several UI components that can be used in presenters of search providers, and factory method for creating them.

SearchAPIExportedStable .../netbeans/api/search/package-summary.html

Contains classes for controlling search, passing search criteria, and some helper classes.

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

No extra declaration is required.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.api.search 1.21

Built on May 25 2016.  |  Portions Copyright 1997-2016 Oracle. All rights reserved.