Class ModifyDialogTabPage
- java.lang.Object
-
- org.eclipse.m2m.atl.adt.ui.preferences.ModifyDialogTabPage
-
- All Implemented Interfaces:
IModifyDialogTabPage
- Direct Known Subclasses:
AtlCodeFormatterProfilesTabPage
,AtlCodeFormatterPropertiesTabPage
public abstract class ModifyDialogTabPage extends java.lang.Object implements IModifyDialogTabPage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ModifyDialogTabPage.ButtonPreference
Wrapper around a checkbox and a label.protected class
ModifyDialogTabPage.CheckboxPreference
protected 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.protected class
ModifyDialogTabPage.NumberPreference
Wrapper around a textfied which requests an integer input of a given range.protected class
ModifyDialogTabPage.Preference
The base class of all Preference classes.protected class
ModifyDialogTabPage.RadioPreference
protected class
ModifyDialogTabPage.StringPreference
Wrapper around a text field which requests a string input.-
Nested classes/interfaces inherited from interface org.eclipse.m2m.atl.adt.ui.preferences.IModifyDialogTabPage
IModifyDialogTabPage.IModificationListener
-
-
Field Summary
Fields Modifier and Type Field Description protected ModifyDialogTabPage.DefaultFocusManager
fDefaultFocusManager
The default focus manager.protected org.eclipse.jface.layout.PixelConverter
fPixelConverter
A pixel converter for layout calculationsprotected org.eclipse.swt.widgets.Button
fShowInvisibleButton
protected java.util.Observer
fUpdater
This is the default listener for any of the Preference classes.protected java.util.Map<java.lang.String,java.lang.String>
fWorkingValues
The map where the current settings are stored.
-
Constructor Summary
Constructors Constructor Description ModifyDialogTabPage()
ModifyDialogTabPage(IModifyDialogTabPage.IModificationListener modifyListener, java.util.Map<java.lang.String,java.lang.String> workingValues)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ModifyDialogTabPage.CheckboxPreference
createCheckboxPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, java.lang.String[] values)
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)
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)
protected org.eclipse.swt.layout.GridLayout
createGridLayout(int numColumns, boolean margins)
protected org.eclipse.swt.widgets.Group
createGroup(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)
protected static org.eclipse.swt.widgets.Label
createLabel(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text, int gridDataStyle)
protected ModifyDialogTabPage.NumberPreference
createNumberPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, int minValue, int maxValue)
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 ModifyDialogTabPage.StringPreference
createStringPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, org.eclipse.jface.dialogs.IInputValidator inputValidator)
protected abstract AtlPreview
doCreateAtlPreview(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.AtlPreview
getPreview()
org.eclipse.swt.widgets.Button
getShowInvisibleButton()
protected abstract void
initializePage()
This method is called after all controls have been allocated, 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.void
setModifyListener(IModifyDialogTabPage.IModificationListener modifyListener)
A modify listener which must be informed whenever a value in the map passed toIModifyDialogTabPage.setWorkingValues(Map)
changes.void
setPreview(AtlPreview fPreview)
void
setWorkingValues(java.util.Map<java.lang.String,java.lang.String> workingValues)
A map containing key value pairs this tab page is must modify.protected void
updateStatus(org.eclipse.core.runtime.IStatus status)
Set the status field on the dialog.abstract void
updateTab(boolean enabled)
-
-
-
Field Detail
-
fShowInvisibleButton
protected org.eclipse.swt.widgets.Button fShowInvisibleButton
-
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 org.eclipse.jface.layout.PixelConverter fPixelConverter
A pixel converter for layout calculations
-
fWorkingValues
protected java.util.Map<java.lang.String,java.lang.String> fWorkingValues
The map where the current settings are stored.
-
-
Constructor Detail
-
ModifyDialogTabPage
public ModifyDialogTabPage(IModifyDialogTabPage.IModificationListener modifyListener, java.util.Map<java.lang.String,java.lang.String> workingValues)
-
ModifyDialogTabPage
public ModifyDialogTabPage()
-
-
Method Detail
-
setWorkingValues
public void setWorkingValues(java.util.Map<java.lang.String,java.lang.String> workingValues)
A map containing key value pairs this tab page is must modify.- Specified by:
setWorkingValues
in interfaceIModifyDialogTabPage
- Parameters:
workingValues
- the values to work with
-
setModifyListener
public void setModifyListener(IModifyDialogTabPage.IModificationListener modifyListener)
A modify listener which must be informed whenever a value in the map passed toIModifyDialogTabPage.setWorkingValues(Map)
changes. The listener can also be informed about status changes.- Specified by:
setModifyListener
in interfaceIModifyDialogTabPage
- Parameters:
modifyListener
- the listener to inform
-
createContents
public org.eclipse.swt.widgets.Composite createContents(org.eclipse.swt.widgets.Composite parent)
Create the contents of this tab page.Subclasses should implement
doCreatePreferences
anddoCreatePreview
may also be overridden as necessary.- Specified by:
createContents
in interfaceIModifyDialogTabPage
- Parameters:
parent
- The parent composite- Returns:
- Created content control
-
initializePage
protected abstract void initializePage()
This method is called after all controls have been allocated, 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 innumColumns
- 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 innumColumns
- Number of columns to use- Returns:
- Created composite
-
doCreateAtlPreview
protected abstract AtlPreview doCreateAtlPreview(org.eclipse.swt.widgets.Composite parent)
To be implemented by subclasses. This method should return an instance of JavaPreview. 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:- Updating the preview.
- Setting the focus
- Specified by:
makeVisible
in interfaceIModifyDialogTabPage
-
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.- Specified by:
setInitialFocus
in interfaceIModifyDialogTabPage
-
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)
-
createGridData
protected static org.eclipse.swt.layout.GridData createGridData(int numColumns, int style, int widthHint)
-
createLabel
protected static org.eclipse.swt.widgets.Label createLabel(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text)
-
createLabel
protected static org.eclipse.swt.widgets.Label createLabel(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text, int gridDataStyle)
-
createGroup
protected org.eclipse.swt.widgets.Group createGroup(int numColumns, org.eclipse.swt.widgets.Composite parent, java.lang.String text)
-
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)
-
createStringPref
protected ModifyDialogTabPage.StringPreference createStringPref(org.eclipse.swt.widgets.Composite composite, int numColumns, java.lang.String name, java.lang.String key, org.eclipse.jface.dialogs.IInputValidator inputValidator)
-
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)
-
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)
-
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)
-
setPreview
public void setPreview(AtlPreview fPreview)
-
getPreview
public AtlPreview getPreview()
-
getShowInvisibleButton
public org.eclipse.swt.widgets.Button getShowInvisibleButton()
-
updateTab
public abstract void updateTab(boolean enabled)
-
-