Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.texteditor.templates
Class TemplatePreferencePage


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
All Implemented Interfaces:
IDialogPage, IMessageProvider, IPreferencePage, IWorkbenchPreferencePage

public abstract class TemplatePreferencePage
extends PreferencePage
implements IWorkbenchPreferencePage

A template preference page allows configuration of the templates for an editor. It provides controls for adding, removing and changing templates as well as enablement, default management and an optional formatter preference.

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
protected static class TemplatePreferencePage.EditTemplateDialog
          Dialog to edit a template.
 
Field Summary
 
Fields inherited from interface org.eclipse.jface.dialogs. IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
protected TemplatePreferencePage ()
          Creates a new template preference page.
 
Method Summary
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.
 
Methods inherited from class org.eclipse.jface.preference. PreferencePage
applyData, applyDialogFont, computeSize, contributeButtons, createControl, 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, dispose, 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
createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle
 

Constructor Detail

TemplatePreferencePage

protected TemplatePreferencePage()
Creates a new template preference page.

Method Detail

getTemplateStore

public 
TemplateStore getTemplateStore()
Returns the template store.

Returns:
the template store

getContextTypeRegistry

public 
ContextTypeRegistry getContextTypeRegistry()
Returns the context type registry.

Returns:
the context type registry

setTemplateStore

public void setTemplateStore(
TemplateStore store)
Sets the template store.

Parameters:
store - the new template store

setContextTypeRegistry

public void setContextTypeRegistry(
ContextTypeRegistry registry)
Sets the context type registry.

Parameters:
registry - the new context type registry

init

public void init(
IWorkbench workbench)
Description copied from interface: IWorkbenchPreferencePage
Initializes 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:
init in interface IWorkbenchPreferencePage
Parameters:
workbench - the workbench

createContents

protected 
Control createContents(
Composite ancestor)
Description copied from class: PreferencePage
Creates 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 Composite object whose Layout has default margins (for example, a GridLayout) are expected to set the margins of this Layout to 0 pixels.

Specified by:
createContents in class PreferencePage
Parameters:
ancestor - the parent composite
Returns:
the new control

isShowFormatterSetting

protected boolean isShowFormatterSetting()
Returns whether the formatter preference checkbox should be shown.

Returns:
true if the formatter preference checkbox should be shown, false otherwise

createViewer

protected 
SourceViewer createViewer(
Composite parent)
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

protected 
Dialog createTemplateEditDialog(
Template template,
                                          boolean edit,
                                          boolean isNameModifiable)
Deprecated. not called any longer as of 3.1 - use editTemplate(Template, boolean, boolean)

Creates the edit dialog. Subclasses may override this method to provide a custom dialog.

Parameters:
template - the template being edited
edit - whether the dialog should be editable
isNameModifiable - whether the template name may be modified
Returns:
an EditTemplateDialog which will be opened.

editTemplate

protected 
Template editTemplate(
Template template,
                                boolean edit,
                                boolean isNameModifiable)
Creates the edit dialog. Subclasses may override this method to provide a custom dialog.

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
Since:
3.1

setVisible

public void setVisible(boolean visible)
Description copied from class: DialogPage
The DialogPage implementation of this IDialogPage method sets the control to the given visibility state. Subclasses may extend.

Specified by:
setVisible in interface IDialogPage
Overrides:
setVisible in class DialogPage
Parameters:
visible - true to make this page visible, and false to hide it

performDefaults

protected void performDefaults()
Description copied from class: PreferencePage
Performs 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:
performDefaults in class PreferencePage

performOk

public boolean performOk()
Description copied from interface: IPreferencePage
Notifies that the OK button of this page's container has been pressed.

Specified by:
performOk in interface IPreferencePage
Overrides:
performOk in class PreferencePage
Returns:
false to abort the container's OK processing and true to allow the OK to happen

getFormatterPreferenceKey

protected 
String getFormatterPreferenceKey()
Returns the key to use for the formatter preference.

Returns:
the formatter preference key

performCancel

public boolean performCancel()
Description copied from class: PreferencePage
The preference page implementation of an 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.

Specified by:
performCancel in interface IPreferencePage
Overrides:
performCancel in class PreferencePage
Returns:
false to abort the container's cancel procedure and true to allow the cancel to happen
See Also:
IPreferencePage.performCancel()

getViewer

protected 
SourceViewer getViewer()

getTableViewer

protected 
TableViewer getTableViewer()

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire