public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);

    initializeDialogUnits(parent);

    // Actual contents
    Composite appSettings = new Composite(composite, SWT.NULL);
    appSettings.setLayout(new GridLayout(2, false));

    Label label = new Label(appSettings, SWT.NONE);
    label.setText(Messages.HerokuDeployWizardPage_ApplicationNameLabel);

    appName = new Text(appSettings, SWT.SINGLE | SWT.BORDER);
    appName.setLayoutData(new GridData(250, SWT.DEFAULT));
    // Set default name to project name
    appName.setText(getProjectName());
    appName.addModifyListener(
        new ModifyListener() {

          public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
          }
        });

    publishButton = new Button(composite, SWT.CHECK);
    publishButton.setText(Messages.HerokuDeployWizardPage_PublishApplicationLabel);
    publishButton.setSelection(
        Platform.getPreferencesService()
            .getBoolean(
                HerokuPlugin.getPluginIdentifier(),
                IPreferenceConstants.HEROKU_AUTO_PUBLISH,
                true,
                null));

    if (doesntHaveGitRepo()) {
      Label note = new Label(composite, SWT.WRAP);
      // We need this italic, we may need to set a font explicitly here to get it
      Font dialogFont = JFaceResources.getDialogFont();
      FontData[] data = SWTUtils.italicizedFont(JFaceResources.getDialogFont());
      final Font italic = new Font(dialogFont.getDevice(), data);
      note.setFont(italic);
      note.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {
              if (!italic.isDisposed()) {
                italic.dispose();
              }
            }
          });

      note.setLayoutData(new GridData(400, SWT.DEFAULT));
      note.setText(Messages.HerokuDeployWizardPage_NoGitRepoNote);
    }

    Dialog.applyDialogFont(composite);
  }
  private void adjustWidth() {
    List<Control> actionControls = new ArrayList<Control>();
    actionControls.add(testButton);
    actionControls.add(createAccountButton);

    SWTUtils.resizeControlWidthInGrid(actionControls);
  }
Exemplo n.º 3
0
  /** Updates the next and previous buttons since finish was already clicked */
  public void disableButtonsOnFinish() {
    int[] ids = new int[] {IDialogConstants.NEXT_ID, IDialogConstants.BACK_ID};

    for (int id : ids) {
      Button button = getButton(id);
      if (!SWTUtils.isControlDisposed(button)) {
        button.setEnabled(false);
      }
    }
  }