org.eclipse.xtext.ui.codetemplates.ui.preferences
Class AdvancedTemplatesPreferencePage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.preference.PreferencePage
          extended by org.eclipse.ui.texteditor.templates.TemplatePreferencePage
              extended by org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage
                  extended by org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.ui.IWorkbenchPreferencePage

public class AdvancedTemplatesPreferencePage
extends XtextTemplatePreferencePage

Author:
Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.ui.texteditor.templates.TemplatePreferencePage
org.eclipse.ui.texteditor.templates.TemplatePreferencePage.EditTemplateDialog
 
Field Summary
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
AdvancedTemplatesPreferencePage(org.eclipse.jface.preference.IPreferenceStore preferenceStore, org.eclipse.jface.text.templates.ContextTypeRegistry registry, org.eclipse.jface.text.templates.persistence.TemplateStore templateStore)
           
 
Method Summary
protected  org.eclipse.jface.text.source.SourceViewer createViewer(org.eclipse.swt.widgets.Composite parent)
          Creates, configures and returns a source viewer to present the template pattern on the preference page.
 void dispose()
          The DialogPage implementation of this IDialogPage method disposes of the page image if it has one.
protected  org.eclipse.jface.text.templates.Template editTemplate(org.eclipse.jface.text.templates.Template template, boolean edit, boolean isNameModifiable)
          Creates the edit dialog.
protected  java.lang.String getContextTypeForGrammar(org.eclipse.jface.text.templates.TemplateContextType contextType)
           
protected  void updateViewerInput()
          Updates the pattern viewer.
 
Methods inherited from class org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage
createContents, createControl, isShowFormatterSetting
 
Methods inherited from class org.eclipse.ui.texteditor.templates.TemplatePreferencePage
createTemplateEditDialog, getContextTypeRegistry, getFormatterPreferenceKey, getTableViewer, getTemplateStore, getViewer, init, performCancel, performDefaults, performOk, setContextTypeRegistry, setTemplateStore, setVisible, updateButtons
 
Methods inherited from class org.eclipse.jface.preference.PreferencePage
applyData, applyDialogFont, computeSize, contributeButtons, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, 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
 
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, setContainer, setSize
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle
 

Constructor Detail

AdvancedTemplatesPreferencePage

@Inject
public AdvancedTemplatesPreferencePage(org.eclipse.jface.preference.IPreferenceStore preferenceStore,
                                              org.eclipse.jface.text.templates.ContextTypeRegistry registry,
                                              org.eclipse.jface.text.templates.persistence.TemplateStore templateStore)
Method Detail

editTemplate

protected org.eclipse.jface.text.templates.Template editTemplate(org.eclipse.jface.text.templates.Template template,
                                                                 boolean edit,
                                                                 boolean isNameModifiable)
Description copied from class: org.eclipse.ui.texteditor.templates.TemplatePreferencePage
Creates the edit dialog. Subclasses may override this method to provide a custom dialog.

Overrides:
editTemplate in class org.eclipse.ui.texteditor.templates.TemplatePreferencePage
Parameters:
template - the template being edited
edit - whether the dialog should be editable
isNameModifiable - whether the template name may be modified
Returns:
the created or modified template, or null if the edition failed

updateViewerInput

protected void updateViewerInput()
Description copied from class: org.eclipse.ui.texteditor.templates.TemplatePreferencePage
Updates the pattern viewer.

Overrides:
updateViewerInput in class org.eclipse.ui.texteditor.templates.TemplatePreferencePage

getContextTypeForGrammar

protected java.lang.String getContextTypeForGrammar(org.eclipse.jface.text.templates.TemplateContextType contextType)

createViewer

protected org.eclipse.jface.text.source.SourceViewer createViewer(org.eclipse.swt.widgets.Composite parent)
Description copied from class: org.eclipse.ui.texteditor.templates.TemplatePreferencePage
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.

Overrides:
createViewer in class org.eclipse.ui.texteditor.templates.TemplatePreferencePage
Parameters:
parent - the parent control
Returns:
a configured source viewer

dispose

public void dispose()
Description copied from class: org.eclipse.jface.dialogs.DialogPage
The DialogPage implementation of this IDialogPage method disposes of the page image if it has one. Subclasses may extend.

Specified by:
dispose in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
dispose in class org.eclipse.jface.dialogs.DialogPage