use of org.netxms.ui.eclipse.serverjobmanager.views.helpers.ServerJobComparator in project netxms by netxms.
the class ServerJobManager method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
final String[] names = { Messages.get().ServerJobManager_ColStatus, Messages.get().ServerJobManager_ColInitiator, Messages.get().ServerJobManager_ColNode, Messages.get().ServerJobManager_ColDescription, Messages.get().ServerJobManager_ColProgress, Messages.get().ServerJobManager_ColMessage };
final int[] widths = { 80, 100, 150, 250, 100, 300 };
viewer = new SortableTableViewer(parent, names, widths, 0, SWT.DOWN, SortableTableViewer.DEFAULT_STYLE);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ServerJobLabelProvider());
viewer.setComparator(new ServerJobComparator());
WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
createActions();
contributeToActionBars();
createPopupMenu();
session = (NXCSession) ConsoleSharedData.getSession();
viewer.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
}
});
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null) {
actionCancelJob.setEnabled(selection.size() > 0);
actionHoldJob.setEnabled(selection.size() > 0);
actionUnholdJob.setEnabled(selection.size() > 0);
}
}
});
// Create listener for notifications received from server via client library
clientListener = new SessionListener() {
@Override
public void notificationHandler(SessionNotification n) {
if (n.getCode() != SessionNotification.JOB_CHANGE)
return;
refreshJobList(false);
}
};
session.addListener(clientListener);
refreshJobList(false);
}
Aggregations