/**
  * Update the enablement for the pages' widgets based on the most recent changes to the server.
  */
 protected void updateWidgetEnablement() {
   final boolean enabled = shouldAllowModifications();
   if (standardOptions != null && !standardOptions.isDisposed()) {
     new WidgetVisitorUtility().setEnablementRecursive(standardOptions, enabled);
   }
   if (perModuleOptions != null && !perModuleOptions.isDisposed()) {
     new WidgetVisitorUtility().setEnablementRecursive(perModuleOptions, enabled);
     perModuleOptions.refreshViewer();
   }
 }
 private void validatePage() {
   IStatus[] all = standardOptions.validate();
   IStatus[] all2 = perModuleOptions.validate();
   // show highest status error
   IStatus highest = null;
   for (int i = 0; i < all.length; i++) {
     if (highest == null || all[i].getSeverity() > highest.getSeverity()) highest = all[i];
   }
   for (int i = 0; i < all2.length; i++) {
     if (highest == null || all2[i].getSeverity() > highest.getSeverity()) highest = all2[i];
   }
   setStatus(highest);
 }
  @Override
  public void doSave(IProgressMonitor monitor) {
    if (standardOptions != null) standardOptions.updateListeners();
    if (perModuleOptions != null) perModuleOptions.updateListeners();

    IServer s = getServer();
    if (s.getServerState() == IServer.STATE_STARTED) {
      JBossExtendedProperties properties =
          (JBossExtendedProperties) s.loadAdapter(JBossExtendedProperties.class, null);
      if (properties != null) {
        IDeploymentScannerModifier modifier = properties.getDeploymentScannerModifier();
        if (modifier != null) {
          Job scannerJob = modifier.getUpdateDeploymentScannerJob(s);
          if (scannerJob != null) scannerJob.schedule();
        }
      }
    }
  }
  /**
   * Clients are expected to override this method if they require a custom layout with various
   * composites
   *
   * @param parent
   * @param top
   */
  protected void addDeploymentLocationControls(Composite parent, Control top) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    Label l1 = toolkit.createLabel(parent, Messages.EditorDeploymentPageWarning);
    FontData fontData = l1.getFont().getFontData()[0];
    Font font =
        new Font(
            parent.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
    l1.setFont(font);

    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 5);
    fd.top = top == null ? new FormAttachment(0, 5) : new FormAttachment(top, 5);
    fd.right = new FormAttachment(100, -5);
    l1.setLayoutData(fd);

    errorImage = toolkit.createLabel(parent, "");
    fd = new FormData();
    fd.top = new FormAttachment(l1, 5);
    fd.left = new FormAttachment(0, 0);
    errorImage.setLayoutData(fd);

    errorLabel = toolkit.createLabel(parent, "", SWT.WRAP);
    fd = new FormData();
    fd.top = new FormAttachment(l1, 5);
    fd.left = new FormAttachment(0, 20);
    fd.right = new FormAttachment(0, 600);
    errorLabel.setLayoutData(fd);

    // First section is deployment mode (server / custom / metadata) etc.
    standardOptions = createServerDeploymentOptions(parent);
    standardOptions.setLayoutData(UIUtil.createFormData2(errorLabel, 5, null, 0, 0, 5, 100, -5));

    // Simply create a composite to show the per-module customizations
    perModuleOptions = createModuleDeploymentOptions(parent);
    fd = new FormData();
    fd.left = new FormAttachment(0, 5);
    fd.top = new FormAttachment(standardOptions, 5);
    fd.right = new FormAttachment(100, -5);
    fd.bottom = new FormAttachment(100, -5);
    perModuleOptions.setLayoutData(fd);
  }