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));
}
}
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());
}
}
}
Aggregations