Пример #1
0
  /** 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();
    }
  }
Пример #2
0
 /** Updates the check states of process tree viewer. */
 private void updateCheckedStates() {
   ITreeContentProvider cp = (ITreeContentProvider) processViewer.getContentProvider();
   if (config != null) {
     Object[] plugins = null;
     if (ConfigFreeProcessPublishUtil.getInstance().isSameMethodConfiguration(config)) {
       // For config free process publish
       plugins = cp.getChildren(LibraryService.getInstance().getCurrentMethodLibrary());
     } else {
       plugins = cp.getChildren(config);
     }
     for (int i = 0; i < plugins.length; i++) {
       Object[] uiFolders = cp.getChildren(plugins[i]);
       int totalUIFolders = uiFolders.length;
       int checkedUIFolders = 0;
       for (int j = 0; j < uiFolders.length; j++) {
         Object[] processes = cp.getChildren(uiFolders[j]);
         int totalProcesses = processes.length;
         int checkedProcesses = 0;
         for (int k = 0; k < processes.length; k++) {
           if (processViewer.getChecked(processes[k])) {
             checkedProcesses++;
           }
         }
         if (checkedProcesses == 0) {
           processViewer.setGrayChecked(uiFolders[j], false);
         } else if (checkedProcesses == totalProcesses) {
           processViewer.setGrayed(uiFolders[j], false);
           processViewer.setChecked(uiFolders[j], true);
         } else {
           processViewer.setGrayChecked(uiFolders[j], true);
         }
         if (processViewer.getChecked(uiFolders[j])) {
           checkedUIFolders++;
         }
       }
       if (checkedUIFolders == totalUIFolders) {
         processViewer.setGrayed(plugins[i], false);
         processViewer.setChecked(plugins[i], true);
       } else if (checkedUIFolders == 0) {
         processViewer.setGrayChecked(plugins[i], false);
       } else {
         processViewer.setGrayChecked(plugins[i], true);
       }
     }
   }
 }
Пример #3
0
 /** @see org.eclipse.epf.ui.wizards.BaseWizardPage#onEnterPage(Object) */
 public void onEnterPage(Object obj) {
   if (obj != null && obj instanceof String) {
     String configName = (String) obj;
     config =
         LibraryServiceUtil.getMethodConfiguration(
             LibraryService.getInstance().getCurrentMethodLibrary(), configName);
     if (config != null) {
       processViewer.setInput(config);
       initControls();
       processViewer.expandAll();
     } else {
       // For config free process publishing
       config =
           ConfigFreeProcessPublishUtil.getInstance().getMethodConfigurationForConfigFreeProcess();
       processViewer.setInput(LibraryService.getInstance().getCurrentMethodLibrary());
       initControls();
       processViewer.expandAll();
     }
   }
 }