Class 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
  • Constructor Details

    • EditTemplateDialog

      public EditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry)
      Creates a new dialog.
      Parameters:
      parent - the shell parent of the dialog
      template - the template to edit
      edit - whether this is a new template or an existing being edited
      isNameModifiable - whether the name of the template may be modified
      registry - the context type registry to use
  • Method Details

    • 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 class Dialog
      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 calling createContents), then initializes this window's shell bounds (by calling initializeBounds).

      Overrides:
      create in class StatusDialog
    • 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 new Composite 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 class Dialog
      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 to Window.OK and closes the dialog. Subclasses may override.

      Overrides:
      okPressed in class Dialog
    • 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 class Dialog
      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: