public abstract class FieldEditorPreferencePage extends PreferencePage implements IPropertyChangeListener
Subclasses must implement the createFieldEditors
method
and should override createLayout
if a special layout of the field
editors is needed.
Modifier and Type | Field and Description |
---|---|
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 . |
ERROR, INFORMATION, NONE, WARNING
Modifier | Constructor and Description |
---|---|
|
FieldEditorPreferencePage()
Create a new instance of the reciever.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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()
Applys the font to the field editors managed by this page.
|
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)
The
DialogPage implementation of this
IDialogPage method sets the control to the given
visibility state. |
applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, setDescription, setImageDescriptor
public static final int FLAT
0
) indicating that
each field editor is handled as a single component.public static final int GRID
1
) indicating that
the field editors' basic controls are put into a grid layout.protected static final int VERTICAL_SPACING
FLAT
and GRID
.protected static final int MARGIN_WIDTH
FLAT
and GRID
.protected static final int MARGIN_HEIGHT
FLAT
and GRID
.public FieldEditorPreferencePage()
protected FieldEditorPreferencePage(int style)
style
- either GRID
or FLAT
protected FieldEditorPreferencePage(String title, int style)
title
- the title of this preference pagestyle
- either GRID
or FLAT
protected FieldEditorPreferencePage(String title, ImageDescriptor image, int style)
title
- the title of this preference pageimage
- the image for this preference page, or
null
if nonestyle
- either GRID
or FLAT
protected void addField(FieldEditor editor)
editor
- the field editorprotected void adjustGridLayout()
protected void applyFont()
protected void checkState()
isValid
for
every field editor.protected Control createContents(Composite parent)
PreferencePage
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.
createContents
in class PreferencePage
parent
- the parent compositeprotected abstract void createFieldEditors()
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
public void dispose()
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
.dispose
in interface IDialogPage
dispose
in class DialogPage
protected Composite getFieldEditorParent()
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.
protected void initialize()
protected void performDefaults()
PreferencePage
method loads all the field editors with their default values.performDefaults
in class PreferencePage
public boolean performOk()
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.performOk
in interface IPreferencePage
performOk
in class PreferencePage
false
to abort the container's OK
processing and true
to allow the OK to happenFieldEditor.store()
public void propertyChange(PropertyChangeEvent event)
IPreferencePage
(and IPropertyChangeListener
) method intercepts IS_VALID
events but passes other events on to its superclass.propertyChange
in interface IPropertyChangeListener
event
- the property change event object describing which property
changed and howpublic void setVisible(boolean visible)
DialogPage
DialogPage
implementation of this
IDialogPage
method sets the control to the given
visibility state. Subclasses may extend.setVisible
in interface IDialogPage
setVisible
in class DialogPage
visible
- true
to make this page visible,
and false
to hide it
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.