Class TemplatePreferencePage
- All Implemented Interfaces:
IDialogPage,IMessageProvider,IPreferencePage,IWorkbenchPreferencePage
Subclasses need to provide a TemplateStore and a
ContextTypeRegistry and should set the preference store. They may
optionally override isShowFormatterSetting().
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDialog to edit a template. -
Field Summary
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new template preference page. -
Method Summary
Modifier and TypeMethodDescriptionprotected ControlcreateContents(Composite ancestor) Creates and returns the SWT control for the customized body of this preference page under the given parent composite.protected DialogcreateTemplateEditDialog(Template template, boolean edit, boolean isNameModifiable) Deprecated.protected SourceViewercreateViewer(Composite parent) Creates, configures and returns a source viewer to present the template pattern on the preference page.protected TemplateeditTemplate(Template template, boolean edit, boolean isNameModifiable) Creates the edit dialog.Returns the context type registry.protected StringReturns the key to use for the formatter preference.protected TableViewerReturns the template store.protected SourceViewervoidinit(IWorkbench workbench) Initializes this preference page for the given workbench.protected booleanReturns whether the formatter preference checkbox should be shown.booleanThe preference page implementation of anIPreferencePagemethod performs special processing when this page's Cancel button has been pressed.protected voidPerforms special processing when this page's Defaults button has been pressed.booleanNotifies that the OK button of this page's container has been pressed.voidsetContextTypeRegistry(ContextTypeRegistry registry) Sets the context type registry.voidsetTemplateStore(TemplateStore store) Sets the template store.voidsetVisible(boolean visible) TheDialogPageimplementation of thisIDialogPagemethod sets the control to the given visibility state.protected voidUpdates the buttons.protected voidUpdates the pattern viewer.Methods inherited from class org.eclipse.jface.preference.PreferencePage
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, updateApplyButtonMethods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jface.dialogs.IDialogPage
createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitleMethods inherited from interface org.eclipse.jface.preference.IPreferencePage
computeSize, isValid, okToLeave, setContainer, setSize
-
Constructor Details
-
TemplatePreferencePage
protected TemplatePreferencePage()Creates a new template preference page.
-
-
Method Details
-
getTemplateStore
Returns the template store.- Returns:
- the template store
-
getContextTypeRegistry
Returns the context type registry.- Returns:
- the context type registry
-
setTemplateStore
Sets the template store.- Parameters:
store- the new template store
-
setContextTypeRegistry
Sets the context type registry.- Parameters:
registry- the new context type registry
-
init
Description copied from interface:IWorkbenchPreferencePageInitializes 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:
initin interfaceIWorkbenchPreferencePage- Parameters:
workbench- the workbench
-
createContents
Description copied from class:PreferencePageCreates 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
Compositeobject whoseLayouthas default margins (for example, aGridLayout) is expected to set the margins of thisLayoutto 0 pixels.- Specified by:
createContentsin classPreferencePage- Parameters:
ancestor- the parent composite- Returns:
- the new control
-
isShowFormatterSetting
protected boolean isShowFormatterSetting()Returns whether the formatter preference checkbox should be shown.- Returns:
trueif the formatter preference checkbox should be shown,falseotherwise
-
createViewer
Creates, configures and returns a source viewer to present the template pattern on the preference page. Clients may override to provide a custom source viewer featuring e.g. syntax coloring.- Parameters:
parent- the parent control- Returns:
- a configured source viewer
-
updateViewerInput
protected void updateViewerInput()Updates the pattern viewer. -
updateButtons
protected void updateButtons()Updates the buttons. -
createTemplateEditDialog
@Deprecated protected Dialog createTemplateEditDialog(Template template, boolean edit, boolean isNameModifiable) Deprecated.not called any longer as of 3.1 - useeditTemplate(Template, boolean, boolean)Creates the edit dialog. Subclasses may override this method to provide a custom dialog.- Parameters:
template- the template being editededit- whether the dialog should be editableisNameModifiable- whether the template name may be modified- Returns:
- an
EditTemplateDialogwhich will be opened.
-
editTemplate
Creates the edit dialog. Subclasses may override this method to provide a custom dialog.- Parameters:
template- the template being editededit- whether the dialog should be editableisNameModifiable- whether the template name may be modified- Returns:
- the created or modified template, or
nullif the edition failed - Since:
- 3.1
-
setVisible
public void setVisible(boolean visible) Description copied from class:DialogPageTheDialogPageimplementation of thisIDialogPagemethod sets the control to the given visibility state. Subclasses may extend.- Specified by:
setVisiblein interfaceIDialogPage- Overrides:
setVisiblein classDialogPage- Parameters:
visible-trueto make this page visible, andfalseto hide it
-
performDefaults
protected void performDefaults()Description copied from class:PreferencePagePerforms special processing when this page's Defaults button has been pressed.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.- Overrides:
performDefaultsin classPreferencePage
-
performOk
public boolean performOk()Description copied from interface:IPreferencePageNotifies that the OK button of this page's container has been pressed.- Specified by:
performOkin interfaceIPreferencePage- Overrides:
performOkin classPreferencePage- Returns:
falseto abort the container's OK processing andtrueto allow the OK to happen
-
getFormatterPreferenceKey
Returns the key to use for the formatter preference.- Returns:
- the formatter preference key
-
performCancel
public boolean performCancel()Description copied from class:PreferencePageThe preference page implementation of anIPreferencePagemethod 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.- Specified by:
performCancelin interfaceIPreferencePage- Overrides:
performCancelin classPreferencePage- Returns:
falseto abort the container's cancel procedure andtrueto allow the cancel to happen- See Also:
-
getViewer
-
getTableViewer
-
editTemplate(Template, boolean, boolean)