Search in sources :

Example 1 with SelectAgentParamDlg

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg in project netxms by netxms.

the class GeneralTable method selectParameter.

/**
 * Select parameter
 */
private void selectParameter() {
    Dialog dlg;
    editor.setSourceNode(sourceNode.getObjectId());
    switch(origin.getSelectionIndex()) {
        case DataCollectionObject.AGENT:
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectAgentParamDlg(getShell(), sourceNode.getObjectId(), origin.getSelectionIndex(), true);
            else
                dlg = new SelectAgentParamDlg(getShell(), dci.getNodeId(), origin.getSelectionIndex(), true);
            break;
        case DataCollectionObject.SNMP:
        case DataCollectionObject.CHECKPOINT_SNMP:
            SnmpObjectId oid;
            try {
                oid = SnmpObjectId.parseSnmpObjectId(parameter.getText());
            } catch (SnmpObjectIdFormatException e) {
                oid = null;
            }
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectSnmpParamDlg(getShell(), oid, sourceNode.getObjectId());
            else
                dlg = new SelectSnmpParamDlg(getShell(), oid, dci.getNodeId());
            break;
        case DataCollectionItem.SCRIPT:
            dlg = new SelectParameterScriptDialog(getShell());
            break;
        default:
            dlg = null;
            break;
    }
    if ((dlg != null) && (dlg.open() == Window.OK)) {
        IParameterSelectionDialog pd = (IParameterSelectionDialog) dlg;
        description.setText(pd.getParameterDescription());
        parameter.setText(pd.getParameterName());
        editor.fireOnSelectTableListeners(origin.getSelectionIndex(), pd.getParameterName(), pd.getParameterDescription());
    }
}
Also used : SelectSnmpParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectSnmpParamDlg) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) DCIPropertyPageDialog(org.netxms.ui.eclipse.datacollection.propertypages.helpers.DCIPropertyPageDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog) Dialog(org.eclipse.jface.dialogs.Dialog) SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SelectAgentParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog)

Example 2 with SelectAgentParamDlg

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg in project netxms by netxms.

the class General method selectParameter.

/**
 * Select parameter
 */
private void selectParameter() {
    Dialog dlg;
    switch(origin.getSelectionIndex()) {
        case DataCollectionItem.INTERNAL:
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectInternalParamDlg(getShell(), sourceNode.getObjectId());
            else
                dlg = new SelectInternalParamDlg(getShell(), dci.getNodeId());
            break;
        case DataCollectionItem.AGENT:
        case DataCollectionItem.DEVICE_DRIVER:
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectAgentParamDlg(getShell(), sourceNode.getObjectId(), origin.getSelectionIndex(), false);
            else
                dlg = new SelectAgentParamDlg(getShell(), dci.getNodeId(), origin.getSelectionIndex(), false);
            break;
        case DataCollectionItem.SNMP:
        case DataCollectionItem.CHECKPOINT_SNMP:
            SnmpObjectId oid;
            try {
                oid = SnmpObjectId.parseSnmpObjectId(parameter.getText());
            } catch (SnmpObjectIdFormatException e) {
                oid = null;
            }
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectSnmpParamDlg(getShell(), oid, sourceNode.getObjectId());
            else
                dlg = new SelectSnmpParamDlg(getShell(), oid, dci.getNodeId());
            break;
        case DataCollectionItem.WINPERF:
            if (sourceNode.getObjectId() != 0)
                dlg = new WinPerfCounterSelectionDialog(getShell(), sourceNode.getObjectId());
            else
                dlg = new WinPerfCounterSelectionDialog(getShell(), dci.getNodeId());
            break;
        case DataCollectionItem.SCRIPT:
            dlg = new SelectParameterScriptDialog(getShell());
            break;
        default:
            dlg = null;
            break;
    }
    if ((dlg != null) && (dlg.open() == Window.OK)) {
        IParameterSelectionDialog pd = (IParameterSelectionDialog) dlg;
        description.setText(pd.getParameterDescription());
        parameter.setText(pd.getParameterName());
        dataType.select(getDataTypePosition(pd.getParameterDataType()));
        editor.fireOnSelectItemListeners(origin.getSelectionIndex(), pd.getParameterName(), pd.getParameterDescription(), pd.getParameterDataType());
    }
}
Also used : SelectSnmpParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectSnmpParamDlg) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) DCIPropertyPageDialog(org.netxms.ui.eclipse.datacollection.propertypages.helpers.DCIPropertyPageDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog) WinPerfCounterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.WinPerfCounterSelectionDialog) Dialog(org.eclipse.jface.dialogs.Dialog) SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SelectAgentParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog) WinPerfCounterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.WinPerfCounterSelectionDialog) SelectInternalParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectInternalParamDlg)

Aggregations

Dialog (org.eclipse.jface.dialogs.Dialog)2 SnmpObjectId (org.netxms.client.snmp.SnmpObjectId)2 SnmpObjectIdFormatException (org.netxms.client.snmp.SnmpObjectIdFormatException)2 IParameterSelectionDialog (org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog)2 SelectAgentParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg)2 SelectParameterScriptDialog (org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog)2 SelectSnmpParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectSnmpParamDlg)2 DCIPropertyPageDialog (org.netxms.ui.eclipse.datacollection.propertypages.helpers.DCIPropertyPageDialog)2 SelectInternalParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectInternalParamDlg)1 WinPerfCounterSelectionDialog (org.netxms.ui.eclipse.datacollection.dialogs.WinPerfCounterSelectionDialog)1