예제 #1
0
  /**
   * Creates and returns the content of the information area.
   *
   * @param composite The parent composite to contain the information area
   */
  private Composite createInfoArea(Composite composite) {
    Group group = new Group(composite, SWT.CENTER);
    group.setText("Info");
    GridLayout layout = new GridLayout(2, false);
    group.setLayout(layout);

    Label dateLabel = new Label(group, SWT.LEFT);
    dateLabel.setText("Date");
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    dateLabel.setLayoutData(gd);
    dateText = new Text(group, SWT.SINGLE | SWT.BORDER);
    final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    final TimeZone local = TimeZone.getDefault();
    sdf.setTimeZone(local);
    // new Date() gets current date/elapsedTime
    final String dateString = sdf.format(new Date());
    dateText.setText(dateString);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    dateText.setLayoutData(gd);

    Label authorLabel = new Label(group, SWT.LEFT);
    authorLabel.setText("Author");
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    authorLabel.setLayoutData(gd);
    authorText = new Text(group, SWT.SINGLE | SWT.BORDER);
    // should look in preferences...
    authorText.setText(
        Activator.getDefault()
            .getPreferenceStore()
            .getString(ProfileDefinitionPreferenceConstants.PREF_AUTHOR_NAME));
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    authorText.setLayoutData(gd);

    return group;
  }
예제 #2
0
  /** {@inheritDoc} */
  @Override
  protected void okPressed() {
    // save author and copyright in preference store
    if (savePreferencesButton.getSelection()) {
      Activator.getDefault()
          .getPreferenceStore()
          .setValue(ProfileDefinitionPreferenceConstants.PREF_AUTHOR_NAME, authorText.getText());
      Activator.getDefault()
          .getPreferenceStore()
          .setValue(ProfileDefinitionPreferenceConstants.PREF_COPYRIGHT, copyrightText.getText());
    }

    // creates the new Papyrus Definition Annotation
    papyrusDefinitionAnnotation =
        new PapyrusDefinitionAnnotation(
            newVersionValue,
            commentText.getText(),
            copyrightText.getText(),
            dateText.getText(),
            authorText.getText());
    super.okPressed();
  }
예제 #3
0
  /**
   * Creates and returns the content of the copyright area.
   *
   * @param composite The parent composite to contain the copyright area
   */
  private Composite createCopyrightArea(Composite composite) {
    Group group = new Group(composite, SWT.CENTER);
    group.setText("Copyright");
    GridLayout layout = new GridLayout();
    group.setLayout(layout);

    // new copyright area
    copyrightText = new Text(group, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    // should look
    copyrightText.setText(
        Activator.getDefault()
            .getPreferenceStore()
            .getString(ProfileDefinitionPreferenceConstants.PREF_COPYRIGHT));
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
    gd.heightHint = 60;
    copyrightText.setLayoutData(gd);
    return group;
  }