save task on commit
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Mon, 16 Jan 2012 12:44:46 +0000 (16:44 +0400)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Mon, 16 Jan 2012 13:48:23 +0000 (17:48 +0400)
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java

index 39697014cd3a7bda5193480e76f7b2a750e917e5..e1c0f7214a882dfe9ab1c7ed82e873a3dca02d36 100644 (file)
@@ -48,21 +48,18 @@ public class TaskCheckinHandlerFactory extends CheckinHandlerFactory {
           final Project project = panel.getProject();
           final TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
           if (manager.getState().saveContextOnCommit) {
-            final Task task = findTask(message, manager);
+            Task task = findTask(message, manager);
+            if (task == null) {
+              task = manager.createLocalTask(message);
+            }
+            final LocalTask localTask = manager.addTask(task);
+            localTask.setUpdated(new Date());
 
             //noinspection SSBasedInspection
             SwingUtilities.invokeLater(new Runnable() {
               @Override
               public void run() {
-                final WorkingContextManager contextManager = WorkingContextManager.getInstance(project);
-                if (task != null) {
-                  LocalTask localTask = manager.addTask(task);
-                  localTask.setUpdated(new Date());
-                  contextManager.saveContext(localTask);
-                }
-                else {
-                  contextManager.saveContext(null, message);
-                }
+                WorkingContextManager.getInstance(project).saveContext(localTask);
               }
             });
           }