Plug-in - NetBeans

netbeans.org

Plug-in - NetBeans

Plug-in Module Quick Start

item and a toolbar button to the IDE.

When you select the menu item or toolbar

button, a DialogDisplayer, provided by the

NetBeans APIs, with the text “I’m plugged

in!” will be shown.

Setting Up a Plug-in

Module Project

NetBeans provides a wizard that sets

up all the basic files needed for a plug-in

module.

Creating a NetBeans

Plug-in Module Project

In NetBeans, choose File|New Project,

and under Categories select NetBeans

Plug-in Modules. NetBeans plug-in module

support provides three project types:

• Module Project. Creates a template

for a standalone plug-in module.

• Library Wrapper Module Project.

Creates a plug-in module for an external

JAR file required by one or more plug-in

modules.

• Module Suite Project. Creates a

template for a set of interdependent plugin

modules and library wrapper modules,

which you want to deploy together.

Select Module Project and click Next.

In the Name and Location panel, type

“MyFirstModule” in Project Name. Change

the Project Location to any directory on

your computer, such as c:\mymodules.

Leave the Standalone Module radio button

and the Set as Main Project checkbox

selected. Click Next.

In the Basic Module Configuration panel,

replace “yourorghere” in Code Name Base

with “myorg”, so that the whole code name

base is “org.myorg.myfirstmodule”. Notice

that the localizing bundle and the XML layer will be stored in the

package org.myorg.myfirstmodule. These files do the following:

• Localizing Bundle. Specifies language-specific strings for

internationalization.

• XML Layer. Registers items such as menus and toolbar

buttons in the NetBeans System Filesystem (see the sidebar

Plug-in Module Terms”).

Click Finish. The IDE creates the MyFirstModule project,

containing all of your sources and project metadata,

such as the project’s Ant build script.

The project opens in the IDE. You

can view its logical structure in the

Projects window (Ctrl-1) and its file

structure in the Files window (Ctrl-2).

See Figure 1.

In addition to the localizing bundle

and the XML layer, the project also

includes the following important files:

• Module Manifest. Declares that the

project is a plug-in module. In addition, it

sets some module-specific settings, such

as the location of the XML layer, the location

of the localizing bundle, and the module

version.

• Build Script. Provides a place where you can create

your own Ant targets and override those that are specified in nbproject/build-impl.xml.

• Project Metadata. Contains information such as the

project’s type, contents, platform, classpath, dependencies,

and mappings between project commands and targets

in Ant scripts.

A 1

NetBeans Platform

Config. Contains properties

used by the IDE or

Platform.

• Per-user NetBeans

P l a t f o r m C o n f i g

Contains properties

specific to your installation

of the IDE.

A

Figure 1

Logical

structure of the

new plug-in

module

First Edition N 53

More magazines by this user
Similar magazines