use of org.netxms.ui.eclipse.alarmviewer.dialogs.AlarmStateChangeFailureDialog in project netxms by netxms.
the class AlarmList method terminateAlarms.
/**
* Terminate selected alarms
*/
private void terminateAlarms() {
IStructuredSelection selection = (IStructuredSelection) alarmViewer.getSelection();
if (selection.isEmpty())
return;
final List<Long> alarmIds = new ArrayList<Long>(selection.size());
for (Object o : selection.toList()) alarmIds.add(((Alarm) o).getId());
new ConsoleJob(Messages.get().TerminateAlarm_JobTitle, viewPart, Activator.PLUGIN_ID, AlarmList.JOB_FAMILY) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final Map<Long, Integer> terminationFails = session.bulkTerminateAlarms(alarmIds);
if (!terminationFails.isEmpty()) {
runInUIThread(new Runnable() {
@Override
public void run() {
AlarmStateChangeFailureDialog dlg = new AlarmStateChangeFailureDialog(viewPart.getSite().getShell(), terminationFails);
if (dlg.open() == Window.OK) {
return;
}
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().TerminateAlarm_ErrorMessage;
}
}.start();
}
use of org.netxms.ui.eclipse.alarmviewer.dialogs.AlarmStateChangeFailureDialog in project netxms by netxms.
the class AlarmList method resolveAlarms.
/**
* Resolve selected alarms
*/
private void resolveAlarms() {
IStructuredSelection selection = (IStructuredSelection) alarmViewer.getSelection();
if (selection.isEmpty())
return;
final List<Long> alarmIds = new ArrayList<Long>(selection.size());
for (Object o : selection.toList()) alarmIds.add(((Alarm) o).getId());
new ConsoleJob(Messages.get().AlarmList_Resolving, viewPart, Activator.PLUGIN_ID, AlarmList.JOB_FAMILY) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final Map<Long, Integer> resolveFails = session.bulkResolveAlarms(alarmIds);
if (!resolveFails.isEmpty()) {
runInUIThread(new Runnable() {
@Override
public void run() {
AlarmStateChangeFailureDialog dlg = new AlarmStateChangeFailureDialog(viewPart.getSite().getShell(), resolveFails);
if (dlg.open() == Window.OK) {
return;
}
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().AlarmList_CannotResoveAlarm;
}
}.start();
}
Aggregations