public class ListDialogField extends DialogField
| Modifier and Type | Class and Description |
|---|---|
static class |
ListDialogField.ColumnsDescription |
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
fButtonLabels |
protected List |
fElements |
protected org.eclipse.jface.viewers.ILabelProvider |
fLabelProvider |
protected org.eclipse.xtext.ui.editor.tasks.dialogfields.ListDialogField.ListViewerAdapter |
fListViewerAdapter |
protected org.eclipse.jface.viewers.TableViewer |
fTable |
protected org.eclipse.swt.widgets.Control |
fTableControl |
protected org.eclipse.jface.viewers.ViewerComparator |
fViewerComparator |
fLabelText| Constructor and Description |
|---|
ListDialogField(IListAdapter adapter,
String[] buttonLabels,
org.eclipse.jface.viewers.ILabelProvider lprovider)
Creates the
ListDialogField. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addElement(Object element)
Adds an element at the end of the list.
|
boolean |
addElement(Object element,
int index)
Adds an element at a position.
|
boolean |
addElements(List elements)
Adds elements at the end of the list.
|
boolean |
addElements(List elements,
int index)
Adds elements at the given index
|
boolean |
canMoveDown() |
boolean |
canMoveUp() |
protected org.eclipse.swt.widgets.Button |
createButton(org.eclipse.swt.widgets.Composite parent,
String label,
org.eclipse.swt.events.SelectionListener listener) |
protected org.eclipse.jface.viewers.TableViewer |
createTableViewer(org.eclipse.swt.widgets.Composite parent) |
void |
dialogFieldChanged()
Programatical invocation of a dialog field change.
|
protected void |
doDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent event) |
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.
|
protected void |
doListSelected(org.eclipse.jface.viewers.SelectionChangedEvent event) |
void |
editElement(Object element) |
void |
elementChanged(Object element)
Notifies clients that the element has changed.
|
void |
enableButton(int index,
boolean enable)
Sets a button enabled or disabled.
|
org.eclipse.swt.widgets.Composite |
getButtonBox(org.eclipse.swt.widgets.Composite parent)
Returns the composite containing the buttons.
|
Object |
getElement(int index)
Gets the elements shown at the given index.
|
List |
getElements()
Gets the elements shown in the list.
|
int |
getIndexOfElement(Object elem)
Gets the index of an element in the list or -1 if element is not in list.
|
org.eclipse.swt.widgets.Control |
getListControl(org.eclipse.swt.widgets.Composite parent)
Returns the list control.
|
protected int |
getListStyle() |
protected boolean |
getManagedButtonState(org.eclipse.jface.viewers.ISelection sel,
int index) |
int |
getNumberOfControls()
Returns the number of columns of the dialog field.
|
List |
getSelectedElements()
Returns the selected elements.
|
int |
getSize()
Gets the number of elements
|
org.eclipse.jface.viewers.TableViewer |
getTableViewer()
Returns the internally used table viewer.
|
protected void |
handleKeyPressed(org.eclipse.swt.events.KeyEvent event)
Handles key events in the table viewer.
|
protected boolean |
managedButtonPressed(int index)
Checks if the button pressed is handled internally
|
void |
postSetSelection(org.eclipse.jface.viewers.ISelection selection) |
void |
refresh()
Refreshes the table.
|
void |
removeAllElements()
Adds an element at a position.
|
void |
removeElement(Object element)
Removes an element from the list.
|
void |
removeElements(List elements)
Removes elements from the list.
|
void |
replaceElement(Object oldElement,
Object newElement)
Replaces an element.
|
void |
selectElements(org.eclipse.jface.viewers.ISelection selection) |
void |
selectFirstElement() |
void |
setButtonsMinWidth(int minWidth)
Sets the minimal width of the buttons.
|
void |
setDownButtonIndex(int downButtonIndex)
Sets the index of the 'down' button in the button label array passed in
the constructor.
|
void |
setElements(Collection elements)
Sets the elements shown in the list.
|
void |
setRemoveButtonIndex(int removeButtonIndex)
Sets the index of the 'remove' button in the button label array passed in
the constructor.
|
void |
setTableColumns(ListDialogField.ColumnsDescription column) |
void |
setUpButtonIndex(int upButtonIndex)
Sets the index of the 'up' button in the button label array passed in the
constructor.
|
void |
setViewerComparator(org.eclipse.jface.viewers.ViewerComparator viewerComparator)
Sets the viewer comparator.
|
void |
setViewerSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
Deprecated.
Use
setViewerComparator(ViewerComparator) instead} |
protected void |
updateButtonState() |
protected void |
updateEnableState()
Called when the enable state changed.
|
assertCompositeNotNull, assertEnoughColumns, createEmptySpace, createEmptySpace, getLabelControl, gridDataForLabel, isEnabled, isOkToUse, postSetFocusOnDialogField, setDialogFieldListener, setEnabled, setFocus, setLabelTextprotected org.eclipse.jface.viewers.TableViewer fTable
protected org.eclipse.swt.widgets.Control fTableControl
protected org.eclipse.jface.viewers.ILabelProvider fLabelProvider
protected org.eclipse.xtext.ui.editor.tasks.dialogfields.ListDialogField.ListViewerAdapter fListViewerAdapter
protected List fElements
protected org.eclipse.jface.viewers.ViewerComparator fViewerComparator
protected String[] fButtonLabels
public ListDialogField(IListAdapter adapter, String[] buttonLabels, org.eclipse.jface.viewers.ILabelProvider lprovider)
ListDialogField.adapter - A listener for button invocation, selection changes. Can be
null.buttonLabels - The labels of all buttons: null is a valid array
entry and marks a separator.lprovider - The label provider to render the table entriespublic void setRemoveButtonIndex(int removeButtonIndex)
public void setUpButtonIndex(int upButtonIndex)
public void setDownButtonIndex(int downButtonIndex)
public void setViewerComparator(org.eclipse.jface.viewers.ViewerComparator viewerComparator)
viewerComparator - The viewer comparator to setpublic void setTableColumns(ListDialogField.ColumnsDescription column)
protected boolean managedButtonPressed(int index)
public org.eclipse.swt.widgets.Control[] doFillIntoGrid(org.eclipse.swt.widgets.Composite parent,
int nColumns)
DialogFieldMGridLayout as layout. The
dialog field will adjust its controls' spans to the number of columns
given. To be reimplemented by dialog field implementors.doFillIntoGrid in class DialogFieldpublic int getNumberOfControls()
DialogFieldgetNumberOfControls in class DialogFieldpublic void setButtonsMinWidth(int minWidth)
public org.eclipse.swt.widgets.Control getListControl(org.eclipse.swt.widgets.Composite parent)
parent - The parent composite when called the first time, or
null after.public org.eclipse.jface.viewers.TableViewer getTableViewer()
protected int getListStyle()
protected org.eclipse.jface.viewers.TableViewer createTableViewer(org.eclipse.swt.widgets.Composite parent)
protected org.eclipse.swt.widgets.Button createButton(org.eclipse.swt.widgets.Composite parent,
String label,
org.eclipse.swt.events.SelectionListener listener)
public org.eclipse.swt.widgets.Composite getButtonBox(org.eclipse.swt.widgets.Composite parent)
parent - The parent composite when called the first time, or
null after.protected void handleKeyPressed(org.eclipse.swt.events.KeyEvent event)
public void dialogFieldChanged()
DialogFielddialogFieldChanged in class DialogFieldprotected void updateButtonState()
protected boolean getManagedButtonState(org.eclipse.jface.viewers.ISelection sel,
int index)
protected void updateEnableState()
DialogFieldupdateEnableState in class DialogFieldpublic void enableButton(int index,
boolean enable)
public void setElements(Collection elements)
public List getElements()
public Object getElement(int index)
public int getIndexOfElement(Object elem)
public void replaceElement(Object oldElement, Object newElement) throws IllegalArgumentException
IllegalArgumentExceptionpublic void elementChanged(Object element) throws IllegalArgumentException
IllegalArgumentExceptionpublic boolean addElement(Object element)
public boolean addElement(Object element, int index)
public boolean addElements(List elements, int index)
public boolean addElements(List elements)
public void removeAllElements()
public void removeElement(Object element) throws IllegalArgumentException
IllegalArgumentExceptionpublic void removeElements(List elements)
public int getSize()
public void selectElements(org.eclipse.jface.viewers.ISelection selection)
public void selectFirstElement()
public void editElement(Object element)
public void postSetSelection(org.eclipse.jface.viewers.ISelection selection)
public void refresh()
refresh in class DialogFieldpublic boolean canMoveUp()
public boolean canMoveDown()
public List getSelectedElements()
protected void doListSelected(org.eclipse.jface.viewers.SelectionChangedEvent event)
protected void doDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent event)
@Deprecated public void setViewerSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
setViewerComparator(ViewerComparator) instead}Copyright © 2016. All Rights Reserved.