public void commit() {
try {
boolean fireChanges = false;
if (myStartChange != null) {
GanttCalendar start = getStart();
TaskImpl.this.setStart(start);
}
if (myDurationChange != null) {
TaskLength duration = getDuration();
TaskImpl.this.setDuration(duration);
myEndChange = null;
}
if (myCompletionPercentageChange != null) {
int newValue = getCompletionPercentage();
TaskImpl.this.setCompletionPercentage(newValue);
}
if (myEndChange != null) {
GanttCalendar end = getEnd();
if (end.getTime().compareTo(TaskImpl.this.getStart().getTime())>0) {
TaskImpl.this.setEnd(end);
}
}
if (myThirdChange != null) {
GanttCalendar third = getThird();
TaskImpl.this.setThirdDate(third);
}
for (int i = 0; i < myCommands.size(); i++) {
Runnable next = (Runnable) myCommands.get(i);
next.run();
}
myCommands.clear();
myPropertiesEventSender.fireEvent();
myProgressEventSender.fireEvent();
} finally {
TaskImpl.this.myMutator = null;
}
if (myStartChange!=null && TaskImpl.this.isSupertask()) {
TaskImpl.this.adjustNestedTasks();
}
if ((myStartChange!=null || myEndChange!=null || myDurationChange!=null) && areEventsEnabled()) {
GanttCalendar oldStart = (GanttCalendar) (myStartChange==null ? TaskImpl.this.getStart() : myStartChange.myOldValue);
GanttCalendar oldEnd = (GanttCalendar) (myEndChange==null ? TaskImpl.this.getEnd() : myEndChange.myOldValue);
myManager.fireTaskScheduleChanged(TaskImpl.this, oldStart, oldEnd);
}
}