Setup
page to the Enterprise Setup dialog that comes up when the user chooses Tools|Enterprise Setup.
This dialog brings up various custom Setup pages that can be used to let the user set up some custom tools that might be added to JBuilder. JBuilder itself uses this Setup mechanism for setting up CORBA, Application Servers, and Database Drivers. Although this menu is titled Enterprise Setup, it's available in both Enterprise and Professional versions, although only the Database Drivers Setup page is available from in the Professional version.
The basic process for adding your own Setup is to register a class that extends the Setup
abstract class, and also to provide a class that extends either the SetupPropertyPage
class or the NestingSetupPropertyPage
class. These page classes are extensions of the PropertyPage
class, and they are the ones that define the actual controls that will be used to provide the setup values.
The classes and interfaces that are used for the OpenTools Setup mechanism reside in the com.borland.jbuilder.ide
package. They consist of:
Setup
abstract class, and define all of its abstract functions. You should then define an initOpenTools()
method to register this class with the SetupManager
as shown in the following example:
public static void initOpenTool(byte majorVersion, byte minorVersion) { SetupManager.registerSetup(new AppServerSetup()); }This adds a Setup that appears at the highest level tab list in the Enterprise Setup dialog. If you provide an optional second argument to
registerSetup()
that is the name of an existing Setup, the setup you register will appear as a tab underneath the existing Setup's tab. However, make sure that the existing Setup is one that provides a NestingSetupPropertyPage
definition. Here is an example:
public static void initOpenTool(byte majorVersion, byte minorVersion) { SetupManager.registerSetup(new IASSetup(), AppServerSetup.APPSERVER_SETUP_NAME); }You must also provide a class that extends the
SetupPropertyPage
class, or the NestedPropertyPageClass
. This class provides a JPanel
with controls to display on its Setup page. This class should be instantiated and returned in the implementation of the getSetupPropertyPage()
function in your extended Setup
class. Here's an example:
public PropertyPage getSetupPropertyPage(final Browser browser) { return new IASSetupPage(browser, getName()); }
getName()
- returns the name of this Setup
. This will be used as the title of the tab that displays controls for this Setup.
isEnabled()
- determines under which conditions this Setup
should be enabled. If it's not enabled, its page won't show up in the dialog.
getSetupPropertyPage()
- returns the actual page that will display the controls used to set up your tool. This can be a nested page, that will display other SetupPropertyPages
. SetupPropertyPage
is an abstract class that extends the PropertyPage
class; it requires you to implement two functions:
getDescription()
- returns a description of what the user should do on this page. This description will appear as text at the top of the page.
createSetupPanel()
- returns a JPanel
that will be displayed under the description text, and will contain the controls necessary to set up your tool. If you are extending NestingSetupPropertyPage
, all you need to define is the getDescription()
method and the subordinate pages will be added by the Setup internal mechanism.