org.eclipse.m2m.atl.adt.ui.preferences
Class AbstractPreferencePage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.preference.PreferencePage
          extended by org.eclipse.m2m.atl.adt.ui.preferences.AbstractPreferencePage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.ui.IWorkbenchPreferencePage
Direct Known Subclasses:
AtlCodeAssistPreferencePage, AtlEditorPreferencePage, AtlMainPreferencePage, AtlSyntaxPreferencePage, AtlTypingPreferencePage

public abstract class AbstractPreferencePage
extends org.eclipse.jface.preference.PreferencePage
implements org.eclipse.ui.IWorkbenchPreferencePage

This abstract class permits other preferences pages to use some classical method such creating fields ofenly used.


Field Summary
protected  java.lang.String[][] checkBoxModel
           
protected  org.eclipse.swt.widgets.List colorList
           
protected  java.lang.String[][] colorListModel
           
protected  org.eclipse.jface.preference.ColorSelector colorSelector
           
protected  AtlPreferenceStore fPreferenceeStore
           
protected  java.lang.String[][] textFieldModel
           
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
AbstractPreferencePage(java.lang.String title)
          Creates a new preference page with a title using the PreferencePage constructor.
 
Method Summary
 void dispose()
          
protected  org.eclipse.jface.preference.IPreferenceStore doGetPreferenceStore()
          
 org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
          
protected  void handleColorListSelection()
          When a selection is made, the color button handles the color sets by this selection.
 void init(org.eclipse.ui.IWorkbench workbench)
          
protected  void initialize()
          Initializes the preference page with the user values.
protected  void initializeFieldsToDefaultValues()
          Initializes the preference page widgets with the default values.
protected  void initializeFieldsToUserValues()
          Initializes the preference page widgets with the user values.
protected  org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent, java.lang.String label)
          Creates an new checkbox instance.
protected  org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent, java.lang.String label, java.lang.String key)
          Creates an new checkbox instance and stores it in a hash map.
protected  org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent, java.lang.String label, java.lang.String key, org.eclipse.swt.events.SelectionListener sl)
          Creates an new checkbox instance and stores it in a hash map.
protected  org.eclipse.swt.widgets.Control[] newColorList(org.eclipse.swt.widgets.Composite parent, java.lang.String listLabel, java.lang.String buttonLabel, java.lang.String[][] colorListModel)
          Creates a new color list with a label and a color selector button.
protected  org.eclipse.swt.widgets.Composite newComposite(org.eclipse.swt.widgets.Composite parent, int numColumns)
          Creates composite control and sets the default layout data.
protected  org.eclipse.swt.widgets.Composite newCompositeCheckBoxes(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Composite newCompositeColors(org.eclipse.swt.widgets.Composite parent, java.lang.String listLabel, java.lang.String buttonLabel)
           
protected  org.eclipse.swt.widgets.Composite newCompositeTextFields(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Group newGroup(org.eclipse.swt.widgets.Composite parent, java.lang.String text)
          Creates a new elements group with a title above the side.
protected  org.eclipse.swt.widgets.Label newLabelField(org.eclipse.swt.widgets.Composite parent, java.lang.String text)
          Utility method that creates a label instance and sets the default layout data.
protected  org.eclipse.swt.widgets.Text newLabelledTextField(org.eclipse.swt.widgets.Composite parent, java.lang.String label, java.lang.String text, int limit, java.lang.String key)
          Creates a new group composed by a label and an editable text field.
protected  org.eclipse.swt.widgets.Button newPushButton(org.eclipse.swt.widgets.Composite parent, java.lang.String text, org.eclipse.swt.events.SelectionListener sl)
          Utility method that creates a push button instance and sets the default layout data.
protected  org.eclipse.swt.widgets.Button newRadioButton(org.eclipse.swt.widgets.Composite parent, java.lang.String text, org.eclipse.swt.events.SelectionListener sl)
          Utility method that creates a radio button instance and sets the default layout data.
protected  org.eclipse.swt.widgets.List newScrollList(org.eclipse.swt.widgets.Composite parent)
          Creates a new scroll list.
protected  org.eclipse.swt.widgets.TabItem newTabItem(org.eclipse.swt.widgets.TabFolder parent, java.lang.String text, org.eclipse.swt.widgets.Control control)
          Creates a new tab item in a tab folder.
protected  org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int limit)
          Creates a new editable text field.
protected  org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int limit, java.lang.String key)
          Creates a new editable text field.
protected  org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int limit, java.lang.String key, org.eclipse.swt.events.ModifyListener sl)
          Creates a new editable text field.
protected  void performDefaults()
          
 boolean performOk()
          
protected  void tabForward(org.eclipse.swt.widgets.Composite parent)
          Creates a tab of one horizontal spans.
 
Methods inherited from class org.eclipse.jface.preference.PreferencePage
applyData, applyDialogFont, computeSize, contributeButtons, createContents, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, getApplyButton, getContainer, getDefaultsButton, 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, setVisible
 
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
createControl, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
 

Field Detail

checkBoxModel

protected java.lang.String[][] checkBoxModel

colorList

protected org.eclipse.swt.widgets.List colorList

colorListModel

protected java.lang.String[][] colorListModel

colorSelector

protected org.eclipse.jface.preference.ColorSelector colorSelector

fPreferenceeStore

protected AtlPreferenceStore fPreferenceeStore

textFieldModel

protected java.lang.String[][] textFieldModel
Constructor Detail

AbstractPreferencePage

public AbstractPreferencePage(java.lang.String title)
Creates a new preference page with a title using the PreferencePage constructor. Above that, a new preference fPreferenceeStore is created to react with the default one of the AtlUIPlugin.

Parameters:
title - the preference page title
Method Detail

dispose

public void dispose()

Specified by:
dispose in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
dispose in class org.eclipse.jface.dialogs.DialogPage
See Also:
DialogPage.dispose()

doGetPreferenceStore

protected org.eclipse.jface.preference.IPreferenceStore doGetPreferenceStore()

Overrides:
doGetPreferenceStore in class org.eclipse.jface.preference.PreferencePage
See Also:
PreferencePage.doGetPreferenceStore()

getPreferenceStore

public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()

Overrides:
getPreferenceStore in class org.eclipse.jface.preference.PreferencePage
See Also:
PreferencePage.getPreferenceStore()

handleColorListSelection

protected void handleColorListSelection()
When a selection is made, the color button handles the color sets by this selection. The default implementation does nothing.


init

public void init(org.eclipse.ui.IWorkbench workbench)

Specified by:
init in interface org.eclipse.ui.IWorkbenchPreferencePage
See Also:
IWorkbenchPreferencePage.init(org.eclipse.ui.IWorkbench)

initialize

protected void initialize()
Initializes the preference page with the user values. The default implementation initializes all widgets lists with there user's value.


initializeFieldsToDefaultValues

protected void initializeFieldsToDefaultValues()
Initializes the preference page widgets with the default values.


initializeFieldsToUserValues

protected void initializeFieldsToUserValues()
Initializes the preference page widgets with the user values.


newCheckBoxField

protected org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent,
                                                          java.lang.String label)
Creates an new checkbox instance.

Parameters:
parent - the composite in which to create the checkbox
label - the string to set into the checkbox
Returns:
the new checkbox

newCheckBoxField

protected org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent,
                                                          java.lang.String label,
                                                          java.lang.String key)
Creates an new checkbox instance and stores it in a hash map. The default listener checkBoxFieldListener is associated with.

Parameters:
parent - the composite in which to create the checkbox
label - the string to set into the checkbox
key - the string key associated
Returns:
the new checkbox

newCheckBoxField

protected org.eclipse.swt.widgets.Button newCheckBoxField(org.eclipse.swt.widgets.Composite parent,
                                                          java.lang.String label,
                                                          java.lang.String key,
                                                          org.eclipse.swt.events.SelectionListener sl)
Creates an new checkbox instance and stores it in a hash map. A listener is associated with.

Parameters:
parent - the composite in which to create the checkbox
label - the string to set into the checkbox
key - the string key associated
sl - the selection listener associated with
Returns:
the new checkbox

newColorList

protected org.eclipse.swt.widgets.Control[] newColorList(org.eclipse.swt.widgets.Composite parent,
                                                         java.lang.String listLabel,
                                                         java.lang.String buttonLabel,
                                                         java.lang.String[][] colorListModel)
Creates a new color list with a label and a color selector button.

Parameters:
parent - the parent composite group
listLabel - the color list label
buttonLabel - the color selector label
colorListModel - the models of the color list
Returns:
the objects' list of the group

newComposite

protected org.eclipse.swt.widgets.Composite newComposite(org.eclipse.swt.widgets.Composite parent,
                                                         int numColumns)
Creates composite control and sets the default layout data.

Parameters:
parent - the parent of the new composite
numColumns - the number of columns for the new composite
Returns:
the newly-created coposite

newCompositeCheckBoxes

protected org.eclipse.swt.widgets.Composite newCompositeCheckBoxes(org.eclipse.swt.widgets.Composite parent)

newCompositeColors

protected org.eclipse.swt.widgets.Composite newCompositeColors(org.eclipse.swt.widgets.Composite parent,
                                                               java.lang.String listLabel,
                                                               java.lang.String buttonLabel)

newCompositeTextFields

protected org.eclipse.swt.widgets.Composite newCompositeTextFields(org.eclipse.swt.widgets.Composite parent)

newGroup

protected org.eclipse.swt.widgets.Group newGroup(org.eclipse.swt.widgets.Composite parent,
                                                 java.lang.String text)
Creates a new elements group with a title above the side.

Parameters:
parent - the parent of the new group
text - the title of the new group
Returns:
the new group

newLabelField

protected org.eclipse.swt.widgets.Label newLabelField(org.eclipse.swt.widgets.Composite parent,
                                                      java.lang.String text)
Utility method that creates a label instance and sets the default layout data.

Parameters:
parent - the parent for the new label
text - the text for the new label
Returns:
the new label

newLabelledTextField

protected org.eclipse.swt.widgets.Text newLabelledTextField(org.eclipse.swt.widgets.Composite parent,
                                                            java.lang.String label,
                                                            java.lang.String text,
                                                            int limit,
                                                            java.lang.String key)
Creates a new group composed by a label and an editable text field. It is designed to work on a two columns composite.

Parameters:
parent - the parent group
label - the label of the group
text - the default value of the text field
limit - the maximum number of chars in the field
key - the string key associated
Returns:
the new composed group

newPushButton

protected org.eclipse.swt.widgets.Button newPushButton(org.eclipse.swt.widgets.Composite parent,
                                                       java.lang.String text,
                                                       org.eclipse.swt.events.SelectionListener sl)
Utility method that creates a push button instance and sets the default layout data.

Parameters:
parent - the parent for the new button
text - the label for the new button
Returns:
the newly-created button

newRadioButton

protected org.eclipse.swt.widgets.Button newRadioButton(org.eclipse.swt.widgets.Composite parent,
                                                        java.lang.String text,
                                                        org.eclipse.swt.events.SelectionListener sl)
Utility method that creates a radio button instance and sets the default layout data.

Parameters:
parent - the parent for the new button
text - the label for the new button
Returns:
the newly-created button

newScrollList

protected org.eclipse.swt.widgets.List newScrollList(org.eclipse.swt.widgets.Composite parent)
Creates a new scroll list.

Parameters:
parent - the parent in which the list is created
Returns:
a new empty list

newTabItem

protected org.eclipse.swt.widgets.TabItem newTabItem(org.eclipse.swt.widgets.TabFolder parent,
                                                     java.lang.String text,
                                                     org.eclipse.swt.widgets.Control control)
Creates a new tab item in a tab folder.

Parameters:
parent - the parent tab folder
text - the tab item label
control - the page of this item
Returns:
the new tab item containing the preference page.

newTextField

protected org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent,
                                                    java.lang.String text,
                                                    int limit)
Creates a new editable text field.

Parameters:
parent - the parent group
text - the default value of the text field
limit - the maximum number of chars in the field
Returns:
the new text field

newTextField

protected org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent,
                                                    java.lang.String text,
                                                    int limit,
                                                    java.lang.String key)
Creates a new editable text field. The default listener TextFieldListener is associated with.

Parameters:
parent - the parent group
text - the default value of the text field
limit - the maximum number of chars in the field
key - the string key associated
Returns:
the new text field

newTextField

protected org.eclipse.swt.widgets.Text newTextField(org.eclipse.swt.widgets.Composite parent,
                                                    java.lang.String text,
                                                    int limit,
                                                    java.lang.String key,
                                                    org.eclipse.swt.events.ModifyListener sl)
Creates a new editable text field. A listener is associated with.

Parameters:
parent - the parent group
text - the default value of the text field
limit - the maximum number of chars in the field
key - the string key associated
sl - the selection listener associated with
Returns:
the new text field

performDefaults

protected void performDefaults()

Overrides:
performDefaults in class org.eclipse.jface.preference.PreferencePage
See Also:
PreferencePage.performDefaults()

performOk

public boolean performOk()

Specified by:
performOk in interface org.eclipse.jface.preference.IPreferencePage
Overrides:
performOk in class org.eclipse.jface.preference.PreferencePage
See Also:
PreferencePage.performOk()

tabForward

protected void tabForward(org.eclipse.swt.widgets.Composite parent)
Creates a tab of one horizontal spans.

Parameters:
parent - the parent in which the tab should be created

Copyright 2007 IBM Corporation and others.
All Rights Reserved.