use of name.abuchen.portfolio.ui.update.UpdateHelper in project portfolio by buchen.
the class StartupAddon method checkForUpdates.
@Inject
@Optional
public // NOSONAR
void checkForUpdates(// NOSONAR
@UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event, final IWorkbench workbench, final EPartService partService, @Preference(value = UIConstants.Preferences.AUTO_UPDATE) boolean autoUpdate) {
if (autoUpdate) {
Job job = new Job(Messages.JobMsgCheckingForUpdates) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask(Messages.JobMsgCheckingForUpdates, 200);
UpdateHelper updateHelper = new UpdateHelper(workbench, partService);
updateHelper.runUpdate(monitor, true);
} catch (// NOSONAR
CoreException e) {
PortfolioPlugin.log(e.getStatus());
}
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule(500);
}
}
use of name.abuchen.portfolio.ui.update.UpdateHelper in project portfolio by buchen.
the class UpdateHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, final IWorkbench workbench, final EPartService partService) {
try {
new ProgressMonitorDialog(shell).run(true, true, monitor -> {
try // NOSONAR
{
UpdateHelper updateHelper = new UpdateHelper(workbench, partService);
updateHelper.runUpdate(monitor, false);
} catch (CoreException e) {
PortfolioPlugin.log(e);
Display.getDefault().asyncExec(() -> ErrorDialog.openError(Display.getDefault().getActiveShell(), Messages.LabelError, Messages.MsgErrorUpdating, e.getStatus()));
}
});
} catch (InvocationTargetException | InterruptedException e) {
PortfolioPlugin.log(e);
}
}
Aggregations