@Nullable private SourceEstimation getSourceEstimation() { if (estimatedTypes == null || estimatedTypes.isEmpty()) { return null; } if (estimatedTypes.size() == 1) { return estimatedTypes.get(0); } return estimatedTypes.get(view.getSelectedTypeIndex()); }
/** * Displays new dialog. * * @param sourceEstimationList the list of estimated project types for display in popup window * @param callback the callback that call after user interact */ public void showDialog( @Nullable List<SourceEstimation> sourceEstimationList, @NotNull ProjectProblemDialogCallback callback) { this.callback = callback; if (sourceEstimationList == null || sourceEstimationList.isEmpty()) { estimatedTypes = null; view.showDialog(null); return; } estimatedTypes = new ArrayList<>(sourceEstimationList.size()); List<String> estimatedTypeNames = new ArrayList<>(sourceEstimationList.size()); for (SourceEstimation estimatedType : sourceEstimationList) { ProjectTypeDefinition projectType = projectTypeRegistry.getProjectType(estimatedType.getType()); if (estimatedType.isPrimaryable() && projectType != null) { this.estimatedTypes.add(estimatedType); estimatedTypeNames.add(projectType.getDisplayName()); } } view.showDialog(estimatedTypeNames); }
@Override public void onEnterClicked() { view.hide(); callback.onConfigure(getSourceEstimation()); }
@Override public void onOpenAs() { view.hide(); callback.onOpenAs(getSourceEstimation()); }
@Override public void onOpenAsIs() { view.hide(); callback.onOpenAsIs(); }
@Override public void onSelectedTypeChanged(String projectType) { view.setOpenAsButtonTitle(localizedConstant.projectProblemOpenAsButtonTitle(projectType)); view.setMessage(localizedConstant.projectProblemPressingButtonsMessage(projectType)); }