use of org.netxms.ui.eclipse.datacollection.api.DataCollectionObjectEditor in project netxms by netxms.
the class DataCollectionEditor method setItemStatus.
/**
* Change status for selected items
*
* @param newStatus New status
*/
private void setItemStatus(final int newStatus) {
final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() <= 0)
return;
new ConsoleJob(Messages.get().DataCollectionEditor_ChStatusJob_Title + object.getObjectName(), this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final long[] itemList = new long[selection.size()];
int pos = 0;
for (Object dci : selection.toList()) {
itemList[pos++] = ((DataCollectionObject) dci).getId();
}
dciConfig.setObjectStatus(itemList, newStatus);
runInUIThread(new Runnable() {
@Override
public void run() {
for (Object dci : selection.toList()) {
((DataCollectionObject) dci).setStatus(newStatus);
viewer.update(dci, null);
new DataCollectionObjectEditor((DataCollectionObject) dci).modify();
}
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().DataCollectionEditor_ChStatusJob_Error + object.getObjectName();
}
}.start();
}
Aggregations