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.propertypages
Class SystemBasePropertyPage

java.lang.Object
  extended by 

org.eclipse.jface.dialogs.DialogPage
      extended by 

org.eclipse.jface.preference.PreferencePage
          extended by 

org.eclipse.ui.dialogs.PropertyPage
              extended by 
org.eclipse.rse.ui.propertypages.SystemBasePropertyPage
All Implemented Interfaces:
IDialogPage, IMessageProvider, IPreferencePage, ISystemMessageLine, ISystemMessageLineTarget, IWorkbenchPropertyPage
Direct Known Subclasses:
ServicesPropertyPage, SystemChangeFilterPropertyPage, SystemFilterStringPropertyPage, SystemSubSystemPropertyPageCore, SystemTeamViewCategoryPropertyPage

public abstract class SystemBasePropertyPage
extends PropertyPage
implements ISystemMessageLine, ISystemMessageLineTarget

A base class for property pages that offers value over the base Eclipse PropertyPage class:

  • Adds a message line and ISystemMessageLine message methods.
  • Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}.
  • If no Default and Apply buttons wanted (default), the area reserved for this is removed, removing extra white space.
  • For pages with input controls, simplifies the page validation burden: only one method need be overridden: verifyPageContents()
    To do on-the-fly validation, in your handler calling setErrorMessage/clearErrorMessage automatically calls setValid, although you can call it directly too if you desire.
    verifyPageContents is called by default by performOk (be sure to call super.performOk if you override), and for multiple property pages, is called when another one is selected.

To get these benefits you must override createContentArea(Composite) instead of createContents. Our base implementation of createContents configures the message line and then calls createContentArea and then assigns mnemonics to the content area.


Field Summary
protected   Composite buttonsComposite
           
protected   Composite contentArea
           
protected   ISystemMessageLine msgLine
           
protected  boolean msgLineSet
           
 
Fields inherited from interface org.eclipse.jface.dialogs. IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
SystemBasePropertyPage ()
          Constructor for SystemBasePropertyPage
 
Method Summary
protected   Label addFillerLine ( Composite parent, int nbrColumns)
          Helper method.
protected   Label addSeparatorLine ( Composite parent, int nbrColumns)
          Helper method.
 void clearErrorMessage ()
          ISystemMessageLine method.
 void clearMessage ()
          ISystemMessageLine method.
protected  void configureMessageLine ()
           Private.
protected  void contributeButtons ( Composite buttonBar)
           Private.
protected abstract   Control createContentArea ( Composite parent)
           Abstract.
protected   Control createContents ( Composite parent)
          Parent intercept.
protected   Combo createLabeledCombo ( Composite c, String label, String tooltip)
          Create a labeled combo, where the combo on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.
protected   Label createLabeledLabel ( Composite c, String label, String tooltip)
          Create a labeled label, where the label on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.
protected   Text createLabeledText ( Composite c, String label, String tooltip)
          Create a labeled entry field, where the field on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.
protected   Label createLabeledVerbiage ( Composite c, String label, String tooltip)
          Create a labeled verbiage field, where the field on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.
  ISystemMessageLine getMessageLine ()
          ISystemMessageLineTarget method.
  SystemMessage getSystemErrorMessage ()
          ISystemMessageLine method.
protected   Control grabExcessSpace ( Control control)
          Sets this control to grab any excess horizontal space left in the window.
 boolean okToLeave ()
          Parent intercept.
 boolean performOk ()
          Method declared on IPreferencePage.
 void setBusyCursor (boolean setBusy)
          Helper method.
 void setErrorMessage ( String message)
          ISystemMessageLine method.
 void setErrorMessage ( SystemMessage message)
          ISystemMessageLine method.
 void setErrorMessage ( Throwable exc)
          ISystemMessageLine method.
 void setHelp ( String helpId)
          For setting the default overall help for the dialog.
 void setMessage ( String message)
          ISystemMessageLine method.
 void setMessage ( SystemMessage message)
          ISystemMessageLine method.
 void setMessageLine ( ISystemMessageLine msgLine)
          ISystemMessageLineTarget method.
protected abstract  boolean verifyPageContents ()
           Abstract.
protected  boolean wantAutomaticValidManagement ()
          Configuration method.
protected  boolean wantDefaultAndApplyButton ()
          Configuration method.
protected  boolean wantMnemonics ()
          Configuration method.
 
Methods inherited from class org.eclipse.ui.dialogs. PropertyPage
getElement, setElement
 
Methods inherited from class org.eclipse.jface.preference. PreferencePage
applyData, applyDialogFont, computeSize, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, performApply, performCancel, performDefaults, performHelp, setContainer, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
 
Methods inherited from class org.eclipse.jface.dialogs. DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setVisible
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.ui.messages. ISystemMessageLine
getErrorMessage, getMessage
 
Methods inherited from interface org.eclipse.jface.preference. IPreferencePage
computeSize, isValid, performCancel, setContainer, setSize
 
Methods inherited from interface org.eclipse.jface.dialogs. IDialogPage
createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
 

Field Detail

msgLine

protected 
ISystemMessageLine msgLine

msgLineSet

protected boolean msgLineSet

contentArea

protected 
Composite contentArea

buttonsComposite

protected 
Composite buttonsComposite
Constructor Detail

SystemBasePropertyPage

public SystemBasePropertyPage()
Constructor for SystemBasePropertyPage

Method Detail

createContents

protected 
Control createContents(
Composite parent)
Parent intercept. No need to call or override.
Our base implementation of createContents configures them message line and then calls createContentArea(Composite) and then assigns mnemonics to the content area. Also calls PreferencePage.noDefaultAndApplyButton() if wantDefaultAndApplyButton() returns false.

Specified by:
createContents in class PreferencePage
See Also:
PreferencePage.createContents(Composite), createContentArea(Composite)

wantDefaultAndApplyButton

protected boolean wantDefaultAndApplyButton()
Configuration method. Override only to change the default.
Return true if you want to see Apply and Restore Defaults buttons. This is queried by the default implementation of createContents and the default is false, we don't want to see them. Default is false.


wantMnemonics

protected boolean wantMnemonics()
Configuration method. Override only to change the default.
Return false if you don't want to have mnemonics automatically applied to your page by this parent class. Default is true.


wantAutomaticValidManagement

protected boolean wantAutomaticValidManagement()
Configuration method. Override only to change the default.
Return false if you don't want to automatically set whether the page is valid based on error message status. Default is true


setHelp

public void setHelp(
String helpId)
For setting the default overall help for the dialog. This can be overridden per control by calling SystemWidgetHelpers.setHelp(Control, String)


createContentArea

protected abstract 
Control createContentArea(
Composite parent)
Abstract. You must override.
This is where child classes create their content area versus createContent, in order to have the message line configured for them and mnemonics assigned.


configureMessageLine

protected void configureMessageLine()
Private. No need to call or override.
Configure the message line if not already. Called for you if you override createContentArea versus createContents, else you might choose to call it yourself.


contributeButtons

protected void contributeButtons(
Composite buttonBar)
Private. No need to call or override.
Override of parent to delete the button bar since we don't use it, and to make this page fit on a 800x600 display

Overrides:
contributeButtons in class PreferencePage

okToLeave

public boolean okToLeave()
Parent intercept. No need to call or override.
The PreferencePage implementation of this IPreferencePage method returns true if the page is valid.

We first test isValid() just like our parent implementation does, but since that only represents the valid state of the last control the user interacted with, we also call verifyPageContents.

Subclasses must override verifyPageContents() to do full error checking on all the widgets on the page.

Specified by:
okToLeave in interface IPreferencePage
Overrides:
okToLeave in class PreferencePage

verifyPageContents

protected abstract boolean verifyPageContents()
Abstract. You must override. Return true if no input fields to check.
Validate all the widgets on the page. Based on this, the Eclipse framework will know whether to veto any user attempt to select another property page from the list on the left in the Properties dialog.

Subclasses should override to do full error checking on all the widgets on the page. Recommendation:

Returns:
true if there are no errors, false if any errors were found.

performOk

public boolean performOk()
Method declared on IPreferencePage. Our implementation is to call okToLeave(), which in turn calls verifyPageContents, returning true iff they do. If you override, call super.performOk() to get default processing, and return false if that returns false.

Specified by:
performOk in interface IPreferencePage
Overrides:
performOk in class PreferencePage
Returns:
true if all is well, false if there is an error.

setMessageLine

public void setMessageLine(
ISystemMessageLine msgLine)
ISystemMessageLineTarget method.
Set the message line to use for issuing messages

Specified by:
setMessageLine in interface ISystemMessageLineTarget

getMessageLine

public 
ISystemMessageLine getMessageLine()
ISystemMessageLineTarget method.
Get the message line to use for issuing messages

Specified by:
getMessageLine in interface ISystemMessageLineTarget

setBusyCursor

public void setBusyCursor(boolean setBusy)
Helper method.
Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).


addSeparatorLine

protected 
Label addSeparatorLine(
Composite parent,
                                 int nbrColumns)
Helper method.
Add a separator line. This is a physically visible line.


addFillerLine

protected 
Label addFillerLine(
Composite parent,
                              int nbrColumns)
Helper method.
Add a spacer line


grabExcessSpace

protected 
Control grabExcessSpace(
Control control)
Sets this control to grab any excess horizontal space left in the window. This is useful to do in a property page to force all the labels on the right to not be squished up on the left.

Parameters:
control - the control for which to grab excess space

createLabeledLabel

protected 
Label createLabeledLabel(
Composite c,
                                   
String label,
                                   
String tooltip)
Create a labeled label, where the label on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.

See Also:
SystemWidgetHelpers.createLabeledLabel(Composite, String, String, boolean), grabExcessSpace(Control)

createLabeledCombo

protected 
Combo createLabeledCombo(
Composite c,
                                   
String label,
                                   
String tooltip)
Create a labeled combo, where the combo on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.

See Also:
SystemWidgetHelpers.createLabeledCombo(Composite, Listener, String, String), grabExcessSpace(Control)

createLabeledText

protected 
Text createLabeledText(
Composite c,
                                 
String label,
                                 
String tooltip)
Create a labeled entry field, where the field on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.

See Also:
SystemWidgetHelpers.createLabeledTextField(Composite, Listener, String, String), grabExcessSpace(Control)

createLabeledVerbiage

protected 
Label createLabeledVerbiage(
Composite c,
                                      
String label,
                                      
String tooltip)
Create a labeled verbiage field, where the field on the right grabs excess space and has an indent so it isn't smashed up against the prompt on the left.

See Also:
SystemWidgetHelpers.createLabeledTextField(Composite, Listener, String, String), grabExcessSpace(Control)

clearErrorMessage

public void clearErrorMessage()
ISystemMessageLine method.
Clears the currently displayed error message and redisplayes the message which was active before the error message was set.

Specified by:
clearErrorMessage in interface ISystemMessageLine

clearMessage

public void clearMessage()
ISystemMessageLine method.
Clears the currently displayed message.

Specified by:
clearMessage in interface ISystemMessageLine

getSystemErrorMessage

public 
SystemMessage getSystemErrorMessage()
ISystemMessageLine method.
Get the currently displayed error text.

Specified by:
getSystemErrorMessage in interface ISystemMessageLine
Returns:
The error message. If no error message is displayed null is returned.

setErrorMessage

public void setErrorMessage(
String message)
ISystemMessageLine method.
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine
Overrides:
setErrorMessage in class PreferencePage

setErrorMessage

public void setErrorMessage(
SystemMessage message)
ISystemMessageLine method.
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

setErrorMessage

public void setErrorMessage(
Throwable exc)
ISystemMessageLine method.
Convenience method to set an error message from an exception

Specified by:
setErrorMessage in interface ISystemMessageLine

setMessage

public void setMessage(
SystemMessage message)
ISystemMessageLine method.
Set the error message text. If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine

setMessage

public void setMessage(
String message)
ISystemMessageLine method.
Set the non-error message text. If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine
Overrides:
setMessage in class DialogPage

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