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

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TrayDialog
              extended by org.eclipse.jface.dialogs.StatusDialog
                  extended by org.eclipse.xtext.ui.codetemplates.ui.preferences.EditTemplateDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider, IEditTemplateDialog

public class EditTemplateDialog
extends org.eclipse.jface.dialogs.StatusDialog
implements IEditTemplateDialog

Author:
Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.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
 
Constructor Summary
EditTemplateDialog(org.eclipse.swt.widgets.Shell parent, org.eclipse.jface.text.templates.Template template, boolean edit, boolean isNameModifiable, org.eclipse.jface.text.templates.ContextTypeRegistry registry, TemplatesLanguageConfiguration configuration, ISyntheticResourceProvider resourceProvider, java.lang.String languageName)
           
 
Method Summary
 boolean close()
          Closes this window, disposes its shell, and removes this window from its window manager (if it has one).
 void create()
          Creates this window's widgetry in a new top-level shell.
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite ancestor)
          Creates and returns the contents of the upper part of this dialog (above the button bar).
protected  org.eclipse.core.runtime.Status createErrorStatus(java.lang.String message, org.eclipse.jface.text.templates.TemplateException e)
           
protected  org.eclipse.jface.text.source.SourceViewer createViewer(org.eclipse.swt.widgets.Composite parent)
           
protected  void doSourceChanged(org.eclipse.jface.text.IDocument document)
           
protected  void doTextWidgetChanged(org.eclipse.swt.widgets.Widget w)
           
protected  java.lang.String getContextId()
           
protected  java.lang.String getContextName()
           
protected  org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings()
          Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.
protected  java.lang.String getPattern()
           
protected  java.lang.String getPrefix()
           
 org.eclipse.jface.text.templates.Template getTemplate()
           
protected  void installUndoRedoSupport(org.eclipse.jface.text.source.SourceViewer viewer)
           
protected  boolean isResizable()
          Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.
protected  void okPressed()
          Notifies that the ok button of this dialog has been pressed.
protected  void uninstallUndoRedoSupport()
           
protected  void updateAction(java.lang.String actionId)
           
protected  void updateSelectionDependentActions()
           
 
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, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, 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, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.xtext.ui.codetemplates.ui.preferences.IEditTemplateDialog
open
 

Constructor Detail

EditTemplateDialog

public EditTemplateDialog(org.eclipse.swt.widgets.Shell parent,
                          org.eclipse.jface.text.templates.Template template,
                          boolean edit,
                          boolean isNameModifiable,
                          org.eclipse.jface.text.templates.ContextTypeRegistry registry,
                          TemplatesLanguageConfiguration configuration,
                          ISyntheticResourceProvider resourceProvider,
                          java.lang.String languageName)
Method Detail

isResizable

protected boolean isResizable()
Description copied from class: org.eclipse.jface.dialogs.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 org.eclipse.jface.dialogs.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: org.eclipse.jface.window.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 org.eclipse.jface.dialogs.StatusDialog

createDialogArea

protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite ancestor)
Description copied from class: org.eclipse.jface.dialogs.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 org.eclipse.jface.dialogs.Dialog
Parameters:
ancestor - the parent composite to contain the dialog area
Returns:
the dialog area control

doTextWidgetChanged

protected void doTextWidgetChanged(org.eclipse.swt.widgets.Widget w)

getContextName

protected java.lang.String getContextName()

doSourceChanged

protected void doSourceChanged(org.eclipse.jface.text.IDocument document)

getContextId

protected java.lang.String getContextId()

createErrorStatus

protected org.eclipse.core.runtime.Status createErrorStatus(java.lang.String message,
                                                            org.eclipse.jface.text.templates.TemplateException e)

installUndoRedoSupport

protected void installUndoRedoSupport(org.eclipse.jface.text.source.SourceViewer viewer)

close

public boolean close()
Description copied from class: org.eclipse.jface.window.Window
Closes this window, disposes its shell, and removes this window from its window manager (if it has one).

This framework method may be extended (super.close must be called).

Note that in order to prevent recursive calls to this method it does not call Shell#close(). As a result ShellListeners will not receive a shellClosed event.

Overrides:
close in class org.eclipse.jface.dialogs.TrayDialog
Returns:
true if the window is (or was already) closed, and false if it is still open
See Also:
Window.close()

uninstallUndoRedoSupport

protected void uninstallUndoRedoSupport()

createViewer

protected org.eclipse.jface.text.source.SourceViewer createViewer(org.eclipse.swt.widgets.Composite parent)

getPrefix

protected java.lang.String getPrefix()

updateSelectionDependentActions

protected void updateSelectionDependentActions()

updateAction

protected void updateAction(java.lang.String actionId)

okPressed

protected void okPressed()
Description copied from class: org.eclipse.jface.dialogs.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 org.eclipse.jface.dialogs.Dialog

getTemplate

public org.eclipse.jface.text.templates.Template getTemplate()
Specified by:
getTemplate in interface IEditTemplateDialog

getPattern

protected java.lang.String getPattern()

getDialogBoundsSettings

protected org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings()
Description copied from class: org.eclipse.jface.dialogs.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 org.eclipse.jface.dialogs.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:
Dialog.getDialogBoundsStrategy()