@Override
 public Profile rename(String name, ProfileManager manager) {
   CustomProfile profile =
       new CustomProfile(name.trim(), getSettings(), getVersion(), getKind());
   profile.setManager(manager);
   manager.profileReplaced(this, profile);
   return profile;
 }
 @Override
 public void setSettings(Map<String, String> settings) {
   if (settings == null) throw new IllegalArgumentException();
   fSettings = settings;
   if (fManager != null) {
     fManager.profileChanged(this);
   }
 }
 @Override
 public Profile rename(String name, ProfileManager manager) {
   final String trimmed = name.trim();
   CustomProfile newProfile =
       new CustomProfile(trimmed, fSettings, fCurrentVersion, fProfileKind);
   manager.addProfile(newProfile);
   return newProfile;
 }
    @Override
    public Profile rename(String name, ProfileManager manager) {
      final String trimmed = name.trim();
      if (trimmed.equals(getName())) return this;

      String oldID = getID(); // remember old id before changing name
      fName = trimmed;

      manager.profileRenamed(this, oldID);
      return this;
    }
  @Override
  protected void updateProfilesWithName(String oldName, Profile newProfile, boolean applySettings) {
    super.updateProfilesWithName(oldName, newProfile, applySettings);

    IEclipsePreferences node = fPreferencesAccess.getInstanceScope().getNode(JavaUI.ID_PLUGIN);
    String name = node.get(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, null);
    if (name != null && name.equals(oldName)) {
      if (newProfile == null) {
        node.remove(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE);
      } else {
        node.put(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, newProfile.getID());
      }
    }
  }