org.eclipse.xtext.ui.editor.tasks.dialogfields
Class ComboDialogField

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.tasks.dialogfields.DialogField
      extended by org.eclipse.xtext.ui.editor.tasks.dialogfields.ComboDialogField

public class ComboDialogField
extends DialogField

Dialog field containing a label and a combo control.


Field Summary
 
Fields inherited from class org.eclipse.xtext.ui.editor.tasks.dialogfields.DialogField
fLabelText
 
Constructor Summary
ComboDialogField(int flags)
           
 
Method Summary
 org.eclipse.swt.widgets.Control[] doFillIntoGrid(org.eclipse.swt.widgets.Composite parent, int nColumns)
          Creates all controls of the dialog field and fills it to a composite.
 org.eclipse.swt.widgets.Combo getComboControl(org.eclipse.swt.widgets.Composite parent)
          Creates or returns the created combo control.
 java.lang.String[] getItems()
          Gets the combo items.
 int getNumberOfControls()
          Returns the number of columns of the dialog field.
 int getSelectionIndex()
           
 java.lang.String getText()
          Gets the text.
protected static org.eclipse.swt.layout.GridData gridDataForCombo(int span)
           
 void refresh()
          Brings the UI in sync with the model.
 boolean selectItem(int index)
          Selects an item.
 boolean selectItem(java.lang.String name)
          Selects an item.
 boolean setFocus()
          Tries to set the focus to the dialog field.
 void setItems(java.lang.String[] items)
          Sets the combo items.
 void setText(java.lang.String text)
          Sets the text.
 void setTextWithoutUpdate(java.lang.String text)
          Sets the text without triggering a dialog-changed event.
protected  void updateEnableState()
          Called when the enable state changed.
 
Methods inherited from class org.eclipse.xtext.ui.editor.tasks.dialogfields.DialogField
assertCompositeNotNull, assertEnoughColumns, createEmptySpace, createEmptySpace, dialogFieldChanged, getLabelControl, gridDataForLabel, isEnabled, isOkToUse, postSetFocusOnDialogField, setDialogFieldListener, setEnabled, setLabelText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComboDialogField

public ComboDialogField(int flags)
Method Detail

doFillIntoGrid

public org.eclipse.swt.widgets.Control[] doFillIntoGrid(org.eclipse.swt.widgets.Composite parent,
                                                        int nColumns)
Description copied from class: DialogField
Creates all controls of the dialog field and fills it to a composite. The composite is assumed to have MGridLayout as layout. The dialog field will adjust its controls' spans to the number of columns given. To be reimplemented by dialog field implementors.

Overrides:
doFillIntoGrid in class DialogField

getNumberOfControls

public int getNumberOfControls()
Description copied from class: DialogField
Returns the number of columns of the dialog field. To be reimplemented by dialog field implementors.

Overrides:
getNumberOfControls in class DialogField

gridDataForCombo

protected static org.eclipse.swt.layout.GridData gridDataForCombo(int span)

setFocus

public boolean setFocus()
Description copied from class: DialogField
Tries to set the focus to the dialog field. Returns true if the dialog field can take focus. To be reimplemented by dialog field implementors.

Overrides:
setFocus in class DialogField

getComboControl

public org.eclipse.swt.widgets.Combo getComboControl(org.eclipse.swt.widgets.Composite parent)
Creates or returns the created combo control.

Parameters:
parent - The parent composite or null when the widget has already been created.

updateEnableState

protected void updateEnableState()
Description copied from class: DialogField
Called when the enable state changed. To be extended by dialog field implementors.

Overrides:
updateEnableState in class DialogField

getItems

public java.lang.String[] getItems()
Gets the combo items.


setItems

public void setItems(java.lang.String[] items)
Sets the combo items. Triggers a dialog-changed event.


getText

public java.lang.String getText()
Gets the text.


setText

public void setText(java.lang.String text)
Sets the text. Triggers a dialog-changed event.


selectItem

public boolean selectItem(int index)
Selects an item.


selectItem

public boolean selectItem(java.lang.String name)
Selects an item.


getSelectionIndex

public int getSelectionIndex()

setTextWithoutUpdate

public void setTextWithoutUpdate(java.lang.String text)
Sets the text without triggering a dialog-changed event.


refresh

public void refresh()
Description copied from class: DialogField
Brings the UI in sync with the model. Only needed when model was changed in different thread whil UI was lready created.

Overrides:
refresh in class DialogField