/** Initializes the wizard page controls with data. */
  protected void initControls() {
    String configId = config != null ? config.getGuid() : ""; // $NON-NLS-1$

    if ((config != null)
        && ConfigFreeProcessPublishUtil.getInstance().isSameMethodConfiguration(config)) {
      // For config free process publish
      processViewer.setContentProvider(new ProcessViewerOfConfigFreeContentProvider());
      publishConfigRadioButton.setEnabled(false);
      publishConfigRadioButton.setSelection(false);
      publishProcessesRadioButton.setSelection(true);
      processViewer.getControl().setEnabled(true);

      List<String> processIds = PublishingUIPreferences.getProcesses(configId);
      List<Process> processes = new ArrayList<Process>();
      if (processIds != null) {
        for (String guid : processIds) {
          MethodElement e =
              LibraryService.getInstance().getCurrentLibraryManager().getMethodElement(guid);
          if (e instanceof Process) {
            processes.add((Process) e);
          }
        }
      }
      processViewer.setCheckedElements(processes.toArray());

      boolean includeBaseProcess = PublishingUIPreferences.getIncludeBaseProcesses(configId);
      includeBaseProcessesCheckbox.setSelection(includeBaseProcess);

      updateCheckedStates();
    } else {
      processViewer.setContentProvider(new ProcessViewerContentProvider());
      boolean publishConfig = PublishingUIPreferences.getPublishEntireConfig(configId);
      publishConfigRadioButton.setEnabled(true);
      publishConfigRadioButton.setSelection(publishConfig);
      publishProcessesRadioButton.setSelection(!publishConfig);
      processViewer.getControl().setEnabled(!publishConfig);

      if (!publishConfig) {
        List<String> processIds = PublishingUIPreferences.getProcesses(configId);
        List<Process> processes = new ArrayList<Process>();
        if (processIds != null) {
          for (String guid : processIds) {
            MethodElement e =
                LibraryService.getInstance().getCurrentLibraryManager().getMethodElement(guid);
            if (e instanceof Process) {
              processes.add((Process) e);
            }
          }
        }
        processViewer.setCheckedElements(processes.toArray());
      }

      boolean includeBaseProcess = PublishingUIPreferences.getIncludeBaseProcesses(configId);
      includeBaseProcessesCheckbox.setSelection(includeBaseProcess);

      updateCheckedStates();
    }
  }
Exemple #2
0
  public void testSetCheckedElements() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;

    TestElement[] children = fRootElement.getChildren();

    List toCheck = new ArrayList((children.length + 1) / 2);

    for (int i = 0; i < children.length; i += 2) {
      toCheck.add(children[i]);
    }

    ctv.setCheckedElements(toCheck.toArray());

    for (int i = 0; i < children.length; i++) {
      if (i % 2 == 0) {
        assertTrue(
            "an element passed through setCheckedElements should be checked",
            ctv.getChecked(children[i]));
      } else {
        assertFalse(
            "an element not passed through setCheckedElements should be unchecked",
            ctv.getChecked(children[i]));
      }
    }
  }