@Override public void execute() { List<Project> selectedProjects = ProjectListBox.getProjectListBox().getProjectList().getSelectedProjects(); if (selectedProjects.size() == 1) { exportProject(selectedProjects.get(0)); } else { // The user needs to select only one project. ErrorReporter.reportInfo(MESSAGES.wrongNumberProjectsSelected()); } }
/** * Enables and/or disables buttons based on how many projects exist (in the case of "Download All * Projects") or are selected (in the case of "Delete" and "Download Source"). */ public void updateButtons() { ProjectList projectList = ProjectListBox.getProjectListBox().getProjectList(); int numProjects = projectList.getNumProjects(); int numSelectedProjects = projectList.getNumSelectedProjects(); setButtonEnabled(WIDGET_NAME_DOWNLOAD_ALL, numProjects > 0); setButtonEnabled(WIDGET_NAME_DELETE, numSelectedProjects > 0); setDropItemEnabled( WIDGET_NAME_MORE_ACTIONS, WIDGET_NAME_DOWNLOAD_SOURCE, numSelectedProjects == 1); }
@Override public void execute() { List<Project> selectedProjects = ProjectListBox.getProjectListBox().getProjectList().getSelectedProjects(); if (selectedProjects.size() > 0) { // Show one confirmation window for selected projects. if (deleteConfirmation(selectedProjects)) { for (Project project : selectedProjects) { deleteProject(project); } } } else { // The user can select a project to resolve the // error. ErrorReporter.reportInfo(MESSAGES.noProjectSelectedForDelete()); } }
/** * Enables and/or disables buttons based on how many projects exist (in the case of "Download All * Projects") or are selected (in the case of "Delete" and "Download Source"). */ public void updateButtons() { ProjectList projectList = ProjectListBox.getProjectListBox().getProjectList(); int numProjects = projectList.getNumProjects(); int numSelectedProjects = projectList.getNumSelectedProjects(); setButtonEnabled(WIDGET_NAME_DELETE, numSelectedProjects > 0); Ode.getInstance() .getTopToolbar() .fileDropDown .setItemEnabled(MESSAGES.deleteProjectMenuItem(), numSelectedProjects > 0); Ode.getInstance() .getTopToolbar() .fileDropDown .setItemEnabled(MESSAGES.exportProjectMenuItem(), numSelectedProjects > 0); Ode.getInstance() .getTopToolbar() .fileDropDown .setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), numSelectedProjects > 0); }