Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.wizards
Class AbstractSystemWizard

java.lang.Object
  extended by 

org.eclipse.jface.wizard.Wizard
      extended by 
org.eclipse.rse.ui.wizards.AbstractSystemWizard
All Implemented Interfaces:
IWizard, ISystemPromptDialog, ISystemWizard, INewWizard, IWorkbenchWizard
Direct Known Subclasses:
SystemNewFilterWizard, SystemNewProfileWizard

public abstract class AbstractSystemWizard
extends Wizard
implements ISystemWizard

Base class for all RSE wizards. This class is more beneficial when using in conjunction with AbstractSystemWizardPage, and SystemBaseWizardAction.

A wizard is a multi-page UI, that prompts users for information and then uses that information to create something (typically). The wizard has an overall title that shows for each page, and a wizard page title that can be unique per page, but typically is not. Typically, the overall title is a verb, such as "New", while the page title expands on the verb, as in "File". There is also a description per page, which is unique and explains the purpose of that page. Further, there is a wizard image that is always the same per wizard page.

Using this base class for wizards offers the following advantages over just using the eclipse Wizard class:

  • Designed to work in conjunction with the SystemBaseWizardAction, and SystemWizardDialog classes, propogating settings from these to the wizard, and further propogating those to the individual wizard pages.
  • The overall wizard title and image can be set via the constructor or setter methods.
  • Supports setting an input object, and getting an output object. This is exploited by the SystemBaseWizardAction class, when this wizard is launched from a subclass of that action class.
  • Supports setting a wizard page title via setWizardPageTitle(String), that all AbstractSystemWizardPage pages will use by default for their title, if the non-title constructor is used for that page.
  • If being hosted by a SystemWizardDialog, supports dynamically updating the wizard size via updateSize(), if dynamic content is added to a wizard page, causing the page to grow beyond its initial size.
  • Supports a setHelp(String) method to set the overall wizard's contextual help. This is propogated to each AbstractSystemWizardPage as it is added.
  • Supports setting the viewer that launched this wizard, as wizards often need to know this so they can update the UI upon Finish.
  • Supports a wasCancelled() method so callers can easily test if the wizard was cancelled/dismissed by the user.
  • Supports a setMinimumPageSize(int, int) method to set the minimum width and height of the wizard.
  • Supports a setPageError(IWizardPage) method that can be called in performFinish when an error is detected on a non-current page. This issues a message telling the user there is an error on another page.

To use this class, :

  1. Subclass it.
  2. In your constructor, call setHelp(String) to set the overall help, if desired.
  3. In your constructor, call setWizardPageTitle(String) to set the title to use for all pages, if desired.
  4. Override addPages() to add your pages via calls to addPage(IWizardPage).
  5. Override performFinish() to do the wizard's main task when Finish is pressed. Cycle through each of your pages calling performFinish() on each of them. If performFinish() returns false from any page, call setPageError(IWizardPage) and return false from your performFinish() method to cancel the Finish operation.

See Also:
AbstractSystemWizardPage, SystemWizardDialog, SystemBaseWizardAction

Field Summary
protected  boolean cancelled
           
protected  boolean finishPressed
           
protected   String helpId
           
protected   Object input
           
protected  int minPageHeight
           
protected  int minPageWidth
           
protected   Object output
           
protected   SystemWizardDialog owningDialog
           
protected   String pageTitle
           
protected   IStructuredSelection selection
           
protected   Viewer viewer
           
 
Fields inherited from class org.eclipse.jface.wizard. Wizard
DEFAULT_IMAGE
 
Constructor Summary
AbstractSystemWizard ()
          Default constructor.
AbstractSystemWizard ( String title)
          Constructor when wizard title is known.
AbstractSystemWizard ( String title, ImageDescriptor wizardImage)
          Constructor when you both a title and an image for this wizard.
 
Method Summary
 void addPage ( IWizardPage page)
          Intercept of parent method so we can percolate the help id
abstract  void addPages ()
          Creates the wizard pages.
protected   ISystemTree getCurrentTreeView ()
          Return the current viewer as an ISystemTree if it is one, or null otherwise
  String getHelpContextId ()
          Return the help Id as set in setHelp(String)
  Object getInputObject ()
          For explicitly getting input object
 int getMinimumPageHeight ()
          Return the minimum page height.
 int getMinimumPageWidth ()
          Return the minimum page width.
  Object getOutputObject ()
          For explicitly getting output object after wizard is dismissed.
  SystemWizardDialog getSystemWizardDialog ()
          Return the result of setSystemWizardDialog(SystemWizardDialog)
  Viewer getViewer ()
          Get the Viewer that called this wizard.
  String getWizardPageTitle ()
          Return the page title as set via setWizardPageTitle
 void init ( IWorkbench workbench, IStructuredSelection selection)
          Required by INewWizard interface.
 boolean performCancel ()
          Override of parent so we can record the fact the wizard was cancelled.
abstract  boolean performFinish ()
          Called when finish pressed.
 int publicConvertHeightInCharsToPixels (int chars)
          Expose inherited protected method convertHeightInCharsToPixels as a publicly excessible method Requires setOwningDialog to have been called, else returns -1
 int publicConvertWidthInCharsToPixels (int chars)
          Expose inherited protected method convertWidthInCharsToPixels as a publicly excessible method Requires setOwningDialog to have been called, else returns -1
 void setHelp ( String id)
          Set the help context Id (infoPop) for this wizard.
 void setInputObject ( Object inputObject)
          For explicitly setting input object
 void setMinimumPageSize (int width, int height)
          Set the wizard's min page width and height.
 void setOutputObject ( Object outputObject)
          For explicitly setting output object after wizard is dismissed.
 void setPageError ( IWizardPage pageInError)
          If in the processing of performFinish an error is detected on another page of the wizard, the best we can do is tell the user this via an error message on their own page.
 void setSystemWizardDialog ( SystemWizardDialog dlg)
          Called from SystemWizardDialog when it is used as the hosting dialog
 void setViewer ( Viewer v)
          Set the Viewer that called this wizard.
protected  void setWasCancelled (boolean cancelled)
          You must call this in your performFinish method.
 void setWizardImage ( ImageDescriptor wizardImage)
          Set the wizard image.
 void setWizardPageTitle ( String pageTitle)
          Set the wizard page title.
 void setWizardTitle ( String title)
          Set the wizard title.
 void updateSize ()
          Exposes this nice new 2.0 capability to the public.
 boolean wasCancelled ()
          Allow caller to determine if wizard was cancelled or not.
 
Methods inherited from class org.eclipse.jface.wizard. Wizard
canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getShell, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, setContainer, setDefaultPageImageDescriptor, setDialogSettings, setForcePreviousAndNextButtons, setHelpAvailable, setNeedsProgressMonitor, setTitleBarColor, setWindowTitle
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.wizard. IWizard
canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, setContainer
 

Field Detail

finishPressed

protected boolean finishPressed

cancelled

protected boolean cancelled

input

protected 
Object input

output

protected 
Object output

selection

protected 
IStructuredSelection selection

minPageWidth

protected int minPageWidth

minPageHeight

protected int minPageHeight

helpId

protected 
String helpId

viewer

protected 
Viewer viewer

pageTitle

protected 
String pageTitle

owningDialog

protected 
SystemWizardDialog owningDialog
Constructor Detail

AbstractSystemWizard

public AbstractSystemWizard()
Default constructor.

See Also:
setWizardTitle(String), setWizardImage(ImageDescriptor), setWizardPageTitle(String)

AbstractSystemWizard

public AbstractSystemWizard(
String title)
Constructor when wizard title is known. Alternatively, you can call setWizardTitle(String)

See Also:
setWizardImage(ImageDescriptor), setWizardPageTitle(String)

AbstractSystemWizard

public AbstractSystemWizard(
String title,
                            
ImageDescriptor wizardImage)
Constructor when you both a title and an image for this wizard. Alternatively, you can call setWizardTitle(String) or setWizardImage(ImageDescriptor)

See Also:
setWizardPageTitle(String)
Method Detail

setSystemWizardDialog

public void setSystemWizardDialog(
SystemWizardDialog dlg)
Called from SystemWizardDialog when it is used as the hosting dialog

Specified by:
setSystemWizardDialog in interface ISystemWizard

getSystemWizardDialog

public 
SystemWizardDialog getSystemWizardDialog()
Return the result of setSystemWizardDialog(SystemWizardDialog)

Specified by:
getSystemWizardDialog in interface ISystemWizard

updateSize

public void updateSize()
Exposes this nice new 2.0 capability to the public. Only does anything if being hosted by SystemWizardDialog.

Specified by:
updateSize in interface ISystemWizard

setWizardTitle

public void setWizardTitle(
String title)
Set the wizard title. Using this makes it possible to avoid subclassing. Typically the wizard title is the same for all pages... eg "New"


setWizardPageTitle

public void setWizardPageTitle(
String pageTitle)
Set the wizard page title. Using this makes it possible to avoid subclassing. The page title goes below the wizard title, and can be unique per page. However, typically the wizard page title is the same for all pages... eg "Filter".

This is not used by default, but can be queried via getPageTitle() when constructing pages.

Specified by:
setWizardPageTitle in interface ISystemWizard

getWizardPageTitle

public 
String getWizardPageTitle()
Return the page title as set via setWizardPageTitle

Specified by:
getWizardPageTitle in interface ISystemWizard

setWizardImage

public void setWizardImage(
ImageDescriptor wizardImage)
Set the wizard image. Using this makes it possible to avoid subclassing


setHelp

public void setHelp(
String id)
Set the help context Id (infoPop) for this wizard. This must be fully qualified by plugin ID.

Same as #setHelp(String)

Specified by:
setHelp in interface ISystemWizard
See Also:
#getHelpContextId()

getHelpContextId

public 
String getHelpContextId()
Return the help Id as set in setHelp(String)

Specified by:
getHelpContextId in interface ISystemWizard

addPage

public void addPage(
IWizardPage page)
Intercept of parent method so we can percolate the help id

Overrides:
addPage in class Wizard

setViewer

public void setViewer(
Viewer v)
Set the Viewer that called this wizard. It is good practice for actions to call this so wizard can directly access the originating viewer if needed.

This is called for you if using a subclass of SystemBaseWizardAction.

Specified by:
setViewer in interface ISystemWizard

getViewer

public 
Viewer getViewer()
Get the Viewer that called this wizard. This will be null unless set by the action that started this wizard.

Specified by:
getViewer in interface ISystemWizard

getCurrentTreeView

protected 
ISystemTree getCurrentTreeView()
Return the current viewer as an ISystemTree if it is one, or null otherwise


setInputObject

public void setInputObject(
Object inputObject)
For explicitly setting input object

Specified by:
setInputObject in interface ISystemPromptDialog

getInputObject

public 
Object getInputObject()
For explicitly getting input object

Specified by:
getInputObject in interface ISystemPromptDialog

getOutputObject

public 
Object getOutputObject()
For explicitly getting output object after wizard is dismissed. Set by the wizard's processFinish method.

Specified by:
getOutputObject in interface ISystemPromptDialog

setOutputObject

public void setOutputObject(
Object outputObject)
For explicitly setting output object after wizard is dismissed. Called in the wizard's processFinish method, typically.

Specified by:
setOutputObject in interface ISystemPromptDialog

wasCancelled

public boolean wasCancelled()
Allow caller to determine if wizard was cancelled or not.

Specified by:
wasCancelled in interface ISystemPromptDialog

setWasCancelled

protected void setWasCancelled(boolean cancelled)
You must call this in your performFinish method.


performCancel

public boolean performCancel()
Override of parent so we can record the fact the wizard was cancelled.

Specified by:
performCancel in interface IWizard
Overrides:
performCancel in class Wizard

init

public void init(
IWorkbench workbench,
                 
IStructuredSelection selection)
Required by INewWizard interface. It is called by the framework for wizards that are launched file the File->New interface. Otherwise we don't use it. If you need it, the selection is stored in protected variable "selection".

Specified by:
init in interface IWorkbenchWizard

setMinimumPageSize

public void setMinimumPageSize(int width,
                               int height)
Set the wizard's min page width and height. If you pass 0 for either one, the Eclipse default value will be used.

Specified by:
setMinimumPageSize in interface ISystemWizard

getMinimumPageWidth

public int getMinimumPageWidth()
Return the minimum page width. If zero, it has not been explicitly set, so the default is to be used.

Specified by:
getMinimumPageWidth in interface ISystemWizard

getMinimumPageHeight

public int getMinimumPageHeight()
Return the minimum page height. If zero, it has not been explicitly set, so the default is to be used.

Specified by:
getMinimumPageHeight in interface ISystemWizard

setPageError

public void setPageError(
IWizardPage pageInError)
If in the processing of performFinish an error is detected on another page of the wizard, the best we can do is tell the user this via an error message on their own page. It seems there is no way in JFace to successfully switch focus to another page.

To simplify processing, simply call this method in your wizard's performFinish if any page's performFinish returned false. Pass the failing page. If it is not the current page, this code will issue msg RSEG1240 "Error on another page" to the user.


publicConvertWidthInCharsToPixels

public int publicConvertWidthInCharsToPixels(int chars)
Expose inherited protected method convertWidthInCharsToPixels as a publicly excessible method

Requires setOwningDialog to have been called, else returns -1

Specified by:
publicConvertWidthInCharsToPixels in interface ISystemPromptDialog

publicConvertHeightInCharsToPixels

public int publicConvertHeightInCharsToPixels(int chars)
Expose inherited protected method convertHeightInCharsToPixels as a publicly excessible method

Requires setOwningDialog to have been called, else returns -1

Specified by:
publicConvertHeightInCharsToPixels in interface ISystemPromptDialog

addPages

public abstract void addPages()
Creates the wizard pages. This method is an override from the parent Wizard class, but is made abstract here to ensure child classes override it.

Specified by:
addPages in interface IWizard
Overrides:
addPages in class Wizard

performFinish

public abstract boolean performFinish()
Called when finish pressed.

Return true if no errors, false to cancel the finish operation.

Typically, you walk through each wizard page calling performFinish on it, and only return true if they all return true. If one of the pages returns false, you should call setPageError(IWizardPage), which shows a message to the user about an error pending on another page, if the given page is not the current page.

Specified by:
performFinish in interface IWizard
Specified by:
performFinish in class Wizard

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire