com.aptana.ide.ui.editors.preferences.formatter
Class ModifyDialogTabPage

java.lang.Object
  extended by com.aptana.ide.ui.editors.preferences.formatter.ModifyDialogTabPage
Direct Known Subclasses:
FormatterTabPage

public abstract class ModifyDialogTabPage
extends java.lang.Object


Nested Class Summary
protected  class ModifyDialogTabPage.ButtonPreference
          Wrapper around a checkbox and a label.
 class ModifyDialogTabPage.CheckboxPreference
           
 class ModifyDialogTabPage.ComboPreference
          Wrapper around a Combo box.
protected static class ModifyDialogTabPage.DefaultFocusManager
          This class provides the default way to preserve and re-establish the focus over multiple modify sessions.
static interface ModifyDialogTabPage.IModificationListener
           
 class ModifyDialogTabPage.NumberPreference
          Wrapper around a textfied which requests an integer input of a given range.
 class ModifyDialogTabPage.Preference
          The base class of all Preference classes.
protected  class ModifyDialogTabPage.RadioPreference
           
 
Field Summary
protected  ModifyDialogTabPage.DefaultFocusManager fDefaultFocusManager
          The default focus manager.
protected  PixelConverter fPixelConverter
          A pixel converter for layout calculations
protected  java.util.Observer fUpdater
          This is the default listener for any of the Preference classes.
protected  java.util.Map fWorkingValues
          The map where the current settings are stored.
 
Constructor Summary
ModifyDialogTabPage(ModifyDialogTabPage.IModificationListener modifyListener, java.util.Map workingValues)
          Create a new ModifyDialogTabPage
 
Method Summary
protected  ModifyDialogTabPage.CheckboxPreference createCheckboxPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, java.lang.String[] values)
          Convenience method to create a CheckboxPreference.
protected  ModifyDialogTabPage.ComboPreference createComboPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, java.lang.String[] values, java.lang.String[] items)
          Convenience method to create a ComboPreference.
 org.eclipse.swt.widgets.Composite createContents(org.eclipse.swt.widgets.Composite parent)
          Create the contents of this tab page.
protected static org.eclipse.swt.layout.GridData createGridData(int numColumns, int style, int widthHint)
          Convenience method to create a GridData.
protected  org.eclipse.swt.layout.GridLayout createGridLayout(int numColumns, boolean margins)
          Create a GridLayout with the default margin and spacing settings, as well as the specified number of columns.
protected  org.eclipse.swt.widgets.Group createGroup(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text)
          Convenience method to create a group
protected static org.eclipse.swt.widgets.Label createLabel(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text)
           
protected static org.eclipse.swt.widgets.Label createLabel(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text, int gridDataStyle)
          Convenience method to create a label
protected  ModifyDialogTabPage.NumberPreference createNumberPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, int minValue, int maxValue)
          Convenience method to create a NumberPreference.
protected static java.lang.String createPreviewHeader(java.lang.String title)
          Create a nice javadoc comment for some string.
protected  ModifyDialogTabPage.RadioPreference createRadioPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, java.lang.String[] values)
           
protected abstract  Preview doCreateJavaPreview(org.eclipse.swt.widgets.Composite parent)
          To be implemented by subclasses.
protected abstract  void doCreatePreferences(org.eclipse.swt.widgets.Composite composite, int numColumns)
          Create the left side of the modify dialog.
protected  org.eclipse.swt.widgets.Composite doCreatePreviewPane(org.eclipse.swt.widgets.Composite composite, int numColumns)
          Create the right side of the modify dialog.
protected abstract  void doUpdatePreview()
          Update the preview.
protected abstract  void initializePage()
          This method is called after all controls have been alloated, including the preview.
 void makeVisible()
          This is called when the page becomes visible.
protected  void notifyValuesModified()
           
 void setInitialFocus()
          Each tab page should remember where its last focus was, and reset it correctly within this method.
protected  void updateStatus(org.eclipse.core.runtime.IStatus status)
          Set the status field on the dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fUpdater

protected final java.util.Observer fUpdater
This is the default listener for any of the Preference classes. It is added by the respective factory methods and updates the page's preview on each change.


fDefaultFocusManager

protected final ModifyDialogTabPage.DefaultFocusManager fDefaultFocusManager
The default focus manager. This widget knows all widgets which can have the focus and listens for focusGained events, on which it stores the index of the current focus holder. When the dialog is restarted, restoreFocus() sets the focus to the last control which had it. The standard Preference object are managed by this focus manager if they are created using the respective factory methods. Other SWT widgets can be added in subclasses when they are created.


fPixelConverter

protected PixelConverter fPixelConverter
A pixel converter for layout calculations


fWorkingValues

protected final java.util.Map fWorkingValues
The map where the current settings are stored.

Constructor Detail

ModifyDialogTabPage

public ModifyDialogTabPage(ModifyDialogTabPage.IModificationListener modifyListener,
                           java.util.Map workingValues)
Create a new ModifyDialogTabPage

Parameters:
modifyListener -
workingValues -
Method Detail

createContents

public final org.eclipse.swt.widgets.Composite createContents(org.eclipse.swt.widgets.Composite parent)
Create the contents of this tab page. Subclasses cannot override this, instead they must implement doCreatePreferences. doCreatePreview may also be overridden as necessary.

Parameters:
parent - The parent composite
Returns:
Created content control

initializePage

protected abstract void initializePage()
This method is called after all controls have been alloated, including the preview. It can be used to set the preview text and to create listeners.


doCreatePreferences

protected abstract void doCreatePreferences(org.eclipse.swt.widgets.Composite composite,
                                            int numColumns)
Create the left side of the modify dialog. This is meant to be implemented by subclasses.

Parameters:
composite - Composite to create in
numColumns - Number of columns to use

doCreatePreviewPane

protected org.eclipse.swt.widgets.Composite doCreatePreviewPane(org.eclipse.swt.widgets.Composite composite,
                                                                int numColumns)
Create the right side of the modify dialog. By default, the preview is displayed there. Subclasses can override this method in order to customize the right-hand side of the dialog.

Parameters:
composite - Composite to create in
numColumns - Number of columns to use
Returns:
Created composite

doCreateJavaPreview

protected abstract Preview doCreateJavaPreview(org.eclipse.swt.widgets.Composite parent)
To be implemented by subclasses. This method should return an instance of Preview. Currently, the choice is between CompilationUnitPreview which contains a valid compilation unit, or a SnippetPreview which formats several independent code snippets and displays them in the same window.

Parameters:
parent - Parent composite
Returns:
Created preview

makeVisible

public final void makeVisible()
This is called when the page becomes visible. Common tasks to do include:


doUpdatePreview

protected abstract void doUpdatePreview()
Update the preview. To be implemented by subclasses.


notifyValuesModified

protected void notifyValuesModified()

setInitialFocus

public void setInitialFocus()
Each tab page should remember where its last focus was, and reset it correctly within this method. This method is only called after initialization on the first tab page to be displayed in order to restore the focus of the last session.


updateStatus

protected void updateStatus(org.eclipse.core.runtime.IStatus status)
Set the status field on the dialog. This can be used by tab pages to report inconsistent input. The OK button is disabled if the kind is IStatus.ERROR.

Parameters:
status - Status describing the current page error state

createGridLayout

protected org.eclipse.swt.layout.GridLayout createGridLayout(int numColumns,
                                                             boolean margins)
Create a GridLayout with the default margin and spacing settings, as well as the specified number of columns.

Parameters:
numColumns -
margins -
Returns:
GridLayout

createGridData

protected static org.eclipse.swt.layout.GridData createGridData(int numColumns,
                                                                int style,
                                                                int widthHint)
Convenience method to create a GridData.

Parameters:
numColumns -
style -
widthHint -
Returns:
grid data

createLabel

protected static org.eclipse.swt.widgets.Label createLabel(int numColumns,
                                                           org.eclipse.swt.widgets.Composite parent,
                                                           java.lang.String text)
Parameters:
numColumns -
parent -
text -
Returns:
Label

createLabel

protected static org.eclipse.swt.widgets.Label createLabel(int numColumns,
                                                           org.eclipse.swt.widgets.Composite parent,
                                                           java.lang.String text,
                                                           int gridDataStyle)
Convenience method to create a label

Parameters:
numColumns -
parent -
text -
gridDataStyle -
Returns:
Label

createGroup

protected org.eclipse.swt.widgets.Group createGroup(int numColumns,
                                                    org.eclipse.swt.widgets.Composite parent,
                                                    java.lang.String text)
Convenience method to create a group

Parameters:
numColumns -
parent -
text -
Returns:
group

createNumberPref

protected ModifyDialogTabPage.NumberPreference createNumberPref(org.eclipse.swt.widgets.Composite composite,
                                                                int numColumns,
                                                                java.lang.String name,
                                                                java.lang.String key,
                                                                int minValue,
                                                                int maxValue)
Convenience method to create a NumberPreference. The widget is registered as a potential focus holder, and the default updater is added.

Parameters:
composite -
numColumns -
name -
key -
minValue -
maxValue -
Returns:
NumberPreference

createComboPref

protected ModifyDialogTabPage.ComboPreference createComboPref(org.eclipse.swt.widgets.Composite composite,
                                                              int numColumns,
                                                              java.lang.String name,
                                                              java.lang.String key,
                                                              java.lang.String[] values,
                                                              java.lang.String[] items)
Convenience method to create a ComboPreference. The widget is registered as a potential focus holder, and the default updater is added.

Parameters:
composite -
numColumns -
name -
key -
values -
items -
Returns:
ComboPreference

createCheckboxPref

protected ModifyDialogTabPage.CheckboxPreference createCheckboxPref(org.eclipse.swt.widgets.Composite composite,
                                                                    int numColumns,
                                                                    java.lang.String name,
                                                                    java.lang.String key,
                                                                    java.lang.String[] values)
Convenience method to create a CheckboxPreference. The widget is registered as a potential focus holder, and the default updater is added.

Parameters:
composite -
numColumns -
name -
key -
values -
Returns:
CheckboxPreference

createRadioPref

protected ModifyDialogTabPage.RadioPreference createRadioPref(org.eclipse.swt.widgets.Composite composite,
                                                              int numColumns,
                                                              java.lang.String name,
                                                              java.lang.String key,
                                                              java.lang.String[] values)
Parameters:
composite -
numColumns -
name -
key -
values -
Returns:
RadioPreference

createPreviewHeader

protected static java.lang.String createPreviewHeader(java.lang.String title)
Create a nice javadoc comment for some string.

Parameters:
title -
Returns:
preview header