<!-- <questionid="arch-overall"when="init"> Describetheoverallarchitecture. <hint> WhatwillbeAPIfor <ahref="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi"> clientsandwhatsupportAPI</a>? Whatpartswillbepluggable? Howwillplug-insberegistered?Pleaseuse<code><apitype="export"/></code> todescribeyourgeneralAPIsandspecifytheir <ahref="http://openide.netbeans.org/tutorial/api-design.html#category-private"> stabilitycategories</a>. Ifpossiblepleaseprovidesimplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<p>
Quick Search API in infrastrcuture which enables module clients to plug into
Quick Search UI and provide results of search that end user performed in UI.
Quick Search UI is represented by a small text field in toolbar area on right
hand side, with asociated popup window to show search results.
</p>
<p>
Clients that want to extend Quick Search capabilities and provide data to search in
are expected to implement <api group="java" name="SearchProvider" category="official"type="export"url="@TOP@/org/netbeans/spi/quicksearch/SearchProvider.html" />
SPI.</p>
<p>SearchProvider implementations are registered through module's xml layer file,
as explained in <a href="@TOP@/org/netbeans/spi/quicksearch/SearchProvider.html">SearchProvider SPI</a>
javadoc and detailed <a href="@org-openide-util@/org/openide/util/doc-files/api.html#instances">Instantiation rules</a>.
</p>
<p>Main task of SearchProvider implementations is to evaluate input
<api group="java" name="SearchRequest" category="official"type="export"url="@TOP@/org/netbeans/spi/quicksearch/SearchRequest.html" />,
perform search in its data model and feed <api group="java" name="SearchResponse" category="official"type="export"url="@TOP@/org/netbeans/spi/quicksearch/SearchResponse.html" />
response object by results apropriate for given request.
</p>
<api type="export" group="property" name="quicksearch.web.site" category="devel">
Resource name from org.netbeans.modules.quicksearch.web.Bundle where it is
possible to specify website to restrict the web search to. When set to e.g.
NetBeans.org then the web search provider will search for given text in web pages
from NetBeans.org site only.
</api>
<api type="export" group="property" name="quicksearch.web.url_patterns" category="devel">
Resource name from org.netbeans.modules.quicksearch.web.Bundle where it is
possible to specify a comma separated list of regular expressions that the search results URLs
must contain. When set to e.g. ".*docs/myapp.*,.*tutorials/myapp.*" then all the search
results will have either "docs/myapp" or "tutorials/myapp" anywhere in the URL.
</api>
</answer>
<!-- <questionid="arch-quality"when="init"> Howwillthe<ahref="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a> ofyourcodebetestedand howarefutureregressionsgoingtobeprevented? <hint> Whatkindoftestingdo youwanttouse?Howmuchfunctionality,inwhichareas, shouldbecoveredbythetests?Howyoufindoutthatyour projectwassuccessful? </hint> </question>
-->
<answer id="arch-quality">
<p>
There are unit tests in test package.
</p>
</answer>
<!-- <questionid="arch-time"when="init"> Whatarethetimeestimatesofthework? <hint> Pleaseexpressyourestimatesofhowlongthedesign,implementation, stabilizationarelikelytolast.Howmanypeoplewillbeneededto implementthisandwhatistheexpectedmilestonebywhichtheworkshouldbe ready? </hint> </question>
-->
<answer id="arch-time">
<p>
Design two weeks, implementation of API and basic content providers about 4-5 weeks,
stabilization three weeks, all estimates in manwork. Initial version should
be available in release 6.5 M1, full version in release 6.5.
</p>
</answer>
<!-- <questionid="arch-usecases"when="init"> <hint> Contentofthisanswerwillbedisplayedaspartofpageat http://www.netbeans.org/download/dev/javadoc/usecases.html Youcanusetags<usecasename="name>regularhtmldescription</usecase> andifyouwanttouseanURLyoucanprefixifwith@TOP@tobegin attherootofyourjavadoc </hint> Describethemain<ahref="http://openide.netbeans.org/tutorial/api-design.html#usecase"> usecases</a>ofthenewAPI.Whowilluseitunder whatcircumstances?Whatkindofcodewouldtypicallyneedtobewritten tousethemodule? </question>
-->
<answer id="arch-usecases">
<usecase id="newProvider" name="How To Add New Quick Search Provider" >
In order to plug in a new Quick Search provider and new category of results,
module writers need to complete following steps:
<h4>1. Implement <a href="@TOP@/org/netbeans/spi/quicksearch/SearchProvider.html">SearchProvider</a></h4>
<ul>
<li>Implement body of <b><code>SearchProvider.evaluate</code></b> method
like suggested in its <a href="@TOP@/org/netbeans/spi/quicksearch/SearchProvider.html">javadoc</a>.
</li>
</ul>
<h4>2. Register SearchProvider implementation in xml layer</h4>
Register your SearchProvider implementation in your module's xml layer file under
main <b>"/QuickSearch"</b> folder. Registration xml syntax is following:
<pre>
<folder name="QuickSearch">
<folder name="Category1_ID">
<attr name="position" intvalue="300"/>
<file name="org-netbeans-module1-package1-Provider1Impl.instance"/>
</folder>
<folder name="Category2_ID">
<!--Attribute for localization - provide localized display name of category!-->
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.yourmodule.YourBundle"/>
<!--Attribute for command prefix - used to narrow search to this category only!-->
<attr name="command" stringvalue="p"/>
<!--Attribute for category ordering!-->
<attr name="position" intvalue="200"/>
<!--Note that multiple providers can contribute to one category!-->
<file name="org-netbeans-module2-package2-Provider2Impl.instance"/>
<file name="org-netbeans-module2-package3-Provider3Impl.instance"/>
</folder>
</folder>
</pre>
<b>Syntax explanation:</b>
<ul>
<li>Subfolders of "QuickSearch" define search result categories and their order.</li>
<li>Providers can share category by putting themselves under same subfolder.</li>
<li>Ordering of categories is done through NetBeans standard FileSystem API ordering "position" attribute</li>
<li>Display name of category folder uses NetBeans standard FileSystem API "SystemFileSystem.localizingBundle" attribute.</li>
<li>"command" attribute defines command prefix for category, which is used
to narrow Quick Search to only one category. Provide short prefix, ideally
containing one or two prefix, that will serve as command to narrow search
only this category. In above syntax example, if
user types 'p' and space key and then text, only "Category2_ID" category
will be searched.</li>
<li>If several providers share one category, then only one provider needs to
specify above attributes. Note however that if your provider shares
category with provider from different module, you should have dependency
on module which actually define those attributes. Dependency assures
there will always be category "description" for category that you are
sharing.</li>
</ul>
</usecase>
<usecase id="shareCategory" name="How To Share Category Of Results" >
<p>Quick Search UI shows search results divided into visually separeted sections,
called categories. Several <code>SearchProvider</code> implementations may decide to display
their results in one shared category of results in Quick Search UI.</p>
<p>In order to share category, module writers have to agree on shared
category and its properties, especially its name.
It means that all providers (possibly in different NetBeans modules)
need to be registered under the same folder, as shown below:</p>
<h4>Provider 1</h4>
Provider 1 is category "owner", which defines properties of <code>SharedCategory</code> such as display name, position and command prefix.
<pre>
<folder name="QuickSearch">
<folder name="SharedCategory">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.yourmodule.YourBundle"/>
<attr name="command" stringvalue="p"/>
<attr name="position" intvalue="200"/>
<file name="org-netbeans-module1-package1-Provider1Impl.instance">
<attr name="position" intvalue="300"/>
</file>
</folder>
</folder>
</pre>
<h4>Provider 2</h4>
Other providers from other modules are sharing category with Provider 1.
Provider 2 does not define properties of <code>SharedCategory</code>,
as they were already defined by Provider 1.
Note that module dependency on the module of Provider 1 is needed
to ensure that <code>SharedCategory</code> is fully defined.
<pre>
<folder name="QuickSearch">
<folder name="SharedCategory">
<file name="org-netbeans-module2-package2-Provider2Impl.instance"/>
<attr name="position" intvalue="200"/>
</file>
</folder>
</folder>
</pre>
<h4>Provider 3</h4>
The same rules apply like for Provider 2. Note that position attribute
can be used to control position of provider's results in shared category.
Results from provider with lowest position will go first and so on.
<pre>
<folder name="QuickSearch">
<folder name="SharedCategory">
<file name="org-netbeans-module2-package3-Provider3Impl.instance"/>
<attr name="position" intvalue="100"/>
</file>
</folder>
</folder>
</pre>
</usecase>
<usecase id="categoryOrder" name="How To Define and Modify Order of Categories" >
Order of categories of results can be set by using "position" attribute
of category xml folder definition. Following example will result in
<code>FirstCategory</code> to be first, and <code>SecongCategory</code> to be second :),
which means that <code>FirstCategory</code> and its results will be
displayed above <code>Secondcategory</code> in QuickSearch results window.
<usecase id="hideProvider" name="How To Hide Recent Searches Results and Others" > "Recent Searches" provider is contained directly in <code>spi.quicksearch</code>
module, so its functionality is automatically always available by default.
However, if your module wants to disable "Recent Searches" or any other
category, follow the steps below:
<h4>Define module dependency</h4>
Your module have to depend on module where provider you want to disable
is contained. In case of "Recent Searches" provider, it's <code>spi,quicksearch</code>,
on which you probably already depend.
<h4>Disable provider using "_hidden"</h4>
For example, to disable "Recent Searches" provider, write into your layer:
"Recent" is a name of category for "Recent Searches" provider and by appending "_hidden" suffix you are telling system to "hide" it. This technique
can be used also to disable invidual search providers.
</usecase>
<usecase id="usageInPlatform" name="How To Use Quick Search in Platform Application" >
Quick Search UI is disabled by default in application built on top of
NetBeans platform. To enable Quick Search feature in your application,
complete following steps:
<h4>1. Write XML layer registration</h4>
Add the following lines to XML layer of some of your modules in your
application suite:
<h4>2. Localize Toolbar Name</h4>
Replace <code>com.myapp.mymodule.MyBundle</code> in the xml registration
above with path to your properties file, in which you'll define
localized name of Quick Search toolbar:
<pre>
Toolbars/QuickSearch=Quick Search
</pre>
<p>By default, providers for searching in actions and recent searches
will be enabled. Web search provider is disabled by default, see use case
below for info how to turn it on.</p>
</usecase>
<usecase id="searchWebProvider" name="How To Add a Default Web Search Provider" >
There is a default implementation of web search provider which uses Google
to search for the given text on the web. Simply add the following lines to your XML layer
to enable this search provider in your application:
<pre>
<folder name="QuickSearch">
<folder name="WebSearch">
<!--Attribute for localization - provide localized display name of category!-->
<attr name="SystemFileSystem.localizingBundle" stringvalue="com.myapp.mymodule.MyBundle"/>
<!--Attribute for command prefix - used to narrow search to this category only!-->
<attr name="command" stringvalue="g"/>
<!--Attribute for category ordering!-->
<attr name="position" intvalue="200"/>
<!--Note that multiple providers can contribute to one category!-->
<file name="org-netbeans-modules-quicksearch-web-WebQuickSearchProviderImpl.instance"/>
</folder>
</folder>
</pre>
You can also add branding for <code>org.netbeans.modules.quicksearch.web</code> Bundle to restrict
the search to a particular site only:
<pre>
quicksearch.web.site=mywebsite.com
</pre>
And you can also restrict the search to some parts your website only:
<pre>
quicksearch.web.url_patterns=mywebsite.com/docs,mywebsite.com/files/tutorials
</pre>
</usecase>
<usecase id="customizeLookAndFeel" name="How to customize Look&Feel properties">
If you need to adjust border of the Quick Search component for your
Look&Feel, you can put a <code>Border</code> instance into
<code>UIManager</code> under key <code>nb.quicksearch.border</code>.
</usecase>
</answer>
<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>
QuickSearch API and its implementations provides way for end user to learn
system earlier and easier and also to find various things in the system more
quickly, conveniently and in standard way.
Main project page is on nb wiki, http://wiki.netbeans.org/QuickSearch
</p>
</answer>
<!-- <questionid="compat-deprecation"when="init"> Howtheintroductionofyourprojectinfluencesfunctionality providedbypreviousversionoftheproduct? <hint> Ifyouareplanningtodeprecate/remove/changeanyexistingAPIs, listthemhereaccompaniedwiththereasonexplainingwhyyou aredoingso. </hint> </question>
-->
<answer id="compat-deprecation">
<p>
QuickSearch API is new API, so no deprecations for now.
</p>
</answer>
<!-- <questionid="compat-standards"when="init"> Doesthemoduleimplementordefineanystandards?Isthe implementationexactordoesitdeviatesomehow? </question>
-->
<answer id="compat-standards">
<p>
Infrastructure module offers SPI for content provider implementors and
implements Request-Response pattern for communication between API side
and client module side.
</p>
</answer>
<!-- <questionid="compat-version"when="impl"> Canyourmodulecoexistwithearlierandfuture versionsofitself?Canyoucorrectlyreadalloldsettings?Willfuture versionsbeabletoreadyourcurrentsettings?Canyouread orpolitelyignoresettingsstoredbyafutureversion? <hint> Veryhelpfulforreadingsettingsistostoreversionnumber there,sofutureversionscandecidewhetherhowtoread/convert thesettingsandolderversionscanignorethenewones. </hint> </question>
-->
<answer id="compat-version">
<p>
Yes, module can coexist, as no settings are persistent now.
</p>
</answer>
<!-- <questionid="dep-jre"when="final"> WhichversionofJREdoyouneed(1.2,1.3,1.4,etc.)? <hint> Itisexpectedthatifyourmodulerunson1.xthatitwillrun on1.x+1ifno,statethatplease.Alsodescribeherecaseswhere yourundifferentcodeondifferentversionsofJREandwhy. </hint> </question>
-->
<answer id="dep-jre">
<p>
JRE 1.5 and higher is needed, as Java 1.5language constructs are used.
</p>
</answer>
<!-- <questionid="exec-threading"when="init"> Whatthreadingmodels,ifany,doesyourmoduleadhereto?Howthe projectbehaveswithrespecttothreading? <hint> IsyourAPIthreadsafe?Canitbeaccessedfromanythreadsor justfromsomededicatedones?AnyspecialrelationtoAWTand itsEventDispatchthread?Also ifyourmodulecallsforeignAPIswhichhaveaspecificthreadingmodel, indicatehowyoucomplywiththerequirementsformultithreadedaccess (synchronization,mutexes,etc.)applicabletothoseAPIs. IfyourmoduledefinesanyAPIs,orhascomplexinternalstructures thatmightbeusedfrommultiplethreads,declarehowyouprotect dataagainstconcurrentaccess,raceconditions,deadlocks,etc., andwhethersuchrulesareenforcedbyruntimewarnings,errors,assertions,etc. Examples:aclassmightbenon-thread-safe(likeJavaCollections);might befullythread-safe(internallocking);mightrequireaccessthroughamutex (andmayormaynotautomaticallyacquirethatmutexonbehalfofaclientmethod); mightbeabletorunonlyintheeventqueue;etc. Alsodescribewhenanyeventsarefired:synchronously,asynchronously,etc. Ideas:<ahref="http://core.netbeans.org/proposals/threading/index.html#recommendations">ThreadingRecommendations</a>(inprogress) </hint> </question>
-->
<answer id="exec-threading">
<p>
Content providers are called outside EQ thread to not block system UI,
RequestProcessor is used. Module's internal data model of provider's results
is synchronized to be able to work both with providers and UI code.
</p>
</answer>
<!-- <questionid="format-clipboard"when="impl"> Whichdataflavors(ifany)doesyourcodereadfromorinsertto theclipboard(byaccesstoclipboardonmeanscallingmethodson<code>java.awt.datatransfer.Transferable</code>? <hint> OftenNode'sdealwithclipboardbyusageof<code>Node.clipboardCopy,Node.clipboardCutandNode.pasteTypes</code>. Checkyourcodeforoverridingthesemethods. </hint> </question>
-->
<answer id="format-clipboard">
<p>
No direct clipboard access, just Swing controls are used that communicate with clipboard.
</p>
</answer>
<!-- <questionid="format-dnd"when="impl"> Whichprotocols(ifany)doesyourcodeunderstandduringDrag&Drop? <hint> OftenNode'sdealwithclipboardbyusageof<code>Node.drag,Node.getDropType</code>. Checkyourcodeforoverridingthesemethods.Btw.iftheyarenotoverridden,they bydefaultdelegateto<code>Node.clipboardCopy,Node.clipboardCutandNode.pasteTypes</code>. </hint> </question>
-->
<answer id="format-dnd">
<p>
No direcr DnD, same as for clipboard.
</p>
</answer>
<!-- <questionid="perf-mem"when="final"> Howmuchmemorydoesyourcomponentconsume?Estimate witharelationtothenumberofwindows,etc. </question>
-->
<answer id="perf-mem">
<p>
Small memory consumption, only up to a few results items per provider,
so say several KBs of data, cleared after each search.
</p>
</answer>
<!-- <questionid="perf-progress"when="final"> Doesyourmoduleexecuteanylong-runningtasks? <hint>Longrunningtasksshouldneverblock AWTthreadasitbadlyhurtstheUI <ahref="http://performance.netbeans.org/responsiveness/issues.html"> responsiveness</a>. Taskslikeconnectingover network,computinghugeamountofdata,compilation bedoneasynchronously(forexample using<code>RequestProcessor</code>),definitivelyitshould notblockAWTthread. </hint> </question>
-->
<answer id="perf-progress">
<p>
Yes, providers can run their search for a long time. See threading anwer for
implemented solution.
</p>
</answer>
<!-- <questionid="perf-scale"when="init"> Whichexternalcriteriainfluencetheperformanceofyour program(sizeoffileineditor,numberoffilesinmenu, insourcedirectory,etc.)andhowwellyourcodescales? <hint> Pleaseincludesomeestimates,thereareothermoredetailed questionstoanswerinlaterphasesofimplementation. </hint> </question>
-->
<answer id="perf-scale">
<p>
Number and speed of individual content providers. See threading anwer for
implemented solution.
</p>
</answer>
<!-- <questionid="perf-spi"when="init"> Howtheperformanceofthepluggedincodewillbeenforced? <hint> Ifyouallowforeigncodetobepluggedintoyourownmodule,how doyouenforcethatitwillbehavecorrectlyandquicklyandwillnot negativelyinfluencetheperformanceofyourownmodule? </hint> </question>
-->
<answer id="perf-spi">
<p>
Code from SPI clients runs in isolated thread and Request-Response API pattern
is implemented to enable clients to compute results iteratively and stop
whenever desirable.
</p>
</answer>
<!-- <questionid="resources-layer"when="final"> Doesyourmoduleprovideownlayer?Doesitcreateanyfilesor foldersinit?Whatitistryingtocommunicatebythatandwithwhich components? <hint> NetBeansallowsautomaticanddeclarativeinstallationofresources bymodulelayers.Moduleregisterfilesintoappropriateplaces andothercomponentsusethatinformationtoperformtheirtask (buildmenu,toolbar,windowlayout,listoftemplates,setof options,etc.). </hint> </question>
-->
<answer id="resources-layer">
<p>
Yes, Quick Search UI is plugged into NB window system through xml layer.
Moreover, Quick Search API defines layer structure for its clients,
explained in use cases reply.
</p>
</answer>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.