protected void fillProjectDropDownMenue(String name) { List<String> projectNames = getProjectNames(); int selectedProjectName = 0; projectDropDown.removeAll(); for (int i = 0; i < projectNames.size(); i++) { String projectName = projectNames.get(i); if (projectName.equals(name)) { selectedProjectName = i; } projectDropDown.add(projectName); } projectDropDown.select(selectedProjectName); }
/** * Lists all products in the current project's module, incl. a "<base>" product if no particular * product is selected. * * @param preSelected The product that should be preselected, or null for <base>. */ protected void fillProductDropDownMenue(String preSelected) { productDropDown.removeAll(); productDropDown.add("<base>"); IProject proj = getSelectedProject(); if (proj == null) { return; } AbsNature n = UtilityFunctions.getAbsNature(proj); Model m = n.getCompleteModel(); if (m == null) return; Collection<Product> prods = m.getProducts(); if (prods == null) return; int i = 1; /* base comes first */ int selected = 0; for (Product p : prods) { final String name = p.qualifiedName(); productDropDown.add(name); if (name.equals(preSelected)) { selected = i; } i++; } productDropDown.select(selected); }