if(taskDataManager.hasTaskData(task)) {
String attributeName = null;
try {
boolean openTask = true;
TaskDataModel model = RedmineTasksUiUtil.findOpenTaskModel(task);
if(model==null) {
openTask = false;
ITaskDataWorkingCopy copy = taskDataManager.getWorkingCopy(task);
model = new TaskDataModel(repository, task, copy);
}
TaskData taskData = model.getTaskData();
for (RedmineAttribute redmineAttribute : attributes) {
if(redmineAttribute!=null) {
attributeName = redmineAttribute.name();
TaskAttribute attribute = taskData.getRoot().getAttribute(redmineAttribute.getTaskKey());
String newValue = getValue(redmineAttribute, taskData);
if(!attribute.getValue().equals(newValue)) {
if(openTask) {
setOpenTaskValue(attribute, newValue, taskData, model);
} else {
setClosedTaskValue(attribute, newValue, taskData, model);
}
}
}
}
if(!openTask) {
model.save(new NullProgressMonitor());
}
} catch (CoreException e) {
ILogService log = RedmineUiPlugin.getLogService(getClass());