Extension SDK

oracle.ide
Class WizardManager

java.lang.Object
  extended byoracle.ide.WizardManager
All Implemented Interfaces:
Controller

public final class WizardManager
extends java.lang.Object
implements Controller

WizardManager provides the interface through which the IDE handles Wizards.

Wizards use the WizardManager to register themselves as Wizards.

In addition, Wizards or other classes can use the WizardManager to retrieve the list of currently registered Wizards.

If a Wizard does not need to be notified on startup and shutdown from the IDE, then the Wizard does not need to register itself as an Addin from the IDE, but can simple register itself as a wizard. Most Wizard instances that fit this description are invoked from the New Object Gallery. In this case, when the New Object Gallery is first created, all Wizard instances which are not already loaded from the AddinManager, will be initialized at this time.

The current WizardManager can be retrieved by calling WizardManager.getInstance().

See Also:
Wizard

Field Summary
static java.lang.String OPEN_WIZARD_CMD
           
static int OPEN_WIZARD_CMD_ID
           
 
Method Summary
 void checkCommands(Context context, Controller activeController)
          checkCommands() should be called on the controller associated with the active view whenever the Context changes.
static WizardManager getInstance()
          The WizardManager object is a singleton class.
 Wizard getWizard(java.lang.Class clazz)
          Gets the Wizard matching the given class, otherwise the first Wizard of a class which is assignable from the given class is returned.
 Wizard getWizard(java.lang.String className)
          Returns the first addin whos class is assignable from the given class name
 java.util.Iterator getWizards()
          Returns an Iterator on the list of currently registered Wizards.
 boolean handleEvent(IdeAction action, Context context)
          Handles a command when a user interaction with a View triggers the execution of a command.
 void invokeSecondaryWizard(Invokable invokable, Context context, java.lang.String[] params)
          This method should be used to launch a wizard from another wizard.
 void registerWizard(Wizard wizard)
          Registers a wizard with the Wizard Manager.
 void registerWizard(Wizard wizard, boolean addToMenu)
          Registers a wizard with the Wizard Manager.
 Controller supervisor()
          Gets the supervising controller.
 boolean update(IdeAction action, Context context)
          Invoked when the availability of a specific command needs to be determined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_WIZARD_CMD_ID

public static final int OPEN_WIZARD_CMD_ID

OPEN_WIZARD_CMD

public static final java.lang.String OPEN_WIZARD_CMD
See Also:
Constant Field Values
Method Detail

getInstance

public static WizardManager getInstance()
The WizardManager object is a singleton class. This method gets this object's single instance.

Returns:
the WizardManager single instance.

getWizard

public Wizard getWizard(java.lang.Class clazz)
Gets the Wizard matching the given class, otherwise the first Wizard of a class which is assignable from the given class is returned. If no Wizard is found, then a null is returned.

Parameters:
clazz - The class name of the wizard to return.

getWizard

public Wizard getWizard(java.lang.String className)
Returns the first addin whos class is assignable from the given class name


registerWizard

public void registerWizard(Wizard wizard,
                           boolean addToMenu)
Registers a wizard with the Wizard Manager. If the addToMenu parameter is true, then registering a Wizard will also create the menu item for the Wizard under the "Tools" menu, if the Wizard returns a non-null MenuSpec from the getMenuSpecification method.

Parameters:
wizard - the Wizard being registered.
addToMenu - Should Wizard menu item be added to the Tools -> Wizards sub-menu.

See Also:
Wizard.getMenuLabel(), registerWizard(Wizard)

registerWizard

public void registerWizard(Wizard wizard)
Registers a wizard with the Wizard Manager. Registering a Wizard will also create the menu item for the Wizard under the "Tools" menu, provided the Wizard returns a non-null MenuSpec from getMenuSpecification.

Parameters:
wizard - the Wizard being registered.
See Also:
Wizard.getMenuLabel(), registerWizard(Wizard)

getWizards

public java.util.Iterator getWizards()
Returns an Iterator on the list of currently registered Wizards.

Returns:
Iterator on the list of the registered Wizards.

supervisor

public Controller supervisor()
Gets the supervising controller. The WizardManager does not have a supervising controller, therefore the return value will always be null from this method.

Specified by:
supervisor in interface Controller
Returns:
null. since this is a root controller.

handleEvent

public boolean handleEvent(IdeAction action,
                           Context context)
Handles a command when a user interaction with a View triggers the execution of a command.

Specified by:
handleEvent in interface Controller
Parameters:
action - The IdeAction which contains the Command to be executed.
context - The current Context of the IDE to use when executing this command.

Returns:
true if the controller handles the specified command, and false otherwise.

See Also:
CommandProcessor, IdeAction, Command, Context, View

update

public boolean update(IdeAction action,
                      Context context)
Invoked when the availability of a specific command needs to be determined. This method is responsible for setting the enabled state on the action given as a parameter.

Specified by:
update in interface Controller
Parameters:
action - the action associated with this command. Call the action's setEnabled method to set the appropriate command sensitivity.
context - The current Context of the IDE to use when determining the availability of this IdeAction

Returns:
true if the controller handles the specified command.

See Also:
AbstractAction.setEnabled(boolean)

checkCommands

public void checkCommands(Context context,
                          Controller activeController)
Description copied from interface: Controller
checkCommands() should be called on the controller associated with the active view whenever the Context changes. The method gives the controller a chance to assign the enabled/disabled status of each of the context-sensitive Actions it owns. Calling this method on the active controller should cause all context-sensitive Actions owned by this controller and its supervisor's to be updated. No two controllers should attempt to update the status of the same action or else we would have redundant checking, which we want to avoid. checkCommands() should end by calling supervisor().checkCommands() to make sure actions dealt with by higher-level controllers get updated as well. This method is implemented by BaseController to call checkCommands() on the Ide itself. Note that the only context-sensitive Actions should be updated inside a checkCommands() method. Updating the enabled/disabled state of an action is handled by the update() command.

Specified by:
checkCommands in interface Controller
Parameters:
context - the current context. Null values are acceptable.
activeController - the controller associated with the active view. Null values are acceptable.

invokeSecondaryWizard

public void invokeSecondaryWizard(Invokable invokable,
                                  Context context,
                                  java.lang.String[] params)
This method should be used to launch a wizard from another wizard. It post an event that in turn posts an event to invoke the new Wizard. This two-stage event posting is necessary in order to ensure that any cleanup needed when we close the first wizard occurs BEFORE we bring up the new Wizard.


Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.