Search in sources :

Example 1 with SnmpTrapParameterMapping

use of org.netxms.client.snmp.SnmpTrapParameterMapping in project netxms by netxms.

the class TrapConfigurationDialog method editParameter.

/**
 * Edit currently selected parameter mapping
 */
private void editParameter() {
    IStructuredSelection selection = (IStructuredSelection) paramList.getSelection();
    if (selection.size() != 1)
        return;
    SnmpTrapParameterMapping pm = (SnmpTrapParameterMapping) selection.getFirstElement();
    ParamMappingEditDialog dlg = new ParamMappingEditDialog(getShell(), pm);
    if (dlg.open() == Window.OK) {
        paramList.update(pm, null);
    }
}
Also used : SnmpTrapParameterMapping(org.netxms.client.snmp.SnmpTrapParameterMapping) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 2 with SnmpTrapParameterMapping

use of org.netxms.client.snmp.SnmpTrapParameterMapping in project netxms by netxms.

the class TrapConfigurationDialog method deleteParameters.

/**
 * Delete selected parameters
 */
@SuppressWarnings("unchecked")
private void deleteParameters() {
    IStructuredSelection selection = (IStructuredSelection) paramList.getSelection();
    if (selection.isEmpty())
        return;
    Iterator<SnmpTrapParameterMapping> it = selection.iterator();
    while (it.hasNext()) pmap.remove(it.next());
    paramList.setInput(pmap.toArray());
}
Also used : SnmpTrapParameterMapping(org.netxms.client.snmp.SnmpTrapParameterMapping) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 3 with SnmpTrapParameterMapping

use of org.netxms.client.snmp.SnmpTrapParameterMapping in project netxms by netxms.

the class TrapConfigurationDialog method addParameter.

/**
 * Add new parameter mapping
 */
private void addParameter() {
    SnmpTrapParameterMapping pm = new SnmpTrapParameterMapping(new SnmpObjectId());
    ParamMappingEditDialog dlg = new ParamMappingEditDialog(getShell(), pm);
    if (dlg.open() == Window.OK) {
        pmap.add(pm);
        paramList.setInput(pmap.toArray());
        paramList.setSelection(new StructuredSelection(pm));
    }
}
Also used : SnmpTrapParameterMapping(org.netxms.client.snmp.SnmpTrapParameterMapping) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId)

Example 4 with SnmpTrapParameterMapping

use of org.netxms.client.snmp.SnmpTrapParameterMapping in project netxms by netxms.

the class TrapConfigurationDialog method setupParameterList.

/**
 * Setup parameter mapping list
 */
private void setupParameterList() {
    Table table = paramList.getTable();
    table.setHeaderVisible(true);
    TableColumn tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.get().TrapConfigurationDialog_Number);
    tc.setWidth(90);
    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.get().TrapConfigurationDialog_Parameter);
    tc.setWidth(200);
    pmap = new ArrayList<SnmpTrapParameterMapping>(trap.getParameterMapping());
    paramList.setContentProvider(new ArrayContentProvider());
    paramList.setLabelProvider(new ParamMappingLabelProvider(pmap));
    paramList.setInput(pmap.toArray());
    WidgetHelper.restoreColumnSettings(table, Activator.getDefault().getDialogSettings(), PARAMLIST_TABLE_SETTINGS);
    paramList.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            editParameter();
        }
    });
}
Also used : SnmpTrapParameterMapping(org.netxms.client.snmp.SnmpTrapParameterMapping) Table(org.eclipse.swt.widgets.Table) ParamMappingLabelProvider(org.netxms.ui.eclipse.snmp.dialogs.helpers.ParamMappingLabelProvider) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) TableColumn(org.eclipse.swt.widgets.TableColumn)

Aggregations

SnmpTrapParameterMapping (org.netxms.client.snmp.SnmpTrapParameterMapping)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 SnmpObjectId (org.netxms.client.snmp.SnmpObjectId)1 ParamMappingLabelProvider (org.netxms.ui.eclipse.snmp.dialogs.helpers.ParamMappingLabelProvider)1