use of org.netxms.ui.eclipse.snmp.dialogs.MibSelectionDialog in project netxms by netxms.
the class EditColumnDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
name = new LabeledText(dialogArea, SWT.NONE);
name.setLabel(Messages.get().EditColumnDialog_Name);
name.setText(columnObject.getName());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 350;
name.setLayoutData(gd);
format = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditColumnDialog_Format, WidgetHelper.DEFAULT_LAYOUT_DATA);
for (int i = 0; i < formatNames.length; i++) format.add(formatNames[i]);
format.select(columnObject.getFormat());
Composite dataGroup = null;
if (snmpColumn) {
dataGroup = new Composite(dialogArea, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
layout.numColumns = 2;
dataGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
dataGroup.setLayoutData(gd);
}
data = new LabeledText(snmpColumn ? dataGroup : dialogArea, SWT.NONE);
if (snmpColumn) {
data.setLabel(Messages.get().EditColumnDialog_SNMP_OID);
data.setText(columnObject.getSnmpOid());
} else {
data.setLabel(Messages.get().EditColumnDialog_SubstrIndex);
data.setText(Integer.toString(columnObject.getSubstringIndex()));
}
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 350;
data.setLayoutData(gd);
if (snmpColumn) {
selectButton = new Button(dataGroup, SWT.PUSH);
// $NON-NLS-1$
selectButton.setText("...");
gd = new GridData();
gd.verticalAlignment = SWT.BOTTOM;
selectButton.setLayoutData(gd);
selectButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
SnmpObjectId initial;
try {
initial = SnmpObjectId.parseSnmpObjectId(data.getText());
} catch (SnmpObjectIdFormatException ex) {
initial = null;
}
MibSelectionDialog dlg = new MibSelectionDialog(getShell(), initial, 0);
if (dlg.open() == Window.OK) {
data.setText(dlg.getSelectedObjectId().toString());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
}
return dialogArea;
}
Aggregations