Search in sources :

Example 6 with EventGroup

use of org.netxms.client.events.EventGroup in project netxms by netxms.

the class EventObjectList method modifyEventObject.

/**
 * Modify event object in server
 *
 * @param obj to modify
 */
protected void modifyEventObject(final EventObject obj, final boolean updateParent) {
    new ConsoleJob(Messages.get().EventConfigurator_UpdateJob_Title, null, Activator.PLUGIN_ID, JOB_FAMILY) {

        @Override
        protected String getErrorMessage() {
            return Messages.get().EventConfigurator_UpdateJob_Error;
        }

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            session.modifyEventObject(obj);
            if (updateParent) {
                runInUIThread(new Runnable() {

                    /* (non-Javadoc)
                   * @see java.lang.Runnable#run()
                   */
                    @Override
                    public void run() {
                        ITreeSelection selection = (ITreeSelection) viewer.getSelection();
                        if (selection.size() == 1 && selection.getFirstElement() instanceof EventGroup) {
                            ((EventGroup) selection.getFirstElement()).addChild(obj.getCode());
                            modifyEventObject((EventGroup) selection.getFirstElement(), false);
                        }
                    }
                });
            }
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) EventGroup(org.netxms.client.events.EventGroup)

Example 7 with EventGroup

use of org.netxms.client.events.EventGroup 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();
    }
}
Also used : EventObject(org.netxms.client.events.EventObject) EventGroup(org.netxms.client.events.EventGroup) EventSelectionDialog(org.netxms.ui.eclipse.eventmanager.dialogs.EventSelectionDialog)

Aggregations

EventGroup (org.netxms.client.events.EventGroup)7 EventObject (org.netxms.client.events.EventObject)4 ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)3 List (java.util.List)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 EditEventGroupDialog (org.netxms.ui.eclipse.eventmanager.dialogs.EditEventGroupDialog)2 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)2 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 ViewerDropAdapter (org.eclipse.jface.viewers.ViewerDropAdapter)1 Transfer (org.eclipse.swt.dnd.Transfer)1 TransferData (org.eclipse.swt.dnd.TransferData)1 EventTemplate (org.netxms.client.events.EventTemplate)1 EditEventTemplateDialog (org.netxms.ui.eclipse.eventmanager.dialogs.EditEventTemplateDialog)1 EventSelectionDialog (org.netxms.ui.eclipse.eventmanager.dialogs.EventSelectionDialog)1