コード例 #1
0
  /**
   * Action is enabled when only items of the same type are selected.
   *
   * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
   *     org.eclipse.jface.viewers.ISelection)
   */
  public void selectionChanged(IWorkbenchPart part, ISelection input) {
    if (input instanceof IStructuredSelection) {
      IStructuredSelection selection = (IStructuredSelection) input;

      if (selection.size() < 2) {
        setEnabled(false);
        return;
      }

      String kapitel = null;
      for (Iterator iter = selection.iterator(); iter.hasNext(); ) {
        Object o = iter.next();
        if (o instanceof BausteinUmsetzung) {
          BausteinUmsetzung bst = (BausteinUmsetzung) o;
          if (kapitel == null) {
            kapitel = bst.getKapitel();
          } else {
            if (!bst.getKapitel().equals(kapitel)) {
              setEnabled(false);
              return;
            }
          }
        } else {
          setEnabled(false);
          return;
        }
      }
      if (checkRights()) {
        setEnabled(true);
      }
      return;
    }
    // no structured selection:
    setEnabled(false);
  }
コード例 #2
0
  public List<IOOTableRow> getReport(PropertySelection shownColumns) {
    ArrayList<IOOTableRow> rows = new ArrayList<IOOTableRow>();

    AllCategories:
    for (CnATreeElement category : categories) {
      ArrayList<IOOTableRow> categoryRows = new ArrayList<IOOTableRow>();

      AllItems:
      for (CnATreeElement child : getItems(category)) {

        if (child instanceof BausteinUmsetzung) {
          List<String> columns = shownColumns.get(child.getEntity().getEntityType());
          BausteinUmsetzung bst = (BausteinUmsetzung) child;

          categoryRows.add(new PropertiesRow(child, columns, IOOTableRow.ROW_STYLE_SUBHEADER));
          categoryRows.add(
              new SimpleRow(
                  IOOTableRow.ROW_STYLE_SUBHEADER,
                  "Erreichte Siegelstufe: " + Character.toString(bst.getErreichteSiegelStufe())));
          addMassnahmen(shownColumns, categoryRows, bst);
        }
        // else: ignore item
      }

      // only add if header + items present:
      if (categoryRows.size() > 1) {
        rows.add(new SimpleRow(IOOTableRow.ROW_STYLE_HEADER, category.getTitle()));
        rows.addAll(categoryRows);
      }
    }
    return rows;
  }
コード例 #3
0
  private void addMassnahmen(
      PropertySelection shownColumns, List<IOOTableRow> categoryRows, BausteinUmsetzung baustein) {
    if (!baustein.getChildren().iterator().hasNext()) {
      return;
    }
    MassnahmenUmsetzung massnahme = (MassnahmenUmsetzung) baustein.getChildren().iterator().next();
    List<String> columns = shownColumns.get(massnahme.getEntity().getEntityType());
    if (columns.size() == 0) {
      return;
    }
    categoryRows.add(new PropertyHeadersRow(massnahme, columns, IOOTableRow.ROW_STYLE_ELEMENT));

    for (CnATreeElement child : baustein.getChildren()) {
      massnahme = (MassnahmenUmsetzung) child;

      if (!(umgesetzt.indexOf(massnahme.getUmsetzung()) > -1)) {
        categoryRows.add(new PropertiesRow(massnahme, columns, IOOTableRow.ROW_STYLE_ELEMENT));
      }
    }
  }
コード例 #4
0
 /** @param baustein */
 private void initParent(/* not final */ BausteinUmsetzung baustein) {
   CnATreeElement withParent = Retriever.checkRetrieveParent(baustein);
   CnATreeElement parent = Retriever.checkRetrieveElement(withParent.getParent());
   baustein.setParent(parent);
 }