Class TemplatePreferencePage.EditTemplateDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.jface.dialogs.TrayDialog
-
- org.eclipse.jface.dialogs.StatusDialog
-
- org.eclipse.ui.texteditor.templates.TemplatePreferencePage.EditTemplateDialog
-
- All Implemented Interfaces:
IShellProvider
- Enclosing class:
- TemplatePreferencePage
protected static class TemplatePreferencePage.EditTemplateDialog extends StatusDialog
Dialog to edit a template. Clients will usually instantiate, but may also extend.- Since:
- 3.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
-
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
-
Constructor Summary
Constructors Constructor Description EditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry)
Creates a new dialog.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create()
Creates this window's widgetry in a new top-level shell.protected Control
createDialogArea(Composite ancestor)
Creates and returns the contents of the upper part of this dialog (above the button bar).protected SourceViewer
createViewer(Composite parent)
Creates the viewer to be used to display the pattern.protected IDialogSettings
getDialogBoundsSettings()
Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.Template
getTemplate()
Returns the created template.protected IContentAssistProcessor
getTemplateProcessor()
Returns the content assist processor that suggests template variables.protected boolean
isResizable()
Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.protected boolean
isValidPattern(String pattern)
Validates the pattern.protected void
okPressed()
Notifies that the ok button of this dialog has been pressed.-
Methods inherited from class org.eclipse.jface.dialogs.StatusDialog
configureShell, createButtonBar, createButtonsForButtonBar, getStatus, setImage, setStatusLineAboveButtons, setTitle, updateButtonsEnableState, updateStatus
-
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
-
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
-
-
-
Constructor Detail
-
EditTemplateDialog
public EditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry)
Creates a new dialog.- Parameters:
parent
- the shell parent of the dialogtemplate
- the template to editedit
- whether this is a new template or an existing being editedisNameModifiable
- whether the name of the template may be modifiedregistry
- the context type registry to use
-
-
Method Detail
-
isResizable
protected boolean isResizable()
Description copied from class:Dialog
Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.This method is used to ensure that all style bits appropriate for resizable dialogs are added to the shell style. Individual dialogs may always set the shell style to ensure that a dialog is resizable, but using this method ensures that resizable dialogs will be created with the same set of style bits.
Style bits will never be removed based on the return value of this method. For example, if a dialog returns
false
, but also sets a style bit for a SWT.RESIZE border, the style bit will be honored.- Overrides:
isResizable
in classDialog
- Returns:
- a boolean indicating whether the dialog is resizable and should have the default style bits for resizable dialogs
-
create
public void create()
Description copied from class:Window
Creates this window's widgetry in a new top-level shell.The default implementation of this framework method creates this window's shell (by calling
createShell
), and its controls (by callingcreateContents
), then initializes this window's shell bounds (by callinginitializeBounds
).- Overrides:
create
in classStatusDialog
-
createDialogArea
protected Control createDialogArea(Composite ancestor)
Description copied from class:Dialog
Creates and returns the contents of the upper part of this dialog (above the button bar).The
Dialog
implementation of this framework method creates and returns a newComposite
with standard margins and spacing.The returned control's layout data must be an instance of
GridData
. This method must not modify the parent's layout.Subclasses must override this method but may call
super
as in the following example:Composite composite = (Composite) super.createDialogArea(parent); //add controls to composite as necessary return composite;
- Overrides:
createDialogArea
in classDialog
- Parameters:
ancestor
- the parent composite to contain the dialog area- Returns:
- the dialog area control
-
createViewer
protected SourceViewer createViewer(Composite parent)
Creates the viewer to be used to display the pattern. Subclasses may override.- Parameters:
parent
- the parent composite of the viewer- Returns:
- a configured
SourceViewer
-
isValidPattern
protected boolean isValidPattern(String pattern)
Validates the pattern.The default implementation rejects invalid XML characters.
- Parameters:
pattern
- the pattern to verify- Returns:
true
if the pattern is valid- Since:
- 3.7 protected, before it was private
-
okPressed
protected void okPressed()
Description copied from class:Dialog
Notifies that the ok button of this dialog has been pressed.The
Dialog
implementation of this framework method sets this dialog's return code toWindow.OK
and closes the dialog. Subclasses may override.
-
getTemplate
public Template getTemplate()
Returns the created template.- Returns:
- the created template
- Since:
- 3.1
-
getTemplateProcessor
protected IContentAssistProcessor getTemplateProcessor()
Returns the content assist processor that suggests template variables.- Returns:
- the processor to suggest variables
- Since:
- 3.3
-
getDialogBoundsSettings
protected IDialogSettings getDialogBoundsSettings()
Description copied from class:Dialog
Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.- Overrides:
getDialogBoundsSettings
in classDialog
- Returns:
- settings the dialog settings used to store the dialog's location
and/or size, or
null
if the dialog's bounds should never be stored. - See Also:
Dialog.getDialogBoundsStrategy()
-
-