use of org.netxms.ui.eclipse.objectbrowser.dialogs.helpers.ZoneSelectionDialogComparator in project netxms by netxms.
the class ZoneSelectionDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
Composite dialogArea = (Composite) super.createDialogArea(parent);
NXCSession session = (NXCSession) ConsoleSharedData.getSession();
GridLayout layout = new GridLayout();
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
dialogArea.setLayout(layout);
filterText = new FilterText(dialogArea, SWT.NONE, null, false);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
filterText.setLayoutData(gd);
// $NON-NLS-1$
final String filterString = settings.get("SelectZone.Filter");
if (filterString != null)
filterText.setText(filterString);
final String[] names = { "Name" };
final int[] widths = { 200 };
zoneList = new SortableTableViewer(dialogArea, names, widths, 0, SWT.UP, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE | SWT.V_SCROLL);
zoneList.setContentProvider(new ArrayContentProvider());
zoneList.setComparator(new ZoneSelectionDialogComparator());
zoneList.setLabelProvider(new WorkbenchLabelProvider());
filter = new ZoneSelectionDialogFilter();
if (filterString != null)
filter.setFilterString(filterString);
zoneList.addFilter(filter);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
zoneList.getTable().setLayoutData(gd);
zoneList.setInput(session.getAllZones());
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
filter.setFilterString(filterText.getText());
zoneList.refresh();
}
});
zoneList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
ZoneSelectionDialog.this.okPressed();
}
});
filterText.setFocus();
return dialogArea;
}
Aggregations