use of org.netxms.client.events.EventObject in project netxms by netxms.
the class ExportFileBuilder method addRules.
/**
* Add rules to list
*/
private void addRules() {
RuleSelectionDialog dlg = new RuleSelectionDialog(getSite().getShell(), rulesCache);
if (dlg.open() == Window.OK) {
final Set<Long> eventCodes = new HashSet<Long>();
for (EventProcessingPolicyRule r : dlg.getSelectedRules()) {
rules.put(r.getRuleNumber(), r);
for (Long e : r.getEvents()) {
if (e >= 100000) {
eventCodes.add(e);
}
}
}
ruleViewer.setInput(rules.values().toArray());
setModified();
if (eventCodes.size() > 0) {
for (EventObject o : session.findMultipleEventObjects(eventCodes.toArray(new Long[eventCodes.size()]))) {
events.put(o.getCode(), o);
}
eventViewer.setInput(events.values().toArray());
}
;
}
}
use of org.netxms.client.events.EventObject in project netxms by netxms.
the class ExportFileBuilder method addEvents.
/**
* Add events to list
*/
private void addEvents() {
EventSelectionDialog dlg = new EventSelectionDialog(getSite().getShell(), true);
dlg.enableMultiSelection(true);
if (dlg.open() == Window.OK) {
for (EventObject t : dlg.getSelectedEvents()) {
if (t instanceof EventGroup)
addEventGroups((EventGroup) t);
else
events.put(t.getCode(), t);
}
eventViewer.setInput(events.values().toArray());
setModified();
}
}
use of org.netxms.client.events.EventObject in project netxms by netxms.
the class SnmpTrapComparator method compare.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
TableColumn sortColumn = ((TableViewer) viewer).getTable().getSortColumn();
if (sortColumn == null)
return 0;
int rc;
SnmpTrap trap1 = (SnmpTrap) e1;
SnmpTrap trap2 = (SnmpTrap) e2;
switch(// $NON-NLS-1$
(Integer) sortColumn.getData("ID")) {
case SelectSnmpTrapDialog.COLUMN_OID:
rc = trap1.getObjectId().compareTo(trap2.getObjectId());
break;
case SelectSnmpTrapDialog.COLUMN_EVENT:
EventObject evo1 = session.findEventObjectByCode(trap1.getEventCode());
EventObject evo2 = session.findEventObjectByCode(trap2.getEventCode());
// $NON-NLS-1$ //$NON-NLS-2$
String name1 = (evo1 != null) ? evo1.getName() : ("[" + Integer.toString(trap1.getEventCode()) + "]");
// $NON-NLS-1$ //$NON-NLS-2$
String name2 = (evo2 != null) ? evo2.getName() : ("[" + Integer.toString(trap2.getEventCode()) + "]");
rc = name1.compareToIgnoreCase(name2);
break;
case SelectSnmpTrapDialog.COLUMN_DESCRIPTION:
rc = trap1.getDescription().compareToIgnoreCase(trap2.getDescription());
break;
default:
rc = 0;
break;
}
int dir = ((TableViewer) viewer).getTable().getSortDirection();
return (dir == SWT.UP) ? rc : -rc;
}
use of org.netxms.client.events.EventObject in project netxms by netxms.
the class EventFieldEditor method selectEvent.
/**
* Select event
*/
private void selectEvent() {
EventSelectionDialog dlg = new EventSelectionDialog(getShell(), false);
dlg.enableMultiSelection(false);
if (dlg.open() == Window.OK) {
EventObject[] events = dlg.getSelectedEvents();
if (events.length > 0) {
eventCode = events[0].getCode();
text.setText(events[0].getName());
if (events[0] instanceof EventTemplate)
text.setImage(StatusDisplayInfo.getStatusImage(((EventTemplate) events[0]).getSeverity()));
} else {
eventCode = 0;
text.setText(EMPTY_SELECTION_TEXT);
text.setImage(null);
}
}
}
Aggregations