use of org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListLabelProvider in project netxms by netxms.
the class TunnelManager method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new FormLayout());
// Create filter area
filterText = new FilterText(parent, SWT.NONE, null, true);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
filterText.setCloseAction(new Action() {
@Override
public void run() {
enableFilter(false);
actionShowFilter.setChecked(false);
}
});
final String[] names = { "ID", "State", "Node", "IP address", "Channels", "System name", "Hostname", "Platform", "System information", "Agent version" };
final int[] widths = { 80, 80, 140, 150, 80, 150, 150, 250, 300, 150 };
viewer = new SortableTableViewer(parent, names, widths, 0, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new TunnelListLabelProvider());
viewer.setComparator(new TunnelListComparator());
filter = new TunnelManagerFilter();
viewer.addFilter(filter);
final IDialogSettings settings = Activator.getDefault().getDialogSettings();
initShowfilter = settings.getBoolean(ID + "initShowFilter");
WidgetHelper.restoreTableViewerSettings(viewer, settings, "TunnelManager");
viewer.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
WidgetHelper.saveTableViewerSettings(viewer, settings, "TunnelManager");
settings.put(ID + "initShowFilter", initShowfilter);
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(filterText);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
viewer.getControl().setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterText.setLayoutData(fd);
createActions();
contributeToActionBars();
createPopupMenu();
activateContext();
// Set initial focus to filter input line
if (initShowfilter)
filterText.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
refresh();
}
Aggregations