public boolean performOk() {
   if (JBPMRuntimeManager.getDefaultJBPMRuntime() != null) {
     MessageDialog.openInformation(
         getShell(),
         "Warning",
         "You need to restart Eclipse to update the jBPM Runtime of existing projects.");
   }
   JBPMRuntimeManager.setJBPMRuntimes(jBPMRuntimesBlock.getJBPMRuntimes());
   return super.performOk();
 }
  protected Control createContents(Composite ancestor) {
    initializeDialogUnits(ancestor);
    noDefaultAndApplyButton();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    ancestor.setLayout(layout);
    Label l = new Label(ancestor, SWT.WRAP);
    l.setFont(ancestor.getFont());
    l.setText(
        "Add, remove or edit jBPM Runtime definitions. "
            + "By default, the checked jBPM Runtime is added to the build "
            + "path of newly created jBPM projects.");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.widthHint = 300;
    l.setLayoutData(gd);
    l = new Label(ancestor, SWT.NONE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = 1;
    l.setLayoutData(gd);
    jBPMRuntimesBlock = new JBPMRuntimesBlock();
    jBPMRuntimesBlock.createControl(ancestor);
    JBPMRuntime[] runtimes = JBPMRuntimeManager.getJBPMRuntimes();
    jBPMRuntimesBlock.setJBPMRuntimes(runtimes);
    for (JBPMRuntime runtime : runtimes) {
      if (runtime.isDefault()) {
        jBPMRuntimesBlock.setDefaultJBPMRuntime(runtime);
        break;
      }
    }
    if (jBPMRuntimesBlock.getDefaultJBPMRuntime() == null) {
      setErrorMessage("Select a default jBPM Runtime");
    }
    Control control = jBPMRuntimesBlock.getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 1;
    data.widthHint = 450;
    control.setLayoutData(data);

    jBPMRuntimesBlock.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            JBPMRuntime runtime = jBPMRuntimesBlock.getDefaultJBPMRuntime();
            if (runtime == null) {
              setErrorMessage("Select a default jBPM Runtime");
            } else {
              setErrorMessage(null);
            }
          }
        });
    applyDialogFont(ancestor);
    return ancestor;
  }