public void handleEvent()

in uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/GeneralSection.java [139:235]


  public void handleEvent(Event event) {
    if (event.widget == primitiveButton || event.widget == aggregateButton) {
      boolean isPrimitive = primitiveButton.getSelection();
      // Note: events occur when button is selected or deselected
      if (event.widget == primitiveButton && !isPrimitive)
        return; // deselecting
      if (event.widget == aggregateButton && isPrimitive)
        return; // deselecting
      if (isPrimitive && isPrimitive())
        return; // nothing changed
      if (!isPrimitive && isAggregate())
        return; // nothing changed
      if (isPrimitive) {
        if (Window.CANCEL == Utility.popOkCancel("Switching from Aggregate",
                "This action will clear the capabilities, reset the delegates, "
                        + "reset the flow, reset the parameters, reset any resource information "
                        + "and start with an empty type system.  Are you sure?",
                MessageDialog.WARNING)) {
          aggregateButton.setSelection(true);
          primitiveButton.setSelection(false);
          return;
        }
        editor.getAeDescription().setAnnotatorImplementationName("");
      } else {
        // if (isLocalProcessingDescriptor() && !isAeDescriptor()) {
        // Utility.popMessage("Not Allowed",
        // "Cas Consumers, Cas Initializers, Collection Readers, and Flow Controllers cannot be
        // Aggregates.",
        // MessageDialog.ERROR);
        // primitiveButton.setSelection(true);
        // aggregateButton.setSelection(false);
        // return;
        // }
        if (Window.CANCEL == Utility.popOkCancel("Switching from Primitive AE",
                "This action will clear the capabilities, reset the delegates, "
                        + "reset the parameters, reset any resource information "
                        + "and reset the type system.  Are you sure?",
                MessageDialog.WARNING)) {
          primitiveButton.setSelection(true);
          aggregateButton.setSelection(false);
          return;
        }
        editor.getAeDescription().setAnnotatorImplementationName(null);
      }
      editor.getAeDescription().setPrimitive(isPrimitive);
      commonResets();
      try {
        editor.setAeDescription(editor.getAeDescription());
      } catch (ResourceInitializationException e) {
        throw new InternalErrorCDE("invalid state", e);
      }
      javaButton.setEnabled(isPrimitive);
      cppButton.setEnabled(isPrimitive);
      HeaderPage page = editor.getAggregatePage();
      if (null != page)
        page.markStale();
      page = editor.getParameterPage();
      if (null != page)
        page.markStale();
      page = editor.getSettingsPage();
      if (null != page)
        page.markStale();
      page = editor.getTypePage();
      if (null != page)
        markRestOfPageStale(page.getManagedForm(), null);
      page = editor.getCapabilityPage();
      if (null != page)
        page.markStale();
      page = editor.getIndexesPage();
      if (null != page)
        page.markStale();
      page = editor.getResourcesPage();
      if (null != page)
        page.markStale();
    }
    if (event.widget == javaButton || event.widget == cppButton) {
      valueChanged = false;
      if (cppButton.getSelection()) {
        editor.getAeDescription()
                .setFrameworkImplementation(setValueChanged(Constants.CPP_FRAMEWORK_NAME,
                        editor.getAeDescription().getFrameworkImplementation()));
      } else {
        editor.getAeDescription()
                .setFrameworkImplementation(setValueChanged(Constants.JAVA_FRAMEWORK_NAME,
                        editor.getAeDescription().getFrameworkImplementation()));
      }
      if (!valueChanged)
        return;
    }
    PrimitiveSection s = editor.getOverviewPage().getPrimitiveSection();
    if (null != s) {
      s.refresh();
      // next line makes the bounding rectangle show up
      s.getSection().getClient().redraw();
    }
    setFileDirty();
  }