Exemplo n.º 1
0
 public CommentDialog(Shell shell, IComment comment, Object c) {
   super(shell);
   setShellStyle(SWT.BORDER | SWT.CLOSE | SWT.TITLE);
   CommentCallerHandler ch = getHandler();
   if (comment == null && ch != null) {
     this.m_comment = ch.createComment();
     String parsed =
         Formatter.getInstance(getRuntime())
             .parse(getCommentPrefix(), (c == null ? m_comment.getDate() : c));
     this.m_comment.setText(parsed + IJAMConst.CRLF);
   } else {
     this.m_comment = comment;
   }
 }
  private void prepareDialog(Composite c, Shell s) {
    this.validConfiguration();
    ContentMatrix m = null;
    if (this.isCliredCaller()) {
      m = new ContentMatrix(getDialogContentCLIR());
    } else {
      m = new ContentMatrix(getDialogContent());
    }

    String[][] matrix = m.getMatrix();
    this.m_columnCount = m.getColCount(matrix);
    c.setLayout(new GridLayout(this.m_columnCount, false));
    int rowCount = m.getRowCount(matrix);
    int colCount = m.getColCount(matrix);
    for (int i = 0; i < rowCount; i++) {
      for (int j = 0; j < colCount; j++) {
        String element = (matrix[i][j].trim().length() > 0 ? matrix[i][j] : null);
        Image img = null;
        if (element != null) {
          ITableCellRenderer tcr = getRenderer(element);
          if (tcr != null) {
            tcr.updateData(this.getCall());
            img = tcr.renderAsImage();
            if (img == null) element = tcr.renderAsText();
          } else {
            element = Formatter.getInstance(this.getRuntime()).parse(element, this.getCall());
          }
          if (element.equalsIgnoreCase(matrix[i][j])) element = "";
        }

        createLabel(
            c,
            m.getRowSpan(j, i, matrix),
            element,
            img,
            getLabelAttributes(
                getElementID((matrix[i][j].trim().length() > 0 ? matrix[i][j] : null))));
      }
    }
  }