in src/org/jetbrains/tfsIntegration/ui/CheckInPoliciesForm.java [387:438]
private boolean editPolicy(StatefulPolicyDescriptor descriptor) {
PolicyBase policy;
try {
policy = CheckinPoliciesManager.find(descriptor.getType());
}
catch (DuplicatePolicyIdException e) {
// can't get here
throw new RuntimeException(e);
}
if (policy == null) {
return false;
}
if (!canEditSafe(policy)) {
return true;
}
try {
policy.loadState((Element)descriptor.getConfiguration().clone());
}
catch (Throwable t) {
String message =
MessageFormat.format("Cannot load state of checkin policy ''{0}'':\n{1}", descriptor.getType().getName(), t.getMessage());
Messages.showErrorDialog(myProject, message, "Edit Checkin Policy");
return false;
}
boolean result;
try {
result = policy.edit(myProject);
}
catch (Throwable t) {
String message = MessageFormat.format("Cannot edit checkin policy ''{0}'':\n{1}", descriptor.getType().getName(), t.getMessage());
Messages.showErrorDialog(myProject, message, "Edit Checkin Policy");
return false;
}
if (result) {
Element configurationElement = StatefulPolicyParser.createEmptyConfiguration();
try {
policy.saveState(configurationElement);
descriptor.setConfiguration(configurationElement);
myProjectToDescriptors.get(getSelectedProject()).isModified = true;
}
catch (Throwable t) {
String message =
MessageFormat.format("Cannot save state of checkin policy ''{0}'':\n{1}", descriptor.getType().getName(), t.getMessage());
Messages.showErrorDialog(myProject, message, "Edit Checkin Policy");
}
}
return result;
}