Search in sources :

Example 6 with TableThreshold

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

the class TableThresholds method moveSelectionUp.

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

Example 7 with TableThreshold

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

the class TableThresholds method duplicateThreshold.

/**
 * Duplicate selected threshold
 */
@SuppressWarnings("unchecked")
private void duplicateThreshold() {
    final IStructuredSelection selection = (IStructuredSelection) thresholdList.getSelection();
    if (selection.size() > 0) {
        List<TableThreshold> list = selection.toList();
        for (TableThreshold t : list) {
            thresholds.add(thresholds.indexOf(t) + 1, new TableThreshold(t));
            thresholdList.setInput(thresholds.toArray());
        }
    }
}
Also used : TableThreshold(org.netxms.client.datacollection.TableThreshold) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

TableThreshold (org.netxms.client.datacollection.TableThreshold)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 EditTableThresholdDialog (org.netxms.ui.eclipse.datacollection.dialogs.EditTableThresholdDialog)2 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 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 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 DataCollectionItem (org.netxms.client.datacollection.DataCollectionItem)1 DataCollectionObject (org.netxms.client.datacollection.DataCollectionObject)1