org.eclipse.cdt.managedbuilder.llvm.ui.preferences
Class LlvmListEditor

java.lang.Object
  extended by org.eclipse.jface.preference.FieldEditor
      extended by org.eclipse.jface.preference.ListEditor
          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
Direct Known Subclasses:
IncludePathListEditor, LibraryListEditor, LibraryPathListEditor

public abstract class LlvmListEditor
extends org.eclipse.jface.preference.ListEditor

An abstract list editor that manages a list of input values. The editor displays a list containing the values, buttons for adding and removing values, and Up and Down buttons to adjust the order of elements in the list.


Field Summary
(package private)  org.eclipse.swt.widgets.Button addButton
          The Add button.
(package private)  org.eclipse.swt.widgets.Composite buttonBox
          The button box containing the Add, Remove, Up, and Down buttons; null if none (before creation or after disposal).
(package private)  org.eclipse.swt.widgets.Button downButton
          The Down button.
(package private)  org.eclipse.swt.widgets.List list
          The list widget; null if none (before creation or after disposal).
(package private)  org.eclipse.swt.widgets.Button removeButton
          The Remove button.
private  org.eclipse.swt.events.SelectionListener selectionListener
          The selection listener.
(package private)  org.eclipse.swt.widgets.Button upButton
          The Up button.
 
Fields inherited from class org.eclipse.jface.preference.FieldEditor
HORIZONTAL_GAP, IS_VALID, VALUE
 
Constructor Summary
protected LlvmListEditor(java.lang.String name, java.lang.String labelText, org.eclipse.swt.widgets.Composite parent)
          Creates a list field editor.
 
Method Summary
(package private)  void addPressed()
          Notifies that the Add button has been pressed.
private  void createButtons(org.eclipse.swt.widgets.Composite box)
          Creates the Add, Remove, Up, and Down button in the given button box.
protected  java.lang.String createList(java.lang.String[] items)
           
private  org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent, java.lang.String key)
          Helper method to create a push button.
 void createSelectionListener()
          Creates a selection listener.
(package private)  void downPressed()
          Notifies that the Down button has been pressed.
 org.eclipse.swt.widgets.Composite getButtonBoxControl(org.eclipse.swt.widgets.Composite parent)
          Returns this field editor's button box containing the Add, Remove, Up, and Down button.
 org.eclipse.swt.widgets.List getListControl(org.eclipse.swt.widgets.Composite parent)
          Returns this field editor's list control.
private  org.eclipse.swt.events.SelectionListener getSelectionListener()
          Returns this field editor's selection listener.
protected  org.eclipse.swt.widgets.Shell getShell()
          Returns this field editor's shell.
protected  java.lang.String[] parseString(java.lang.String stringList)
           
protected abstract  void removePressed()
          Notifies that the Remove button has been pressed.
protected  void selectionChanged()
          Invoked when the selection in the list has changed.
private  void swap(boolean up)
          Moves the currently selected item up or down.
(package private)  void upPressed()
          Notifies that the Up button has been pressed.
 
Methods inherited from class org.eclipse.jface.preference.ListEditor
adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNewInputObject, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
 
Methods inherited from class org.eclipse.jface.preference.FieldEditor
applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

org.eclipse.swt.widgets.List list
The list widget; null if none (before creation or after disposal).


buttonBox

org.eclipse.swt.widgets.Composite buttonBox
The button box containing the Add, Remove, Up, and Down buttons; null if none (before creation or after disposal).


addButton

org.eclipse.swt.widgets.Button addButton
The Add button.


removeButton

org.eclipse.swt.widgets.Button removeButton
The Remove button.


upButton

org.eclipse.swt.widgets.Button upButton
The Up button.


downButton

org.eclipse.swt.widgets.Button downButton
The Down button.


selectionListener

private org.eclipse.swt.events.SelectionListener selectionListener
The selection listener.

Constructor Detail

LlvmListEditor

protected LlvmListEditor(java.lang.String name,
                         java.lang.String labelText,
                         org.eclipse.swt.widgets.Composite parent)
Creates a list field editor.

Parameters:
name - the name of the preference this field editor works on
labelText - the label text of the field editor
parent - the parent of the field editor's control
Method Detail

createList

protected java.lang.String createList(java.lang.String[] items)
Specified by:
createList in class org.eclipse.jface.preference.ListEditor

parseString

protected java.lang.String[] parseString(java.lang.String stringList)
Specified by:
parseString in class org.eclipse.jface.preference.ListEditor

createButtons

private void createButtons(org.eclipse.swt.widgets.Composite box)
Creates the Add, Remove, Up, and Down button in the given button box.

Parameters:
box - the box for the buttons

createPushButton

private org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent,
                                                        java.lang.String key)
Helper method to create a push button.

Parameters:
parent - the parent control
key - the resource name used to supply the button's label text
Returns:
Button

createSelectionListener

public void createSelectionListener()
Creates a selection listener.

Overrides:
createSelectionListener in class org.eclipse.jface.preference.ListEditor

getButtonBoxControl

public org.eclipse.swt.widgets.Composite getButtonBoxControl(org.eclipse.swt.widgets.Composite parent)
Returns this field editor's button box containing the Add, Remove, Up, and Down button.

Overrides:
getButtonBoxControl in class org.eclipse.jface.preference.ListEditor
Parameters:
parent - the parent control
Returns:
the button box

getListControl

public org.eclipse.swt.widgets.List getListControl(org.eclipse.swt.widgets.Composite parent)
Returns this field editor's list control.

Overrides:
getListControl in class org.eclipse.jface.preference.ListEditor
Parameters:
parent - the parent control
Returns:
the list control

getSelectionListener

private org.eclipse.swt.events.SelectionListener getSelectionListener()
Returns this field editor's selection listener. The listener is created if nessessary.

Returns:
the selection listener

selectionChanged

protected void selectionChanged()
Invoked when the selection in the list has changed.

The default implementation of this method utilizes the selection index and the size of the list to toggle the enablement of the up, down and remove buttons.

Overrides:
selectionChanged in class org.eclipse.jface.preference.ListEditor

swap

private void swap(boolean up)
Moves the currently selected item up or down.

Parameters:
up - true if the item should move up, and false if it should move down

getShell

protected org.eclipse.swt.widgets.Shell getShell()
Returns this field editor's shell.

This method is internal to the framework; subclasses should not call this method.

Overrides:
getShell in class org.eclipse.jface.preference.ListEditor
Returns:
the shell

addPressed

void addPressed()
Notifies that the Add button has been pressed.


removePressed

protected abstract void removePressed()
Notifies that the Remove button has been pressed.


upPressed

void upPressed()
Notifies that the Up button has been pressed.


downPressed

void downPressed()
Notifies that the Down button has been pressed.