コード例 #1
0
 /**
  * Updates the current strategy to the strategy provided by the passed profile. The profile should
  * have been previously registered.
  *
  * @param profile the profile providing the current formating strategy
  */
 public void activateFormatingStrategy(Profile profile) {
   if (profile != null
       && profile.getFormatingStrategy() != null
       && getProfiles().contains(profile)) {
     this.formatingStrategy = profile.getFormatingStrategy();
   }
 }
コード例 #2
0
  /**
   * Removes the passed profile from the configuration.
   *
   * @param p the profile to be removed
   */
  public void removeProfile(Profile p) {
    profiles.remove(p);
    try {
      profileModels.removeAll(p.getProfilePackages());
    } catch (ProfileException e) {
      LOG.error("Exception", e);
    }

    FigNodeStrategy fns = p.getFigureStrategy();
    if (fns != null) {
      figNodeStrategies.remove(fns);
    }

    if (formatingStrategy == p.getFormatingStrategy()) {
      formatingStrategy = null;
    }

    List<Profile> markForRemoval = new ArrayList<Profile>();
    for (Profile profile : profiles) {
      if (profile.getDependencies().contains(p)) {
        markForRemoval.add(profile);
      }
    }

    for (Profile profile : markForRemoval) {
      removeProfile(profile);
    }

    updateStrategies();
    ArgoEventPump.fireEvent(
        new ArgoProfileEvent(
            ArgoEventTypes.PROFILE_REMOVED, new PropertyChangeEvent(this, "profile", p, null)));
  }