Search in sources :

Example 1 with ScheduleTableEntryComparator

use of org.netxms.ui.eclipse.serverconfig.views.helpers.ScheduleTableEntryComparator in project netxms by netxms.

the class ScheduledTaskView method createPartControl.

/* (non-Javadoc)
    * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createPartControl(Composite parent) {
    final int[] widths = { 50, 100, 200, 400, 150, 150, 100, 200, 250, 200 };
    final String[] names = { "Id", "Schedule Type", "Object", "Parameters", "Execution time", "Last execution time", "Execution status", "Administrative status", "Owner", "Comments" };
    viewer = new SortableTableViewer(parent, names, widths, SCHEDULE_ID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new ScheduleTableEntryLabelProvider());
    viewer.setComparator(new ScheduleTableEntryComparator());
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            actionEdit.run();
        }
    });
    WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "ScheduledTasks");
    viewer.getControl().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "ScheduledTasks");
        }
    });
    activateContext();
    createActions();
    contributeToActionBars();
    createPopupMenu();
    refresh();
    final Display display = getSite().getShell().getDisplay();
    listener = new SessionListener() {

        @Override
        public void notificationHandler(SessionNotification n) {
            if (n.getCode() == SessionNotification.SCHEDULE_UPDATE) {
                display.asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        refresh();
                    }
                });
            }
        }
    };
    session.addListener(listener);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ScheduleTableEntryComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.ScheduleTableEntryComparator) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ScheduleTableEntryLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.ScheduleTableEntryLabelProvider) SessionListener(org.netxms.client.SessionListener) SessionNotification(org.netxms.client.SessionNotification) Display(org.eclipse.swt.widgets.Display)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 Display (org.eclipse.swt.widgets.Display)1 SessionListener (org.netxms.client.SessionListener)1 SessionNotification (org.netxms.client.SessionNotification)1 ScheduleTableEntryComparator (org.netxms.ui.eclipse.serverconfig.views.helpers.ScheduleTableEntryComparator)1 ScheduleTableEntryLabelProvider (org.netxms.ui.eclipse.serverconfig.views.helpers.ScheduleTableEntryLabelProvider)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1