站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

JavaHelp API - NetBeans Architecture Questions - NetBeans API Javadoc 4.1.0

NetBeans Architecture Answers for JavaHelp API module

WARNING: answering questions version 1.12 rather than the current 1.25.

Interfaces table

Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
JavaHelpIntegrationAPIExportedOfficialhttp://www.netbeans.org/download/dev/javadoc/JavaHelpAPI/index.html

ModulesAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/modules/doc-files/api.html

UtilitiesAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/util/doc-files/api.html

ServicesAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/services-api.html#lookup-impl

NodesAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/nodes/doc-files/api.html

WindowSystemAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/windows/doc-files/api.html

ActionsAPIImportedOfficialhttp://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/actions/doc-files/api.html

ModalityExcludeAPIImportedFriend

offered by some JDKs and tracked as Java bug (5092094) allowing to exclude modal dialogs behaviour for certain windows - in this case the help window.

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
OpenIDE-mergeIntoMasterExportedOfficial

The context and key OpenIDE/mergeIntoMaster can be set as an attribute on a help set provided programmatically rather than with an XML file to customize one attribute. Such programmatic provision is rare but supported.

javahelp.ignore.modalityExportedFriend

The help window through JDK 1.5.0 handles modal dialogs by reparenting the help component into a child dialog of any new modal dialog whenever it is shown, and reparenting it back into a frame whenever it is hidden. Under certain circumstances (showing two dialogs sequentially before the frame can be re-shown), it can produce a race condition in the underlying java.awt.Toolkit implementation. As a workaround, callers of DialogDisplayer.getDefault().notify(DialogDescriptor) may set the system property "javahelp.ignore.modality" to the String "true". This system property will be reset by notify(), and applied as a client property of the root pane of the dialog to be shown. JavaHelp will, in turn, ignore the appearance of any dialog whose root pane posesses the client property "javahelp.ignore.modality" with the String value "true".

Group of dtd interfaces
Interface NameIn/OutStabilitySpecified in What Document?
ObjectTagExportedFriendhttp://www.netbeans.org/download/dev/javadoc/JavaHelpAPI/org/netbeans/api/javahelp/doc-files/api.html


General Information

    Question (arch-what): What is this project good for?

    Answer: The JavaHelp integration API wraps the standard JavaHelp extension library. It also provides a small additional API for NetBeans modules to supply help sets to the system, add GUI menu items, and request that particular help topics be displayed. JavaHelpIntegrationAPI

    Question (arch-overall): Describe the overall architecture.

    WARNING: Question with id="arch-overall" has not been answered!

    Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module?

    WARNING: Question with id="arch-usecases" has not been answered!

    Question (arch-time): What are the time estimates of the work?

    WARNING: Question with id="arch-time" has not been answered!

    Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented?

    WARNING: Question with id="arch-quality" has not been answered!

Project and platform dependencies


Deployment

    Question (deploy-jar): Do you deploy just module JAR file(s) or other files as well?

    Answer:

    The JavaHelp extension library (jh.jar) is included, currently at version 1.1.3.

    Note that some versions of Solaris ship with their own copy of this library in the location /usr/j2se/opt/javahelp/lib/jhall.jar. Since this JAR is included in the extensions path of the JRE on such machines, it would override the copy of jh.jar shipped with the NetBeans integration module. Normally this would be tolerable, but unfortunately the version shipped with Solaris is outdated and exhibits a number of serious bugs, especially in the handling of Japanese search text, which make the NetBeans help system unusable and which were fixed in subsequent official JavaHelp releases. (Note that search databases for JavaHelp help sets are often not cleanly usable in versions of JavaHelp other than the one in which they were built, since details of how HTML substring indices are calculated tend to be unstable between even minor releases.) To avoid such bugs, the NetBeans launcher checks for the existence of the abovementioned file, and if found, prepends the NetBeans jh.jar to the JVM's boot classpath. Other options were considered and rejected as unworkable.

    Question (deploy-nbm): Can you deploy an NBM via the Update Center?

    Answer: Yes.

    Question (deploy-shared): Do you need to be installed in the shared location only, or in the user directory only, or can your module be installed anywhere?

    Answer: Either.

    Question (deploy-packages): Are packages of your module made inaccessible by not declaring them public?

    Answer: Yes.

    Question (deploy-dependencies): What do other modules need to do to declare a dependency on this one?

    WARNING: Question with id="deploy-dependencies" has not been answered!

Compatibility with environment

    Question (compat-i18n): Is your module correctly internationalized?

    Answer: Yes.

    Question (compat-standards): Does the module implement or define any standards? Is the implementation exact or does it deviate somehow?

    Answer: It only implements its own integration API. The JavaHelp reference implementation is bundled and that implements the JavaHelp API.

    Question (compat-version): Can your module coexist with earlier and future versions of itself? Can you correctly read all old settings? Will future versions be able to read your current settings? Can you read or politely ignore settings stored by a future version?

    Answer: N/A

Access to resources

    Question (resources-file): Does your module use java.io.File directly?

    Answer: It uses InstalledFileLocator to implement the nbdocs URL protocol, permitting help sets or files to be loaded from disk files in the NetBeans installation, rather than from inside the module. This is necessary to make it easy for users to customize CSS stylesheets, for example.

    Question (resources-layer): Does your module provide own layer? Does it create any files or folders in it? What it is trying to communicate by that and with which components?

    Answer: The layer registers the Help singleton, declares some XML DTDs and their processors, installs some menu items, etc.

    Question (resources-read): Does your module read any resources from layers? For what purpose?

    Answer: Not directly. It uses lookup to find help sets, while providing an XML processor to make this easier. It provides another XML processor permitting modules to add menu items, but does not directly interpret these.

    Question (resources-mask): Does your module mask/hide/override any resources provided by other modules in their layers?

    Answer: No. However the usersguide module does mask the master help link menu item created by this module, replacing it with a similar one which jumps straight to the introductory page of the main NetBeans online help.

Lookup of components

    Question (lookup-lookup): Does your module use org.openide.util.Lookup or any similar technology to find any components to communicate with? Which ones?

    Answer: It searches for instances of javax.help.HelpSet in lookup, according to the API specification.

    Question (lookup-register): Do you register anything into lookup for other code to find?

    Answer: A singleton instance of org.netbeans.api.javahelp.Help is registered into lookup, according to the API specification. Modules may depend on its existence by requiring a token of the same name. An instance of a handler for the nbdocs URL protocol (covered in the specification) is also registered.

    Question (lookup-remove): Do you remove entries of other modules from lookup?

    Answer: No.

Execution Environment

    Question (exec-property): Is execution of your code influenced by any environment or Java system (System.getProperty) property?

    Answer: No.

    Question (exec-component): Is execution of your code influenced by any (string) property of any of your components?

    Answer:
    • OpenIDE-mergeIntoMaster - The context and key OpenIDE/mergeIntoMaster can be set as an attribute on a help set provided programmatically rather than with an XML file to customize one attribute. Such programmatic provision is rare but supported.
    • javahelp.ignore.modality - The help window through JDK 1.5.0 handles modal dialogs by reparenting the help component into a child dialog of any new modal dialog whenever it is shown, and reparenting it back into a frame whenever it is hidden. Under certain circumstances (showing two dialogs sequentially before the frame can be re-shown), it can produce a race condition in the underlying java.awt.Toolkit implementation. As a workaround, callers of DialogDisplayer.getDefault().notify(DialogDescriptor) may set the system property "javahelp.ignore.modality" to the String "true". This system property will be reset by notify(), and applied as a client property of the root pane of the dialog to be shown. JavaHelp will, in turn, ignore the appearance of any dialog whose root pane posesses the client property "javahelp.ignore.modality" with the String value "true".

    Question (exec-ant-tasks): Do you define or register any ant tasks that other can use?

    WARNING: Question with id="exec-ant-tasks" has not been answered!

    Question (exec-classloader): Does your code create its own class loader(s)?

    Answer: No.

    Question (exec-reflection): Does your code use Java Reflection to execute other code?

    Answer: There is a workaround for a Java bug (#4675772) which almost involves reflection - manually removing entries from UI defaults. Without this, the module will throw exceptions when disabled and then reënabled without a restart.

    The module is using reflection to access the ModalityExcludeAPI - offered by some JDKs and tracked as Java bug (5092094) allowing to exclude modal dialogs behaviour for certain windows - in this case the help window. .

    Question (exec-privateaccess): Are you aware of any other parts of the system calling some of your methods by reflection?

    Answer: openide-deprecated.jar calls the public API via introspection to avoid a compile-time dependency.

    Question (exec-process): Do you execute an external process from your module? How do you ensure that the result is the same on different platforms? Do you parse output? Do you depend on result code?

    Answer: No.

    Question (exec-introspection): Does your module use any kind of runtime type information (instanceof, work with java.lang.Class, etc.)?

    Answer: No.

    Question (exec-threading): What threading models, if any, does your module adhere to?

    WARNING: Question with id="exec-threading" has not been answered!

    Question (security-policy): Does your functionality require modifications to the standard policy file?

    WARNING: Question with id="security-policy" has not been answered!

    Question (security-grant): Does your code grant additional rights to some other code?

    WARNING: Question with id="security-grant" has not been answered!

Format of files and protocols

    Question (format-types): Which protocols and file formats (if any) does your module read or write on disk, or transmit or receive over the network? Do you generate an ant build script? Can it be edited and modified?

    Answer:
    • The bundled JavaHelp code reads standard help sets.
    • There is a published XML DTD for declaring the existence of a help set.
    • There is a published XML DTD for creating a menu item pointing to a help topic.
    • ObjectTag - This tag is used in HTML content to create hyperlink like label in JHContentViewer. It invokes IDE default HTML Browser to correctly display external links.

    Question (format-dnd): Which protocols (if any) does your code understand during Drag & Drop?

    Answer: N/A

    Question (format-clipboard): Which data flavors (if any) does your code read from or insert to the clipboard (by access to clipboard on means calling methods on java.awt.datatransfer.Transferable?

    Answer: N/A

Performance and Scalability

    Question (perf-startup): Does your module run any code on startup?

    Answer: Yes, it registers a global AWT window listener. This appears to be the only way to reliably tell whether a modal dialog is showing at a given time (and to receive notification when one is shown). There is a rather complex set of hacks to convert the help viewer into a nonmodal dialog and reparent it to an active modal dialog; otherwise it would be impossible to access help while a modal dialog was showing. There is an open request for AWT to support multiple application contexts, which would permit the help viewer to live in an independent context and not be blocked by modal dialogs used in NetBeans, but until this is fixed there is no known good solution to the modality problem.

    Question (perf-exit): Does your module run any code on exit?

    Answer: No.

    Question (perf-scale): Which external criteria influence the performance of your program (size of file in editor, number of files in menu, in source directory, etc.) and how well your code scales?

    Answer: Size of help set XML files (the map file especially) probably impacts parsing speed and memory consumption. Number of distinct help sets will probably impact performance as well. Exact numbers unknown, but JavaHelp appears to be pretty slow to parse and merge help sets.

    Question (perf-limit): Are there any hard-coded or practical limits in the number or size of elements your code can handle?

    Answer: When displaying help, all help sets need to be parsed by JavaHelp to determine the ID maps. For a large number of help sets, this might consume too much memory and CPU to be practical. Also when displaying "merged" help (the normal case), all help sets need to be merged together, which can also be time-consuming as their number grows.

    Question (perf-mem): How much memory does your component consume? Estimate with a relation to the number of windows, etc.

    Answer: Unknown. Help sets which are not in active use are supposed to be held softly so they could be collected.

    Question (perf-wakeup): Does any piece of your code wake up periodically and do something even when the system is otherwise idle (no user interaction)?

    Answer: No.

    Question (perf-progress): Does your module execute any long-running tasks?

    Answer: Loading and merging help sets is done asynchronously since it can be slow.

    Question (perf-huge_dialogs): Does your module contain any dialogs or wizards with a large number of GUI controls such as combo boxes, lists, trees, or text areas?

    Answer: The JavaHelp window is fairly complex, but the module only provides the frame that contains it.

    Question (perf-menus): Does your module use dynamically updated context menus, or context-sensitive actions with complicated and slow enablement logic?

    Answer: Menu items representing links to help topics are dynamically enabled or disabled. They are always enabled in case help sets have not yet been parsed, to avoid forcing a parse just to display the menu item; if selected at this time when there is no actual corresponding ID, they will do nothing. After help sets have been parsed, menu items referring to help topics which are actually available (the normal case) are enabled. In case a help topic is missing for some reason, the menu item is disabled.

    Question (perf-spi): How the performance of the plugged in code will be enforced?

    WARNING: Question with id="perf-spi" has not been answered!

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.