org.eclipse.xtext.ui.editor.preferences
Class AbstractPreferencePage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.preference.PreferencePage
          extended by org.eclipse.jface.preference.FieldEditorPreferencePage
              extended by org.eclipse.xtext.ui.editor.preferences.AbstractPreferencePage
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.jface.util.IPropertyChangeListener, org.eclipse.ui.IWorkbenchPreferencePage, org.eclipse.ui.IWorkbenchPropertyPage
Direct Known Subclasses:
LanguageRootPreferencePage, SyntaxColoringPreferencePage

public abstract class AbstractPreferencePage
extends org.eclipse.jface.preference.FieldEditorPreferencePage
implements org.eclipse.ui.IWorkbenchPreferencePage, org.eclipse.ui.IWorkbenchPropertyPage

Author:
Dennis Hübner - Initial contribution and API

Field Summary
 
Fields inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
FLAT, GRID, MARGIN_HEIGHT, MARGIN_WIDTH, VERTICAL_SPACING
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
AbstractPreferencePage()
           
 
Method Summary
protected  void addField(org.eclipse.jface.preference.FieldEditor editor)
          Adds the given field editor to this page.
protected  org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
          Creates and returns the SWT control for the customized body of this preference page under the given parent composite.
 void createControl(org.eclipse.swt.widgets.Composite parent)
          The PreferencePage implementation of this IDialogPage method creates a description label and button bar for the page.
protected  org.eclipse.jface.preference.IPreferenceStore doGetPreferenceStore()
          Returns the preference store of this preference page.
 org.eclipse.core.runtime.IAdaptable getElement()
          Returns the object that owns the properties shown in this page.
protected  java.lang.String getLanguageName()
           
protected  java.lang.String getQualifier()
           
protected  org.eclipse.ui.IWorkbench getWorkbench()
           
 void init(org.eclipse.ui.IWorkbench workbench)
          Initializes this preference page for the given workbench.
 boolean isPropertyPage()
           
 boolean performOk()
          The field editor preference page implementation of this PreferencePage method saves all field editors by calling FieldEditor.store.
protected  java.lang.String qualifiedName()
           
 void setElement(org.eclipse.core.runtime.IAdaptable element)
          Sets the object that owns the properties shown in this page.
protected  void updateFieldEditors(boolean enabled)
           
 
Methods inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
adjustGridLayout, applyFont, checkState, createFieldEditors, dispose, getFieldEditorParent, initialize, performDefaults, propertyChange, setVisible
 
Methods inherited from class org.eclipse.jface.preference.PreferencePage
applyData, applyDialogFont, computeSize, contributeButtons, createDescriptionLabel, createNoteComposite, doComputeSize, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, performHelp, 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, setButtonLayoutData, 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.preference.IPreferencePage
computeSize, isValid, okToLeave, performCancel, setContainer, setSize
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
 

Constructor Detail

AbstractPreferencePage

public AbstractPreferencePage()
Method Detail

init

public void init(org.eclipse.ui.IWorkbench workbench)
Description copied from interface: org.eclipse.ui.IWorkbenchPreferencePage
Initializes this preference page for the given workbench.

This method is called automatically as the preference page is being created and initialized. Clients must not call this method.

Specified by:
init in interface org.eclipse.ui.IWorkbenchPreferencePage
Parameters:
workbench - the workbench

getWorkbench

protected org.eclipse.ui.IWorkbench getWorkbench()

setElement

public void setElement(org.eclipse.core.runtime.IAdaptable element)
Description copied from interface: org.eclipse.ui.IWorkbenchPropertyPage
Sets the object that owns the properties shown in this page. The page is expected to store this object and provide it if getElement is called.

As of Eclipse 3.2 the org.eclipse.ui.propertyPages extension point now supports non IAdaptable inputs. An input that is not an IAdaptable will be wrapped in an IAdaptable by the workbench before it is forwarded to this method.

Specified by:
setElement in interface org.eclipse.ui.IWorkbenchPropertyPage
Parameters:
element - the object that owns the properties shown in this page
See Also:
PropertyDialogAction

getElement

public org.eclipse.core.runtime.IAdaptable getElement()
Description copied from interface: org.eclipse.ui.IWorkbenchPropertyPage
Returns the object that owns the properties shown in this page.

Specified by:
getElement in interface org.eclipse.ui.IWorkbenchPropertyPage
Returns:
the object that owns the properties shown in this page

isPropertyPage

public boolean isPropertyPage()

doGetPreferenceStore

protected org.eclipse.jface.preference.IPreferenceStore doGetPreferenceStore()
Description copied from class: org.eclipse.jface.preference.PreferencePage
Returns the preference store of this preference page.

This is a framework hook method for subclasses to return a page-specific preference store. The default implementation returns null.

Overrides:
doGetPreferenceStore in class org.eclipse.jface.preference.PreferencePage
Returns:
the preference store, or null if none

getQualifier

protected java.lang.String getQualifier()
Returns:
the qualifer used to look up the preference node of the configured preferencesstore

createContents

protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
Description copied from class: org.eclipse.jface.preference.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.

Overrides:
createContents in class org.eclipse.jface.preference.FieldEditorPreferencePage
Parameters:
parent - the parent composite
Returns:
the new control

getLanguageName

protected java.lang.String getLanguageName()

qualifiedName

protected java.lang.String qualifiedName()
Returns:
prefix for preference keys

createControl

public void createControl(org.eclipse.swt.widgets.Composite parent)
Description copied from class: org.eclipse.jface.preference.PreferencePage
The PreferencePage implementation of this IDialogPage method creates a description label and button bar for the page. It calls createContents to create the custom contents of the page.

If a subclass that overrides this method creates a Composite that has a layout with default margins (for example, a GridLayout) it is expected to set the margins of this Layout to 0 pixels.

Specified by:
createControl in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
createControl in class org.eclipse.jface.preference.PreferencePage
Parameters:
parent - the parent composite
See Also:
IDialogPage.createControl(Composite)

addField

protected void addField(org.eclipse.jface.preference.FieldEditor editor)
Description copied from class: org.eclipse.jface.preference.FieldEditorPreferencePage
Adds the given field editor to this page.

Overrides:
addField in class org.eclipse.jface.preference.FieldEditorPreferencePage
Parameters:
editor - the field editor

updateFieldEditors

protected void updateFieldEditors(boolean enabled)

performOk

public boolean performOk()
Description copied from class: org.eclipse.jface.preference.FieldEditorPreferencePage
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 org.eclipse.jface.preference.IPreferencePage
Overrides:
performOk in class org.eclipse.jface.preference.FieldEditorPreferencePage
Returns:
false to abort the container's OK processing and true to allow the OK to happen
See Also:
FieldEditor.store()