NetBeans Developer FAQ NetBeans Module and Rich Client Application Development NetBeans Plugin Portal Basic Terms for NetBeans Plug-in Module Development
This is the work-in-progress page for documentation about developing modules for NetBeans IDE and for developing standalone rich-client application on top of the NetBeans Platform. Anyone can contribute to this page, though NetBeans developers and writers will regularly maintain, correct, finetune, and update it.
A NetBeans module is a Java archive (JAR) file which contains Java classes written to interact with the NetBeans APIs. A module identifies itself as a module by an entry in its MANIFEST.MF file. NetBeans modules are packaged as NBM files (.nbm extension) for non-installer distribution, usually via the NetBeans Update Center. NetBeans modules are written with one of two aims in mind:
One important aspect of a NetBeans virtual filesystem is that it can fire events to notify the rest of the system when something in it changes. NetBeans listens for changes in the system filesystem, and if, for example, something creates a new object in one of the menu folders, that new item will appear in the menu.
NetBeans provides a rich set of APIs for extending the IDE and for building on top of the NetBeans Platform. The hardest part of understanding the APIs is probably to know what functionality each API provides. Below is a table listing only the most common APIs, with a brief introduction and related tutorials. Each tutorial provides related downloadable sample code.
| API | Description | Related Sample Code and Tutorials |
|---|---|---|
| Actions API | Defines global singleton actions (such as Open, Cut, Paste) which your module may use. | NetBeans Google Toolbar Module Tutorial |
| File Systems API | An API for "virtual files". NetBeans uses this API to access user files on disk, files inside JARs, and configuration data for the IDE. | File Systems API description |
| Datasystems API | "Parsed files". Provides DataObjects which wrap FileObjects and provide programmatic access to their contents. Each file type NetBeans recognizes (such as Java files or HTML files) has a corresponding DataObject subclass provided by the module that adds support for that file type. | NetBeans DataLoader Module Tutorial NetBeans Component Palette Module Tutorial |
| Nodes API | Generic hierarchy and action context. Nodes are similar to TreeNodes, but can be used in more than trees. Nodes add user-visible things such as popup menu actions, localized display names and icons to DataObjects, but can also be used without DataObjects, by themselves. The Explorer API contains a variety of UI components such as trees, lists and tables which can be used to display a node and its children. Each window system UI component (TopComponent) has one or more "activated nodes" which determine what actions are enabled when that component has focus. | NetBeans System Properties Module Tutorial |
| Windows API | Allows modules to provide window-like components, mainly through embeddable visual components called topcomponents . | NetBeans Anagram Game Module Tutorial FeedReader Tutorial |
| Palette API | Provides a palette topcomponent with drag-and-droppable content. For example, this API is used to provide groups of related tags that can be inserted in HTML file and JSP files in the IDE. | NetBeans Component Palette Tutorial NetBeans Code Snippet Tutorial |
| Refactoring API | Enables you to extend the IDE's refactoring capabilities by providing facilities for plugging your own refactorings into the IDE. | Refactoring in a BPEL Module Project Using NetBeans Enterprise Pack |
| MultiView API | Lets you display multiple perspectives of the same data. For example, the web.xml multiview editor provides an XML view and a topcomponent view. | NetBeans Visual Library in NetBeans Platform 6.0 |
| JavaHelp Integration API | Adds helpset to the IDE or an application built on the NetBeans Platform. | Connecting Help in NetBeans: From Help Set Installation to Hooking up Context-Sensitive Help |
| ... | ... | ... |
| ... | ... | ... |
| ... | ... | ... |
The general repository for commonly used API terms is the NetBeansDeveloperFAQ. Here is a list of entry points to the most common of the commonly used terms:
NBM What is an NBM?
FileObject What is a FileObject?
Filesystem What is a Filesystem?
DataObject What is a DataObject?
Dataloader What is a DataLoader?
Node What is a Node?
Cookie ...
Action ...
Lookup What is a Lookup?
NetBeans IDE 5.0 provides a set of wizards that create the basic files for various APIs. For example, when you want to implement the TopComponent class, use the New Window Component wizard to get started. After using the Window Component wizard, you have a bunch of files and sample code that you extend to build your module. Below, where an API is supported by a wizard, the wizard is listed, together with a list of files that is generated, as well as a related tutorial (with sample code) that illustrates a typical scenario.
Note that all tutorials listed below include downloadable source code, which means that you can look at examples of how to extend the files created by the wizards.| Name of Wizard | Which API(s) was the wizard created to support? | Which files, sample code, etc, does the wizard give me? | Once I have them, what can I do with these files and sample code? | Which tutorial(s) make use of this wizard? |
|---|---|---|---|---|
| New Action wizard | NetBeans Actions API | Created files: * A file that subclasses CallableSystemAction class or a file that subclasses CookieAction class . Impact on layer.xml (the module's NetBeans configuration file): * The action is registered as an instance file in the Actions folder. Shadow files are created in all the folders that you specified in the New Action wizard. For example, if you specified that the action should be registered as a global menu item, it will find itself as a shadow file in the Menu folder in the layer.xml file. If you're extending CookieAction class , a shadow file is created in the Loaders folder. (For details on shadow files, see What are .shadow files? ) | Do something with the action that the IDE created for you. For example, now that the menu item is attached to one or more of a variety of items—the main menu, a toolbar, a keyboard shortcut, the the pop-up menu of one or more of the editors (the Source Editor is made up of an XML editor, a Java editor, a JSP editor, etc), or the pop-up menu of a node in one of the windows (such as the pop-up menu of a JSP node in the Projects/Files/Favorites windows)— you need to provide the code that specifies what you want to have happen when the user invokes the action. What an action does is defined in its performAction() method. | NetBeans Google Toolbar Module Tutorial |
| New File Type wizard | NetBeans Loaders API | Created files: *DataLoader.java A class that extends UniFileLoader . (See also: What is a DataLoader? ) *DataBeanInfo.java A class that extends java.beans.SimplebeanInfo. It is used for displaying information, such as the related icon. *DataNode.java A class that extends DataNode . (See also: What is a Node? ) *DataObject.java A class that extends MultiDataObject . (See also: What is a DataObject? ) *resolver.xml Declarative resolution of MIME-type. Impact on layer.xml (the module's NetBeans configuration file): *A long list of standard actions are listed in the Loaders folder for the specified MIME type, so that the file type has these default actions (such as 'Open' and 'Save') available from the start. *The MIME resolver is registered in the Services/MIMEResolver folder. *The dummy template is registered in the Templates/Other folder. This means that when the user opens the New File wizard, the dummy template will be in the Other folder. (You can change the position of the template, as well as, of course, its content.) | Now that the IDE (or your application built on top of the NetBeans Platform) recognizes your file type as being distinct from all other file types, you can provide a lot of functionality specifically for the newly-recognized file type (such as menu items, dialog boxes, wizards, syntax highlighting, code completion, multiview editors, code folding, component palettes, etc. etc. etc. For all of these features, the starting point is that the IDE is able to identify a file type as being distinct) and that's why the first step is to run through the New File Type wizard so that the basic file type recognition files are generated for you. | NetBeans DataLoader Module Tutorial NetBeans Component Palette Module Tutorial |
| New Project Template wizard | WizardDescriptor class | Created files: *.ZIP file (containing the project that forms the basis of the project template or sample) *WizardIterator.java *PanelVisual.java *WizardPanel.java *.HTML file (for the description area in the New File wizard) Impact on layer.xml (the module's NetBeans configuration file): *The template is registered in the Templates/Project folder, within the subfolder that you indicated in the wizard. This means that when the user opens the New Project wizard, the template will be in the specified folder. (You can change the position of the template after using the wizard.) | Extend the files to finetune a template that users build on when creating their own project. For example, in the IDE a user chooses the 'Web Application' project template in the New Project wizard, then the IDE creates a project consisting of a JSP file, a web.xml file, a server-specific deployment file, and project metadata within a specific structure that is useful for web application projects. Alternatively, extend the files to finetune a sample that illustrate some aspect of project functionality. For example, in the Samples directory within the New Project wizard, an Anagram Game is included to demonstrate J2SE functionality. Samples are a kind of project template; they have the same behavior as project templates, but they are used for a different purpose. | NetBeans Project Template Module Tutorial NetBeans Project Sample Module Tutorial |
| New Window Component wizard | TopComponent class | Created files: *TopComponent.java A class that extends the TopComponent class. The TopComponent subclass includes the following methods when you use the New Window Component wizard: *getDefault() *getPersistenceType() *componentOpened() *componentClosed() *writeReplace() *preferredID() *Action.java An action that the layer.xml file registers in the Window menu. The IDE creates this Action class to display the component. *TopComponentSettings.xml *TopComponentWstcref.xml These files dock, instantiate, and load the window. There should be no need to touch these files at all. These files need to be registered in the layer.xml file. The Window Component wizard does this for you automatically. Impact on layer.xml (the module's NetBeans configuration file): *The action is registered in the Actions folder, with a shadow file registered in the Menu/Window folder. For details on shadow files, see What are .shadow files? ). *TopComponentSettings.xml is registered in the Windows2/Components folder. *TopComponentWstcref.xml is registered in the Windows2/Modes/your-selected-position folder. | Extend the TopComponent implementation to create a window (also known as 'view') for a module. For example, the IDE's Projects window is a 'window', just as the Navigator, Output window, Palette, and Debugger. The multiview editor used by the web.xml file is also a topcomponent , so you would use the Window Component wizard to create a basic implementation of this class. | ... |
| New Wizard wizard | WizardDescriptor class | Created files: The Wizard wizard's first panel lets you set a 'Registration Type' ('Custom' or 'New File') and a 'Wizard Step Sequence' ('Static' or 'Dynamic'). The consequences of these selections are outlined below: *Registration Type: Custom Wizard Step Sequence: Static ---- Created files: *SampleAction.java *VisualPanel.java (for each wizard step) *WizardPanel.java (for each wizard step) These files are ideal for uncomplicated wizards that progress sequentially from panel to panel without divergences or reversals. A menu item or toolbar button invokes the wizard and subsequent steps are generally linear and forward-directed. An example of this type of wizard is the Update Center wizard, which does not allow you to skip steps. It does not branch off or change direction based on choices made by the user. *Registration Type: Custom Wizard Step Sequence: Dynamic ---- Created files: *WizardIterator.java * VisualPanel.java (for each wizard step) *WizardPanel.java (for each wizard step) These files are for wizards that provide more flexibility to the user. A WizardDescriptor.Iterator class guides progress from one panel to the next. The developer has a lot more freedom in coding the wizard, but has a more complex task since there are many more possibilities to consider. Even though the Custom/Simple wizard type can also be extended to provide support for panel skipping and reversals, the Custom/Dynamic type was made for this purpose. For example, the Add Server Instance wizard offers different panels depending on the type of server that the user wants to register. *Registration Type: New File Wizard Step Sequence: Not Applicable ---- Created files: *WizardIterator.java *VisualPanel.java (for each wizard step) *WizardPanel.java (for each wizard step) *.HTML file (for the description area in the New File wizard) These files are for wizards that are used to create new files. This wizard is registered in the New File wizard via the layer.xml file. All the necessary entries in the layer.xml file are created for you by the Wizard wizard. In addition, when you make this choice, the Wizard wizard creates a WizardDescriptor.Iterator | Add user interface components to the visualpanels and wire them to their related wizardpanels so that the information is correctly passed from one to the other. Finetune the wizard's steps, graphics, left side-bar text, and a user panel on the right. For more complex wizards, set the sequences that the user will follow when using the wizard. | ... |
(coming soon)
(coming soon)