Search in sources :

Example 6 with ColumnDefinition

use of org.netxms.client.datacollection.ColumnDefinition in project netxms by netxms.

the class TableColumns method moveSelectionUp.

/**
 * Move selected element up
 */
private void moveSelectionUp() {
    final IStructuredSelection selection = (IStructuredSelection) columnList.getSelection();
    if (selection.size() != 1)
        return;
    final ColumnDefinition column = (ColumnDefinition) selection.getFirstElement();
    int index = columns.indexOf(column);
    if (index > 0) {
        Collections.swap(columns, index, index - 1);
        columnList.setInput(columns.toArray());
        columnList.setSelection(new StructuredSelection(column));
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ColumnDefinition(org.netxms.client.datacollection.ColumnDefinition)

Aggregations

ColumnDefinition (org.netxms.client.datacollection.ColumnDefinition)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 EditColumnDialog (org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 RowData (org.eclipse.swt.layout.RowData)1 RowLayout (org.eclipse.swt.layout.RowLayout)1 Button (org.eclipse.swt.widgets.Button)1