コード例 #1
0
  /**
   * @param p the profile to register.
   * @return true if there should be an attempt to load the default profiles from the configuration.
   */
  private boolean registerProfileInternal(Profile p) {

    try {
      boolean loadDefaultProfilesFromConfiguration = false;
      if (p != null && !profiles.contains(p)) {
        if (p instanceof UserDefinedProfile || getProfileForClass(p.getClass().getName()) == null) {
          loadDefaultProfilesFromConfiguration = true;
          profiles.add(p);
          for (Critic critic : p.getCritics()) {
            for (Object meta : critic.getCriticizedDesignMaterials()) {
              Agency.register(critic, meta);
            }
            critic.setEnabled(false);
          }
        }
      }
      return loadDefaultProfilesFromConfiguration;
    } catch (RuntimeException e) {
      // TODO: Better if we wrap in a ProfileException and throw that
      LOG.error("Error registering profile " + p.getDisplayName());
      throw e;
    }
  }
コード例 #2
0
 /*
  * @param pc
  * @see org.argouml.profile.ProfileManager#applyConfiguration(org.argouml.kernel.ProfileConfiguration)
  */
 public void applyConfiguration(ProfileConfiguration pc) {
   for (Profile p : this.profiles) {
     for (Critic c : p.getCritics()) {
       c.setEnabled(false);
       Configuration.setBoolean(c.getCriticKey(), false);
     }
   }
   for (Profile p : pc.getProfiles()) {
     for (Critic c : p.getCritics()) {
       c.setEnabled(true);
       Configuration.setBoolean(c.getCriticKey(), true);
     }
   }
 }