Source:
public PullPanel(TransferPanelForm view, TransferForms forms, BriefcasePreferences tabPreferences, BriefcasePreferences appPreferences, TerminationFuture terminationFuture, Analytics analytics) { AnnotationProcessor.process(this); this.view = view; this.forms = forms; this.tabPreferences = tabPreferences; this.appPreferences = appPreferences; this.terminationFuture = terminationFuture; this.analytics = analytics; getContainer().addComponentListener(analytics.buildComponentListener("Pull")); source = RemoteServer.readPreferences(tabPreferences).flatMap(view::preloadSource); source.ifPresent(source -> { try { forms.load(source.getFormList()); view.refresh(); updateActionButtons(); } catch (Exception e) { System.err.println(e.toString()); } }); view.onSource(source -> { this.source = Optional.of(source); Source.clearAllPreferences(tabPreferences); source.storePreferences(tabPreferences, getStorePasswordsConsentProperty()); forms.load(source.getFormList()); view.refresh(); updateActionButtons(); }); view.onReset(() -> { forms.clear(); view.refresh(); source = Optional.empty(); Source.clearAllPreferences(tabPreferences); updateActionButtons(); }); view.onChange(this::updateActionButtons); view.onAction(() -> { view.setWorking(); forms.forEach(FormStatus::clearStatusHistory); source.ifPresent(s -> s.pull(forms.getSelectedForms(), terminationFuture, appPreferences.getBriefcaseDir().orElseThrow(BriefcaseException::new), appPreferences.getPullInParallel().orElse(false))); }); view.onCancel(() -> terminationFuture.markAsCancelled(new PullEvent.Abort("Cancelled by the user"))); }

Target:
public PullPanel(TransferPanelForm view, TransferForms forms, BriefcasePreferences tabPreferences, BriefcasePreferences appPreferences, TerminationFuture terminationFuture, Analytics analytics) { AnnotationProcessor.process(this); this.view = view; this.forms = forms; this.tabPreferences = tabPreferences; this.appPreferences = appPreferences; this.terminationFuture = terminationFuture; this.analytics = analytics; getContainer().addComponentListener(analytics.buildComponentListener("Pull")); source = RemoteServer.readPreferences(tabPreferences).flatMap(view::preloadSource); source.ifPresent(source -> { try { forms.load(source.getFormList()); view.refresh(); updateActionButtons(); } catch (HttpException e) { log.warn("Unable to get form list from {}: {}", source.getDescription(), e.toString()); } }); view.onSource(source -> { this.source = Optional.of(source); Source.clearAllPreferences(tabPreferences); source.storePreferences(tabPreferences, getStorePasswordsConsentProperty()); forms.load(source.getFormList()); view.refresh(); updateActionButtons(); }); view.onReset(() -> { forms.clear(); view.refresh(); source = Optional.empty(); Source.clearAllPreferences(tabPreferences); updateActionButtons(); }); view.onChange(this::updateActionButtons); view.onAction(() -> { view.setWorking(); forms.forEach(FormStatus::clearStatusHistory); source.ifPresent(s -> s.pull(forms.getSelectedForms(), terminationFuture, appPreferences.getBriefcaseDir().orElseThrow(BriefcaseException::new), appPreferences.getPullInParallel().orElse(false))); }); view.onCancel(() -> terminationFuture.markAsCancelled(new PullEvent.Abort("Cancelled by the user"))); }