public abstract class TemplatePreferencePage extends PreferencePage implements IWorkbenchPreferencePage
Subclasses need to provide a TemplateStore
and a
ContextTypeRegistry
and should set the preference store. They may
optionally override isShowFormatterSetting()
.
Modifier and Type | Class and Description |
---|---|
protected static class |
TemplatePreferencePage.EditTemplateDialog
Dialog to edit a template.
|
ERROR, INFORMATION, NONE, WARNING
Modifier | Constructor and Description |
---|---|
protected |
TemplatePreferencePage()
Creates a new template preference page.
|
Modifier and Type | Method and Description |
---|---|
protected Control |
createContents(Composite ancestor)
Creates and returns the SWT control for the customized body
of this preference page under the given parent composite.
|
protected Dialog |
createTemplateEditDialog(Template template,
boolean edit,
boolean isNameModifiable)
Deprecated.
not called any longer as of 3.1 - use
editTemplate(Template, boolean, boolean) |
protected SourceViewer |
createViewer(Composite parent)
Creates, configures and returns a source viewer to present the template
pattern on the preference page.
|
protected Template |
editTemplate(Template template,
boolean edit,
boolean isNameModifiable)
Creates the edit dialog.
|
ContextTypeRegistry |
getContextTypeRegistry()
Returns the context type registry.
|
protected String |
getFormatterPreferenceKey()
Returns the key to use for the formatter preference.
|
protected TableViewer |
getTableViewer() |
TemplateStore |
getTemplateStore()
Returns the template store.
|
protected SourceViewer |
getViewer() |
void |
init(IWorkbench workbench)
Initializes this preference page for the given workbench.
|
protected boolean |
isShowFormatterSetting()
Returns whether the formatter preference checkbox should be shown.
|
boolean |
performCancel()
The preference page implementation of an
IPreferencePage
method performs special processing when this page's Cancel button has
been pressed. |
protected void |
performDefaults()
Performs special processing when this page's Defaults button has been pressed.
|
boolean |
performOk()
Notifies that the OK button of this page's container has been pressed.
|
void |
setContextTypeRegistry(ContextTypeRegistry registry)
Sets the context type registry.
|
void |
setTemplateStore(TemplateStore store)
Sets the template store.
|
void |
setVisible(boolean visible)
The
DialogPage implementation of this
IDialogPage method sets the control to the given
visibility state. |
protected void |
updateButtons()
Updates the buttons.
|
protected void |
updateViewerInput()
Updates the pattern viewer.
|
applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, noDefaultButton, okToLeave, performApply, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, 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
computeSize, isValid, okToLeave, setContainer, setSize
createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle
protected TemplatePreferencePage()
public TemplateStore getTemplateStore()
public ContextTypeRegistry getContextTypeRegistry()
public void setTemplateStore(TemplateStore store)
store
- the new template storepublic void setContextTypeRegistry(ContextTypeRegistry registry)
registry
- the new context type registrypublic void init(IWorkbench workbench)
IWorkbenchPreferencePage
This method is called automatically as the preference page is being created and initialized. Clients must not call this method.
init
in interface IWorkbenchPreferencePage
workbench
- the workbenchprotected Control createContents(Composite ancestor)
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
ancestor
- the parent compositeprotected boolean isShowFormatterSetting()
true
if the formatter preference checkbox should
be shown, false
otherwiseprotected SourceViewer createViewer(Composite parent)
parent
- the parent controlprotected void updateViewerInput()
protected void updateButtons()
protected Dialog createTemplateEditDialog(Template template, boolean edit, boolean isNameModifiable)
editTemplate(Template, boolean, boolean)
template
- the template being editededit
- whether the dialog should be editableisNameModifiable
- whether the template name may be modifiedEditTemplateDialog
which will be opened.protected Template editTemplate(Template template, boolean edit, boolean isNameModifiable)
template
- the template being editededit
- whether the dialog should be editableisNameModifiable
- whether the template name may be modifiednull
if the edition failedpublic 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 itprotected void performDefaults()
PreferencePage
This is a framework hook method for subclasses to do special things when
the Defaults button has been pressed.
Subclasses may override, but should call super.performDefaults
.
performDefaults
in class PreferencePage
public boolean performOk()
IPreferencePage
performOk
in interface IPreferencePage
performOk
in class PreferencePage
false
to abort the container's OK
processing and true
to allow the OK to happenprotected String getFormatterPreferenceKey()
public boolean performCancel()
PreferencePage
IPreferencePage
method performs special processing when this page's Cancel button has
been pressed.
This is a framework hook method for subclasses to do special things when
the Cancel button has been pressed. The default implementation of this
framework method does nothing and returns true
.
Note that UI guidelines on different platforms disagree on whether Cancel
should revert changes that have been applied with the Apply button.
Windows
wants applied changes to persist on Cancel, whereas
Mac and
GTK
consider Apply a preview that should not be saved on Cancel. Eclipse applications
typically adhere to the Windows guidelines and just override PreferencePage.performOk()
and save preferences there.
performCancel
in interface IPreferencePage
performCancel
in class PreferencePage
false
to abort the container's cancel
procedure and true
to allow the cancel to happenIPreferencePage.performCancel()
protected SourceViewer getViewer()
protected TableViewer getTableViewer()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.