use of org.netxms.ui.eclipse.snmp.dialogs.TrapConfigurationDialog in project netxms by netxms.
the class SnmpTrapEditor method editTrap.
/**
* Edit selected trap
*/
protected void editTrap() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final SnmpTrap trap = (SnmpTrap) selection.getFirstElement();
TrapConfigurationDialog dlg = new TrapConfigurationDialog(getViewSite().getShell(), trap);
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().SnmpTrapEditor_ModifyJob_Title, this, Activator.PLUGIN_ID, null) {
@Override
protected String getErrorMessage() {
return Messages.get().SnmpTrapEditor_ModifyJob_Error;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifySnmpTrapConfiguration(trap);
}
}.start();
}
}
use of org.netxms.ui.eclipse.snmp.dialogs.TrapConfigurationDialog in project netxms by netxms.
the class SnmpTrapEditor method createTrap.
/**
* Create new trap
*/
protected void createTrap() {
final SnmpTrap trap = new SnmpTrap();
// SYS_UNMATCHED_SNMP_TRAP
trap.setEventCode(500);
TrapConfigurationDialog dlg = new TrapConfigurationDialog(getViewSite().getShell(), trap);
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().SnmpTrapEditor_CreateJob_Title, this, Activator.PLUGIN_ID, null) {
@Override
protected String getErrorMessage() {
return Messages.get().SnmpTrapEditor_CreateJob_Error;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
trap.setId(session.createSnmpTrapConfiguration());
session.modifySnmpTrapConfiguration(trap);
}
}.start();
}
}
Aggregations