/** Updates the form title. Sub-classes can extend if needed. */
 protected void updateFormTitle() {
   if (null != displayedCmrRepositoryDefinition) {
     mainForm.setImage(
         ImageFormatter.getCmrRepositoryImage(displayedCmrRepositoryDefinition, true));
     mainForm.setText(displayedCmrRepositoryDefinition.getName());
     mainForm.setToolTipText(
         TextFormatter.getCmrRepositoryDescription(displayedCmrRepositoryDefinition));
     mainForm.setMessage(null);
   } else {
     mainForm.setImage(null);
     mainForm.setText("No repository exists");
     mainForm.setMessage(
         "Repositories can be added from the Repository Manager", IMessageProvider.WARNING);
     mainForm.setToolTipText(null);
   }
 }
예제 #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.topcased.doc2model.requirement.ui.NotifyElement#handleModelChange()
  */
 public void handleModelChange() {
   regexInput = componentHelpTextField.getInput();
   if (!"".equals(regexInput)) // $NON-NLS-1$
   {
     try {
       Pattern.compile(regexInput, Pattern.MULTILINE);
       form.setMessage(null, IMessageProvider.NONE);
       this.getButton(IDialogConstants.OK_ID).setEnabled(true);
     } catch (PatternSyntaxException e) {
       form.setMessage("Regex doesn't compile", IMessageProvider.ERROR); // $NON-NLS-1$
       this.getButton(IDialogConstants.OK_ID).setEnabled(false);
     }
   } else {
     form.setMessage(null, IMessageProvider.NONE);
     this.getButton(IDialogConstants.OK_ID).setEnabled(true);
   }
 }
예제 #3
0
  /** @since 2.3 */
  public void setMessage(String message, int type, IHyperlinkListener listener) {
    if (isHeaderFormDisposed()) {
      return;
    }

    try {
      // avoid flicker of the left header toolbar
      getHeaderForm().getForm().setRedraw(false);

      Form form = getHeaderForm().getForm().getForm();
      if (message != null) {
        message = message.replace('\n', ' ');
      }
      form.setMessage(message, type, null);
      if (messageHyperLinkListener != null) {
        form.removeMessageHyperlinkListener(messageHyperLinkListener);
        if (messageHyperLinkListener instanceof IDisposable) {
          ((IDisposable) messageHyperLinkListener).dispose();
        }
      }
      if (listener != null) {
        form.addMessageHyperlinkListener(listener);
      }
      messageHyperLinkListener = listener;

      // make sure the busyLabel image is large enough to accommodate the tool bar
      if (hasLeftToolBar()) {
        BusyIndicator busyLabel = getBusyLabel();
        if (message != null && busyLabel != null) {
          setHeaderImage(busyLabel.getImage());
        } else {
          setHeaderImage(null);
        }
      }
    } finally {
      getHeaderForm().getForm().setRedraw(true);
    }
  }
예제 #4
0
  @Override
  protected void okPressed() {

    if (currentWorkType == null) {
      parentForm.setMessage("Wählen Sie eine Tätigkeit!", IMessageProvider.ERROR);
      return;
    } else {
      if (currentWorkType.isAffectBand() == null || !currentWorkType.isAffectBand()) {
        entry.setBandAction(null);
      } else {
        if (entry.getBandAction() == null) {
          parentForm.setMessage("Unbekanntes Problem bei Bändern!", IMessageProvider.ERROR);
          return;
        }
        if (entry.getBandAction().getBandType() == null) {
          parentForm.setMessage("Kein Bandtyp ausgewählt!", IMessageProvider.ERROR);
          return;
        }
        if (entry.getBandAction().getAmount() == null || entry.getBandAction().getAmount() == 0) {
          boolean confirm =
              MessageDialog.openQuestion(
                  getShell(),
                  "Anzahl bestätigen",
                  "Sie wollen bei einer Tätigkeit, die ein oder mehrere Bänder betreffen kann, eine Anzahl von '0' angeben...\n"
                      + "Sind Sie sich sicher?");
          if (confirm) entry.getBandAction().setAmount(0);
          else return;
        }
      }
    }

    if (currentPersonType == null) {
      parentForm.setMessage("Wählen Sie eine Person!", IMessageProvider.ERROR);
      return;
    }

    if (entry.getDate() == null) {
      Calendar c = Calendar.getInstance();
      c.set(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay());
      entry.setDate(c.getTime());
    }
    Calendar c = Calendar.getInstance();
    c.set(Calendar.HOUR_OF_DAY, 0);
    c.set(Calendar.MINUTE, 0);
    c.set(Calendar.SECOND, 0);
    c.set(Calendar.MILLISECOND, 0);
    c.add(Calendar.DATE, +1);
    if (entry.getDate() == null || c.getTime().before(entry.getDate())) {
      parentForm.setMessage("Kein Datum, oder Datum in der Zukunft!", IMessageProvider.ERROR);
      return;
    }

    if (entry.getTime() == null || entry.getTime() == 0) {
      boolean confirm =
          MessageDialog.openQuestion(
              getShell(),
              "Dauer bestätigen",
              "Sie wollen bei einer Tätigkeit, eine Dauer von '0' Stunden angeben...\n"
                  + "Sind Sie sich sicher?");
      if (confirm) entry.setTime(new Float(0));
      else return;
    }

    super.okPressed();
  }