Eclipse Platform
2.0

org.eclipse.jface.preference
Class FieldEditorPreferencePage

java.lang.Object
  |
  +--org.eclipse.jface.dialogs.DialogPage
        |
        +--org.eclipse.jface.preference.PreferencePage
              |
              +--org.eclipse.jface.preference.FieldEditorPreferencePage
All Implemented Interfaces:
EventListener, IDialogPage, IMessageProvider, IPreferencePage, IPropertyChangeListener
Direct Known Subclasses:
TextEditorPreferencePage

public abstract class FieldEditorPreferencePage
extends PreferencePage
implements IPropertyChangeListener

A special abstract preference page to host field editors.

Subclasses must implement the createFieldEditors method and should override createLayout if a special layout of the field editors is needed.


Field Summary
static int FLAT
          Layout constant (value 0) indicating that each field editor is handled as a single component.
static int GRID
          Layout constant (value 1) indicating that the field editors' basic controls are put into a grid layout.
protected static int MARGIN_HEIGHT
          The margin height used by layout styles FLAT and GRID.
protected static int MARGIN_WIDTH
          The margin width used by layout styles FLAT and GRID.
protected static int VERTICAL_SPACING
          The vertical spacing used by layout styles FLAT and GRID.
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
protected FieldEditorPreferencePage(int style)
          Creates a new field editor preference page with the given style, an empty title, and no image.
protected FieldEditorPreferencePage(String title, ImageDescriptor image, int style)
          Creates a new field editor preference page with the given title, image, and style.
protected FieldEditorPreferencePage(String title, int style)
          Creates a new field editor preference page with the given title and style, but no image.
 
Method Summary
protected  void addField(FieldEditor editor)
          Adds the given field editor to this page.
protected  void adjustGridLayout()
          Adjust the layout of the field editors so that they are properly aligned.
protected  void applyFont()
           
protected  void checkState()
          Recomputes the page's error state by calling isValid for every field editor.
protected  Control createContents(Composite parent)
          Creates and returns the SWT control for the customized body of this preference page under the given parent composite.
protected abstract  void createFieldEditors()
          Creates the page's field editors.
 void dispose()
          The field editor preference page implementation of an IDialogPage method disposes of this page's controls and images.
protected  Composite getFieldEditorParent()
          Returns a parent composite for a field editor.
protected  void initialize()
          Initializes all field editors.
protected  void performDefaults()
          The field editor preference page implementation of a PreferencePage method loads all the field editors with their default values.
 boolean performOk()
          The field editor preference page implementation of this PreferencePage method saves all field editors by calling FieldEditor.store.
 void propertyChange(PropertyChangeEvent event)
          The field editor preference page implementation of this IPreferencePage (and IPropertyChangeListener) method intercepts IS_VALID events but passes other events on to its superclass.
 void setVisible(boolean visible)
          Sets the visibility of this dialog page.
 
Methods inherited from class org.eclipse.jface.preference.PreferencePage
computeSize, contributeButtons, createControl, createDescriptionLabel, doComputeSize, doGetPreferenceStore, getContainer, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setControl, setDescription, setImageDescriptor, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor
 

Field Detail

FLAT

public static final int FLAT
Layout constant (value 0) indicating that each field editor is handled as a single component.

See Also:
Constant Field Values

GRID

public static final int GRID
Layout constant (value 1) indicating that the field editors' basic controls are put into a grid layout.

See Also:
Constant Field Values

VERTICAL_SPACING

protected static final int VERTICAL_SPACING
The vertical spacing used by layout styles FLAT and GRID.

See Also:
Constant Field Values

MARGIN_WIDTH

protected static final int MARGIN_WIDTH
The margin width used by layout styles FLAT and GRID.

See Also:
Constant Field Values

MARGIN_HEIGHT

protected static final int MARGIN_HEIGHT
The margin height used by layout styles FLAT and GRID.

See Also:
Constant Field Values
Constructor Detail

FieldEditorPreferencePage

protected FieldEditorPreferencePage(int style)
Creates a new field editor preference page with the given style, an empty title, and no image.

Parameters:
style - either GRID or FLAT

FieldEditorPreferencePage

protected FieldEditorPreferencePage(String title,
                                    int style)
Creates a new field editor preference page with the given title and style, but no image.

Parameters:
title - the title of this preference page
style - either GRID or FLAT

FieldEditorPreferencePage

protected FieldEditorPreferencePage(String title,
                                    ImageDescriptor image,
                                    int style)
Creates a new field editor preference page with the given title, image, and style.

Parameters:
title - the title of this preference page
image - the image for this preference page, or null if none
style - either GRID or FLAT
Method Detail

addField

protected void addField(FieldEditor editor)
Adds the given field editor to this page.

Parameters:
editor - the field editor

adjustGridLayout

protected void adjustGridLayout()
Adjust the layout of the field editors so that they are properly aligned.


applyFont

protected void applyFont()

checkState

protected void checkState()
Recomputes the page's error state by calling isValid for every field editor.


createContents

protected Control createContents(Composite parent)
Description copied from class: PreferencePage
Creates and returns the SWT control for the customized body of this preference page under the given parent composite.

This framework method must be implemented by concrete subclasses. Any subclass returning a Composite object whose Layout has default margins (for example, a GridLayout) are expected to set the margins of this Layout to 0 pixels.

Specified by:
createContents in class PreferencePage
Parameters:
parent - the parent composite
Returns:
the new control

createFieldEditors

protected abstract void createFieldEditors()
Creates the page's field editors.

The default implementation of this framework method does nothing. Subclass must implement this method to create the field editors.

Subclasses should call getFieldEditorParent to obtain the parent control for each field editor. This same parent should not be used for more than one editor as the parent may change for each field editor depending on the layout style of the page


dispose

public void dispose()
The field editor preference page implementation of an IDialogPage method disposes of this page's controls and images. Subclasses may override to release their own allocated SWT resources, but must call super.dispose.

Specified by:
dispose in interface IDialogPage
Overrides:
dispose in class DialogPage

getFieldEditorParent

protected Composite getFieldEditorParent()
Returns a parent composite for a field editor.

This value must not be cached since a new parent may be created each time this method called. Thus this method must be called each time a field editor is constructed.


initialize

protected void initialize()
Initializes all field editors.


performDefaults

protected void performDefaults()
The field editor preference page implementation of a PreferencePage method loads all the field editors with their default values.

Overrides:
performDefaults in class PreferencePage

performOk

public boolean performOk()
The field editor preference page implementation of this PreferencePage method saves all field editors by calling FieldEditor.store. Note that this method does not save the preference store itself; it just stores the values back into the preference store.

Specified by:
performOk in interface IPreferencePage
Overrides:
performOk in class PreferencePage
Returns:
false to abort the container's OK processing and true to allow the OK to happen
See Also:
FieldEditor.store()

propertyChange

public void propertyChange(PropertyChangeEvent event)
The field editor preference page implementation of this IPreferencePage (and IPropertyChangeListener) method intercepts IS_VALID events but passes other events on to its superclass.

Specified by:
propertyChange in interface IPropertyChangeListener
Parameters:
event - the property change event object describing which property changed and how

setVisible

public void setVisible(boolean visible)
Description copied from interface: IDialogPage
Sets the visibility of this dialog page.

Specified by:
setVisible in interface IDialogPage
Overrides:
setVisible in class DialogPage
Parameters:
visible - true to make this page visible, and false to hide it

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.