use of org.netxms.client.events.EventGroup in project netxms by netxms.
the class EventObjectList method createNewEventGroup.
/**
* Create new Event group
*/
protected void createNewEventGroup() {
EventGroup group = new EventGroup();
EditEventGroupDialog dlg = new EditEventGroupDialog(getShell().getShell(), group);
if (dlg.open() == Window.OK)
modifyEventObject(group, true);
}
use of org.netxms.client.events.EventGroup in project netxms by netxms.
the class EventObjectList method refreshView.
/**
* Refresh view
*/
private void refreshView() {
new ConsoleJob(Messages.get().EventConfigurator_OpenJob_Title, null, Activator.PLUGIN_ID, JOB_FAMILY) {
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.jobs.ConsoleJob#getErrorMessage()
*/
@Override
protected String getErrorMessage() {
return Messages.get().EventConfigurator_OpenJob_Error;
}
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.jobs.ConsoleJob#runInternal(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final List<EventObject> list = session.getEventObjects();
runInUIThread(new Runnable() {
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
eventObjects = new HashMap<Long, EventObject>(list.size());
for (final EventObject o : list) {
if ((o instanceof EventGroup) && !showGroups)
continue;
eventObjects.put(o.getCode(), o);
}
viewer.setInput(eventObjects.values().toArray());
}
});
}
}.start();
}
use of org.netxms.client.events.EventGroup in project netxms by netxms.
the class EventObjectList method editEventTemplate.
/**
* Edit currently selected event template
*/
protected void editEventTemplate() {
final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
if (selection.getFirstElement() instanceof EventGroup) {
final EventGroup group = new EventGroup((EventGroup) selection.getFirstElement());
EditEventGroupDialog dlg = new EditEventGroupDialog(getShell().getShell(), group);
if (dlg.open() == Window.OK)
modifyEventObject(group, false);
else
return;
}
final EventTemplate etmpl = new EventTemplate((EventTemplate) selection.getFirstElement());
EditEventTemplateDialog dlg = new EditEventTemplateDialog(getShell().getShell(), etmpl, false);
if (dlg.open() == Window.OK)
modifyEventObject(etmpl, false);
}
use of org.netxms.client.events.EventGroup in project netxms by netxms.
the class EventObjectList method removeFromGroup.
/**
* Remove event object from group
*/
@SuppressWarnings("unchecked")
protected void removeFromGroup() {
ITreeSelection selection = (ITreeSelection) viewer.getSelection();
List<EventObject> list = selection.toList();
for (int i = 0; i < selection.size(); i++) {
EventGroup parent = (EventGroup) selection.getPathsFor(list.get(i))[0].getParentPath().getLastSegment();
EventObject child = list.get(i);
parent.removeChild(child.getCode());
modifyEventObject(parent, false);
}
}
use of org.netxms.client.events.EventGroup in project netxms by netxms.
the class EventObjectList method enableDropSupport.
/**
* Enable drop support
*/
public void enableDropSupport() {
final Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
viewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE, transfers, new ViewerDropAdapter(viewer) {
@Override
public boolean performDrop(Object data) {
TreeSelection selection = (TreeSelection) data;
List<?> movableSelection = selection.toList();
for (int i = 0; i < movableSelection.size(); i++) {
if (((EventObject) movableSelection.get(i)).getCode() != ((EventGroup) getCurrentTarget()).getCode())
((EventGroup) getCurrentTarget()).addChild(((EventObject) movableSelection.get(i)).getCode());
}
modifyEventObject((EventGroup) getCurrentTarget(), false);
return true;
}
@Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
if ((target == null) || !LocalSelectionTransfer.getTransfer().isSupportedType(transferType))
return false;
IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
if (selection.isEmpty())
return false;
if (!(target instanceof EventGroup))
return false;
return true;
}
});
}
Aggregations