Search in sources :

Example 1 with SynchronizerService

use of de.janrufmonitor.service.fritzbox.SynchronizerService in project janrufmonitor by tbrandt77.

the class Refresh method run.

public void run() {
    ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayManager.getDefaultDisplay().getActiveShell());
    try {
        IRunnableWithProgress r = new IRunnableWithProgress() {

            public void run(IProgressMonitor progressMonitor) {
                IService srv = getRuntime().getServiceFactory().getService(SynchronizerService.ID);
                if (srv != null && srv instanceof SynchronizerService && srv.isEnabled()) {
                    ((SynchronizerService) srv).synchronize(progressMonitor);
                }
            }
        };
        pmd.setBlockOnOpen(false);
        pmd.run(true, false, r);
    // ModalContext.run(r, true, pmd.getProgressMonitor(), DisplayManager.getDefaultDisplay());
    } catch (InterruptedException e) {
        m_logger.log(Level.SEVERE, e.getMessage(), e);
    } catch (InvocationTargetException e) {
        m_logger.log(Level.SEVERE, e.getMessage(), e);
    }
    m_app.updateViews(true);
    return;
}
Also used : SynchronizerService(de.janrufmonitor.service.fritzbox.SynchronizerService) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) IService(de.janrufmonitor.service.IService) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

IService (de.janrufmonitor.service.IService)1 SynchronizerService (de.janrufmonitor.service.fritzbox.SynchronizerService)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1