ExceptionHandler.reportException(e);
return false;
}
if ((profileName == null) || !textProfileName.getText().equals(profileName)) {
Profile pr = profileManager.getProfile(textProfileName.getText());
if (pr != null) {
MessageBox mb = new MessageBox(m_parent.getShell(), SWT.ICON_ERROR);
mb.setText(Messages.getString("ProfileDetails.Duplicate_Entry")); //$NON-NLS-1$
mb.setMessage(Messages.getString("ProfileDetails.Profile_already_exists")); //$NON-NLS-1$
mb.open();
return false;
}
}
Profile p;
RuleSetDescriptor ruleSetDescriptor = null;
ruleSetDescriptor = new SimplyfiedRuleSetDescriptor(syncSubsButton.getSelection(), filter, buttonUseFileFilter.getSelection(),
getFileFilterTree());
if (profileName == null) {
p = new Profile(textProfileName.getText(), src, dst, ruleSetDescriptor);
p.setSynchronizationType(comboType.getText());
p.setDescription(textProfileDescription.getText());
p.setSchedule((Schedule) buttonScheduling.getData());
p.setEnabled(buttonEnabled.getSelection());
if (buttonResetError.getSelection()) {
p.setLastError(0, null);
}
profileManager.addProfile(p);
}
else {
p = profileManager.getProfile(profileName);
p.beginUpdate();
p.setName(textProfileName.getText());
p.setDescription(textProfileDescription.getText());
p.setSynchronizationType(comboType.getText());
p.setSource(src);
p.setDestination(dst);
p.setSchedule((Schedule) buttonScheduling.getData());
p.setEnabled(buttonEnabled.getSelection());
p.setRuleSet(ruleSetDescriptor);
if (buttonResetError.getSelection()) {
p.setLastError(0, null);
}
p.endUpdate();
}
profileManager.save();
return true; //FIXME: return false if failed
}