use of org.netxms.ui.eclipse.filemanager.dialogs.helpers.ServerFileComparator in project netxms by netxms.
the class SelectServerFileDialog 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.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
dialogArea.setLayout(layout);
final String[] names = { Messages.get().SelectServerFileDialog_ColName, Messages.get().SelectServerFileDialog_ColSize, Messages.get().SelectServerFileDialog_ColModTime };
final int[] widths = { 200, 100, 150 };
viewer = new SortableTableViewer(dialogArea, names, widths, 0, SWT.DOWN, SWT.FULL_SELECTION | SWT.BORDER | (multiSelect ? SWT.MULTI : 0));
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ServerFileLabelProvider());
viewer.setComparator(new ServerFileComparator());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 450;
viewer.getControl().setLayoutData(gd);
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().SelectServerFileDialog_JobTitle, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final ServerFile[] files = session.listServerFiles();
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(files);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().SelectServerFileDialog_JobError;
}
}.start();
return dialogArea;
}
Aggregations