コード例 #1
0
  @Override
  public void performDefaults() {

    scriptField.setText("");
    scriptField.setEnabled(false);

    if (buttonGroup != null) {
      buttonGroup.setSelection(0, true);
      buttonGroup.setSelection(1, false);
    }
    setValue(useScriptInsideProject, true);
    setValue(scriptToExecute, "");
    setValue(phpExecutable, "");
    validateSettings(null, null, null);
    super.performDefaults();
  }
コード例 #2
0
  protected void createScriptGroup(Composite result) {

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    scriptGroup = new Group(result, SWT.NONE);
    scriptGroup.setLayout(new GridLayout(3, false));
    scriptGroup.setLayoutData(gd);
    scriptGroup.setText(getScriptLabel());

    buttonGroup =
        new SelectionButtonDialogFieldGroup(
            SWT.RADIO, new String[] {getProjectChoiceLabel(), getGlobalChoiceLabel()}, 2);
    buttonGroup.setLabelText(getButtonGroupLabel());
    buttonGroup.doFillIntoGrid(scriptGroup, 3);
    buttonGroup.setDialogFieldListener(
        new org.eclipse.dltk.internal.ui.wizards.dialogfields.IDialogFieldListener() {
          @Override
          public void dialogFieldChanged(
              org.eclipse.dltk.internal.ui.wizards.dialogfields.DialogField field) {
            scriptField.setEnabled(buttonGroup.isSelected(1));
          }
        });

    scriptField =
        new StringButtonDialogField(
            new IStringButtonAdapter() {
              @Override
              public void changeControlPressed(DialogField field) {
                FileDialog dialog = new FileDialog(getShell());
                String path = dialog.open();
                if (path != null) {
                  scriptField.setText(path);
                }
              }
            });

    scriptField.setButtonLabel("Browse");

    boolean useProjectPhar = getBooleanValue(useScriptInsideProject);

    if (useProjectPhar) {
      scriptField.setEnabled(false);
      buttonGroup.setSelection(0, true);
      buttonGroup.setSelection(1, false);
    } else {
      buttonGroup.setSelection(0, false);
      buttonGroup.setSelection(1, true);
    }

    scriptField.setDialogFieldListener(this);
    scriptField.setLabelText(getScriptFieldLabel());
    scriptField.doFillIntoGrid(scriptGroup, 3);
  }
コード例 #3
0
  @Override
  protected void validateSettings(Key changedKey, String oldValue, String newValue) {

    StatusInfo status = new StatusInfo();

    if (phpExes.getAllItems().length == 0) {
      status =
          new StatusInfo(
              StatusInfo.WARNING,
              "No PHP executable configured. Dependencies cannot be managed properly.");
    }

    if (buttonGroup != null && buttonGroup.isSelected(1)) {
      if (!validateScript(scriptField.getText())) {
        status =
            new StatusInfo(
                StatusInfo.WARNING, "The selected file is not a valid php script/archive.");
      }
    }

    fContext.statusChanged(status);
  }
コード例 #4
0
 protected boolean doUseScriptInsideProject() {
   return buttonGroup.isSelected(0);
 }