semorg.gui.provider
Class EnumDlg

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by semorg.gui.provider.EnumDlg
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class EnumDlg
extends org.eclipse.jface.dialogs.Dialog

Provides a very simple dialog to edit enumeration constants.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
private  org.eclipse.swt.widgets.Text editor
          The text field to enter the new values.
private  boolean newDialog
          true if the user inserts a new enumeration otherwise it is set to false, i.e. the user changes an existing enumeration.
private  String newValue
          The new value of the enumeration.
private  String oldValue
          The old value of the enumeration.
 
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
EnumDlg(org.eclipse.swt.widgets.Shell parent, String value)
          Creates a new enumeration dialog to edit the value of a enumeration.
 
Method Summary
protected  void buttonPressed(int buttonId)
          Assigns methods to the buttons, which will be executed when the appropriate button was pressed.
protected  void cancelPressed()
          Sets the return code to the cancel button id and closes the dialog.
protected  void configureShell(org.eclipse.swt.widgets.Shell shell)
          Simply configures the given shell by setting the size and the title e.g..
protected  void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
          Creates the buttons for the button bar of this dialog.
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
          Creates the dialog area including the text field to enter new values or change existing one.
 String getNewValue()
          Gets the new value of enumeration type.
protected  void okPressed()
          Sets the return code to the ok button id and closes the dialog.
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, 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, getLayout, 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
 

Field Detail

newDialog

private boolean newDialog
true if the user inserts a new enumeration otherwise it is set to false, i.e. the user changes an existing enumeration.


editor

private org.eclipse.swt.widgets.Text editor
The text field to enter the new values.


newValue

private String newValue
The new value of the enumeration.


oldValue

private String oldValue
The old value of the enumeration.

Constructor Detail

EnumDlg

public EnumDlg(org.eclipse.swt.widgets.Shell parent,
               String value)
Creates a new enumeration dialog to edit the value of a enumeration.

Parameters:
parent - the parent shell.
value - the old value of the enumeration (= initial value of the text field editor).
Method Detail

createButtonsForButtonBar

protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
Creates the buttons for the button bar of this dialog.

Overrides:
createButtonsForButtonBar in class org.eclipse.jface.dialogs.Dialog
Parameters:
parent - the parent composite which contains the buttons

buttonPressed

protected void buttonPressed(int buttonId)
Assigns methods to the buttons, which will be executed when the appropriate button was pressed.

Overrides:
buttonPressed in class org.eclipse.jface.dialogs.Dialog
Parameters:
buttonId - the id of the button pressed.

okPressed

protected void okPressed()
Sets the return code to the ok button id and closes the dialog.

Overrides:
okPressed in class org.eclipse.jface.dialogs.Dialog

cancelPressed

protected void cancelPressed()
Sets the return code to the cancel button id and closes the dialog.

Overrides:
cancelPressed in class org.eclipse.jface.dialogs.Dialog

createDialogArea

protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
Creates the dialog area including the text field to enter new values or change existing one.

Overrides:
createDialogArea in class org.eclipse.jface.dialogs.Dialog
Parameters:
parent - the composite which contains the dialog.
Returns:
the created dialog area as a Composite.

getNewValue

public String getNewValue()
Gets the new value of enumeration type.

Returns:
the new value

configureShell

protected void configureShell(org.eclipse.swt.widgets.Shell shell)
Simply configures the given shell by setting the size and the title e.g..

Overrides:
configureShell in class org.eclipse.jface.window.Window
Parameters:
shell - the shell to configure.