<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>Code Completion provides users with a list of suggested completions for partially typed texts in the editor and various dialog input fields.
<br/>
The Code Completion module was created to replace
the original legacy editor code completion which
lacked several key requirements:
</p>
<ul>
<li>
Support for multiple independent code completion content providers.
</li>
<li>
Implied requirement for ordering and prioritization of the completion items.
</li>
<li>
Direct support for asynchronous completion result computation.
</li>
<li>
Missing separation to the API and SPI and implementation parts.
</li>
</ul>
</answer>
<!-- <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> todescribeyourgeneralAPIs. Ifpossiblepleaseprovide simplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<p>
The Code Completion module is located under <code>/cvs/editor/completion</code> directory. It provides the
<api type="export" category="official" group="java" name="CodeCompletionAPI"url="@TOP@index.html"/>
with a simple API for showing and hiding of the completion
located in <code>org.netbeans.api.editor.completion</code>
and with SPI defining the completion providers that is located
in <code>org.netbeans.spi.editor.completion</code>,
and the implementation located in <code>org.netbeans.modules.editor.completion</code>.
</p>
</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? </hint> </question>
-->
<answer id="arch-quality">
<p>
The unit tests will be created to cover the functionality testing.
<br/>
The proper instantiation of the registered completion providers
will be tested.
<br/>
Asynchronous task execution.
<br/>
Various semantics e.g. prohibition of repetitive result notification
from the completion provider.
</p>
</answer>
<!-- <questionid="arch-time"when="init"> Whatarethetimeestimatesofthework? <hint> Pleaseexpressyourestimatesofhowlongthedesign,implementation, stabilizationarelikelytolast.Howmanypeoplewillbeneededto implementthisandwhatistheexpectedmilestonebywhichtheworkshouldbe ready? </hint> </question>
-->
<answer id="arch-time">
<p>The prototype implementation of the module is available in cvs on the completion branch.
Also, the prototype implementation of the Java completion provider exists in /cvs/java/editor on
the completion branch. An additional time will be needed for cleaning-up the editor module
from the existing code completion infrastructure (5 man-days), convering the existing completion
supports (e.g. JSP Completion, XML Completion) into the completion providers (5 man-days),
polishing the Code Completion module itself to e.g. work with the existing code completion
options, etc. (3 working man-days), and the overall module stabilization (5 man-days).</p>
<p>There are no expected milestones yet.</p>
</answer>
<usecase id="show-or-hide-completion" name="Show or hide completion window">
<p>
The API is small and it only allows to explicitly show or hide the completion window.
<br/>
It's being used by code templates that need to explicitly show the code completion
window when tabbing to a particular parameter.
<br/>
There may be certain actions that want to ensure that the code completion is hidden
at the time when they are invoked. For example the actions pasting the content
of the completion item into the document.
</p>
</usecase>
<h3>SPI</h3>
<usecase id="completion-provider" name="Provide completion content by independent providers">
<p>
Completion infrastructure needs to obtain the results that are then displayed
in the completion window.
<br/>
There are three types of displayed results related to the current caret offset:
</p>
<ul>
<li>
Code completion items
</li>
<li>
Documentation (e.g. the javadoc documentation)
</li>
<li>
Tooltip (e.g. for method parameters)
</li>
</ul>
<p>
For the purpose of obtaining these completion results
<a href="@TOP@org/netbeans/spi/editor/completion/CompletionProvider.html">
CompletionProvider</a>
exists.
<br/>
There may be an arbitrary number of independent completion providers for
a single completion popup window.
<br/>
The completion providers are registered through the xml layer into
<i>Editors/<mime-type>/CompletionProviders</i>. Once the document
with the particular mime-type gets loaded the corresponding completion providers
will get instantiated and used.
</p>
<p>
Threading:
<br/>
The code completion's infrastructure invokes the requests
for the completion results in the AWT thread.
<br/>
Therefore all the methods of the completion providers are invoked
in AWT thread but they may reschedule their processing into other threads.
</p>
</usecase>
<usecase id="asynchronous-completion-task" name="Provide completion results computed asynchronously">
<p>
The completion provider creates a task that computes the resulting
data that will then be displayed by the code completion infrastructure.
<br/>
The task creation and computation are called synchronously
from the AWT event dispatch thread.
<br/>
However there can be potentially long-running tasks (e.g. working with MDR)
that are not desirable to be run in AWT thread.
<br/>
Therefore the completion infrastructure provides a listener
to which the completion task notifies the results.
<br/>
The support class
<a href="@TOP@org/netbeans/spi/editor/completion/support/AsyncCompletionTask.html">
AsyncCompletionTask</a> allows to post the task computation
into <code>RequestProcessor</code>.
</p>
</usecase>
<usecase id="completion-item" name="Provide list of completion items fulfilling various requirements">
<p>
The completion task computes a collection of completion items
which are then collected by the completion infrastructure and displayed.
<br/>
<b>Displaying</b>. Each completion item must be able to display itself in a <code>JList</code>.
<br/>
<b>Sorting</b>. The completion items may come from different completion providers
and they must be sorted before displaying. The sort order
should not only be alphabetical but it should also allow a prioritization
of the items according to their importance in the given context.
<br/>
<b>Actions</b>. The interaction of the user with the completion item
is done by interacting with item's input map and action map.
<br/>
<b>Documentation</b>. The item may want to display additional
detailed information in a documentation popup window.
</p>
<!-- <questionid="compat-standards"when="init"> Doesthemoduleimplementordefineanystandards?Isthe implementationexactordoesitdeviatesomehow? </question>
-->
<answer id="compat-standards">
<p>
The module does not define nor implement any standard.
</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>
The Code Completion module should be able to read the existing code completion related options
stored as part of the editor settings.<br/>
In a future, we plan to introduce some additional options related to e.g. sorting the code
completion results, etc.
</p>
</answer>
<!-- <questionid="dep-nb"when="init"> WhatotherNetBeansprojectsandmodulesdoesthisonedependon? <hint> Ifyouwant,describesuchprojectsasimportedAPIsusing the<code><apiname="identification"type="importorexport"category="stable"url="whereisthedescription"/></code> </hint> </question>
-->
<answer id="dep-nb">
<p>
The module has dependency on the
<api name="EditorModuleAPI"type="import" category="friend" group="java"/>
module. It uses this dependency to read the old code completion options stored as
a part of the editor module.
</p>
</answer>
<!-- <questionid="dep-non-nb"when="init"> WhatotherprojectsoutsideNetBeansdoesthisonedependon? <hint> Somenon-NetBeansprojectsarepackagedasNetBeansmodules (see<ahref="http://libs.netbeans.org/">libraries</a>)and itispreferredtousethisapproachwhenmoremodulesmay dependonsuchthird-partylibrary. </hint> </question>
-->
<answer id="dep-non-nb">
<p>
The module does not depend on any outside project.
</p>
</answer>
<!-- <questionid="dep-platform"when="init"> Onwhichplatformsdoesyourmodulerun?Doesitruninthesame wayoneach? <hint> IfyourmoduleisusingJNIordealswithspecialdifferencesof OSeslikefilesystems,etc.pleasedescribeherewhattheyare. </hint> </question>
-->
<answer id="dep-platform">
<p>
The module runs on any platform that provides the required JRE.
</p>
</answer>
<!-- <questionid="exec-property"when="impl"> Isexecutionofyourcodeinfluencedbyanyenvironmentor Javasystem(<code>System.getProperty</code>)property? <hint> Ifthereisapropertythatcanchangethebehaviorofyour code,somebodywilllikelyuseit.Youshoulddescribewhatitdoes andthe<ahref="http://openide.netbeans.org/tutorial/api-design.html#life">stabilitycategory</a> ofthisAPI.Youmayuse <pre> <apitype="export"group="property"name="id"category="private"url="http://..."> descriptionoftheproperty,whereitisused,whatitinfluence,etc. </api> </pre> </hint> </question>
-->
<answer id="exec-property">
<api category="devel" group="logger" name="org.netbeans.ui.editor.completion"type="export">
Since version1.8 the completion cooperates with <!-- XXX link to @org-netbeans-modules-uihandler@/overview-summary.html not OK from a stable API -->UI Gestures Collector
by sending following messages to the <code>org.netbeans.ui.editor.completion</code> <a href="@JDK@@JDKMODULE_JAVA_LOGGING@/java/util/logging/Logger.html">logger</a>:
<ul>
<li><b>COMPL_INVOCATION</b> - message about a code completion being invoked. Arguments:
<ul>
<li>{0}: true - if explicit, false if implicit invocation happened</li> <!-- <li>{1}:theindexofselecteditem</li> <li>{2}:theclassnameoftheselecteditem</li>
-->
</ul>
</li>
<li><b>COMPL_KEY_SELECT</b> - send when user selects an item from completion using keyboard character. Arguments:
<ul>
<li>{0}: character that invoked the action</li>
<li>{1}: the index of selected item</li>
<li>{2}: the classname of the selected item</li>
</ul>
</li>
<li><b>COMPL_KEY_SELECT_DEFAULT</b> - send when user selects an item from completion using enter. Arguments:
<ul>
<li>{0}: '\n'</li>
<li>{1}: the index of selected item</li>
<li>{2}: the classname of the selected item</li>
</ul>
</li>
<li><b>COMPL_MOUSE_SELECT</b> - send when user selects an item from completion using mouse. Arguments:
<ul>
<li>{0}: null</li>
<li>{1}: the index of selected item</li>
<li>{2}: the classname of the selected item</li>
</ul>
</li>
<li><b>COMPL_CANCEL</b> - send when user selects cancels completion without any selection. No arguments. <!-- <ul> <li>{0}:null</li> <li>{1}:theindexofselecteditem</li> <li>{2}:theclassnameoftheselecteditem</li> </ul>
-->
</li>
</ul>
</api>
<api category="private" group="systemproperty" name="org.netbeans.modules.editor.completion.slowness.report"type="export" url="https://netbeans.apache.org/wiki/FitnessViaPostMortem">
You can suppress automatic reporting of slow code completion computation
by increasing value of <code>-J-Dorg.netbeans.modules.editor.completion.slowness.report</code>
property to more than 2000 ms (the default value).
</api>
</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>
The module does not work with the 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>
The module does not use Drag & Drop.
</p>
</answer>
<!-- <questionid="format-types"when="impl"> Whichprotocolsandfileformats(ifany)doesyourmodulereadorwriteondisk, ortransmitorreceiveoverthenetwork?Doyougenerateanantbuildscript? Canitbeeditedandmodified? <hint> <p> Filescanbereadandwrittenbyotherprograms,modulesandusers.Iftheyinfluence yourbehaviour,makesureyoueitherdocumenttheformatorclaimthatitisaprivate api(usingthe<api>tag). </p> <p> Ifyougenerateanantbuildfile,thisisverylikelygoingtobeseenbyendusersand theywillbeattemptedtoeditit.Youshouldbereadyforthatandprovideherealink todocumentationthatyouhaveforsuchpurposesandalsodescribehowyouaregoingto understandsuchfilesduringnextrelease,whenyou(verylikely)slightlychangethe format. </p> </hint> </question>
-->
<answer id="format-types">
<p>
No files are read or written to the disk.
</p>
</answer>
<!-- <questionid="perf-limit"when="init"> Arethereanyhard-codedorpracticallimitsinthenumberorsizeof elementsyourcodecanhandle? </question>
-->
<answer id="perf-limit">
<p>
There are no hard-coded limits. However, due to performance reasons, the number of CompletionProviders
registered with a mime-type should be held as low as possible.
</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>
Computing of the code completion results is potentially a long-running task.
The Code Completion SPI is constructed in such a way that it provides
CompletinProviders with a possibility to run their tasks asynchronously.
</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 of CompletionProviders registered for a document mime-type.
</p>
</answer>
<!-- <questionid="perf-spi"when="init"> Howtheperformanceofthepluggedincodewillbeenforced? <hint> Ifyouallowforeigncodetobepluggedintoyourownmodule,how doyouenforcethatitwillbehavecorrectlyandquicklyandwillnot negativelyinfluencetheperformanceofyourownmodule? </hint> </question>
-->
<answer id="perf-spi">
<p>Currently, there is no way to enforce the performance of the plugged in code.</p>
</answer>
<!-- <questionid="perf-startup"when="final"> Doesyourmodulerunanycodeonstartup? </question>
-->
<answer id="perf-startup">
<p>
Singleton <code>org.netbeans.modules.editor.completion.Completion</code> is created on the module startup.
</p>
</answer>
<!-- <questionid="resources-read"when="final"> Doesyourmodulereadanyresourcesfromlayers?Forwhatpurpose? <hint> Asthisissomekindofintermoduledependency,itisakindofAPI. Pleasedescribeitandclassifyaccordingto <ahref="http://openide.netbeans.org/tutorial/api-design.html#categories"> commonstabilitycategories</a>. </hint> </question>
-->
<answer id="resources-read">
<p>
The module reads CompletionProviders registered for the given mime-type
from the <code>Editors/<mime-type>/CompletionProviders</code> folder.
</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.