/** Selects the referenced base processes in the process tree viewer. */
  private void selectBaseProcesses() {
    // Get the referenced base processes.
    List<Process> processes = getSelectedProcesses();
    List<Process> baseProcesses = new ArrayList<Process>();
    for (Iterator it = processes.iterator(); it.hasNext(); ) {
      ConfigurationHelper.getBaseProcesses((Activity) it.next(), config, baseProcesses);
    }

    // Update the process tree viewer.
    for (Iterator it = baseProcesses.iterator(); it.hasNext(); ) {
      Object element = it.next();
      processViewer.setChecked(element, true);
    }
  }
  /** Adds the new packages into the configurations if the parent is in the configuration. */
  private void addNewPackagesToConfiguration(Collection newobjs) {
    if (newobjs == null || newobjs.size() == 0) {
      return;
    }

    LibraryModificationHelper helper = new LibraryModificationHelper();

    try {
      EObject e, parent;
      for (Iterator it = newobjs.iterator(); it.hasNext(); ) {
        e = (EObject) it.next();
        if ((e instanceof MethodPackage)
            && ((parent = e.eContainer()) != null)
            && (parent instanceof MethodPackage)) {
          Object configs =
              ((MultiResourceEObject) parent)
                  .getOppositeFeatureValue(AssociationHelper.MethodPackage_MethodConfigurations);
          if (configs instanceof List) {
            for (Iterator itconfig = ((List) configs).iterator(); itconfig.hasNext(); ) {
              MethodConfiguration config = (MethodConfiguration) itconfig.next();
              if (!ConfigurationHelper.getDelegate().needFixupLoadCheckPackages(config)) {
                continue;
              }
              List pkgs = config.getMethodPackageSelection();
              if (!pkgs.contains(e)) {
                // pkgs.add(e);
                helper
                    .getActionManager()
                    .doAction(
                        IActionManager.ADD,
                        config,
                        UmaPackage.eINSTANCE.getMethodConfiguration_MethodPackageSelection(),
                        e,
                        -1);
              }
            }
          }
        }
      }

      // wlu0 9-12-2012: we are now using "loadCheckPkgs" property mechanism to handle adding to
      // configuration. No need to save here.
      //			helper.save();

    } catch (RuntimeException e) {
      LibraryPlugin.getDefault().getLogger().logError(e);
    } finally {
      helper.dispose();
    }
  }