Пример #1
0
  /**
   * Must be called after createProjectDropDownMenu, since we need to figure out the selected
   * project.
   *
   * @author stolz
   */
  protected void createProductDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Product", 1, 1, GridData.FILL_HORIZONTAL);

    productDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    productDropDown.setLayoutData(gridData);

    productDropDown.addListener(SWT.Selection, myListener);
  }
Пример #2
0
 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);
 }
Пример #3
0
 protected IProject getSelectedProject() {
   final int idx = projectDropDown.getSelectionIndex();
   if (idx == -1) return null;
   String projN = getProjectNames().get(idx);
   IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projN);
   return proj;
 }
Пример #4
0
  protected void createProjectDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Project", 1, 1, GridData.FILL_HORIZONTAL);

    projectDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    projectDropDown.setLayoutData(gridData);

    projectDropDown.addListener(SWT.Selection, myListener);
    /* Refresh products everytime the project is changed */
    projectDropDown.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            fillProductDropDownMenue(null);
            updateErrors();
          }
        });
  }
Пример #5
0
 /**
  * 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);
 }
Пример #6
0
 /** @return the product name, or null if the base product is selected. */
 protected String getSelectedProductName() {
   final int index = productDropDown.getSelectionIndex();
   if (index <= 0) /* base is at index 0 */ return null;
   return productDropDown.getItem(index);
 }
Пример #7
0
 protected String getSelectedProjectName() {
   return projectDropDown.getItem(projectDropDown.getSelectionIndex());
 }