/*
 * User: anna
 * Date: 27-Jul-2007
 */
package com.intellij.ide.todo;

import com.intellij.ide.IdeBundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.ChangeListAdapter;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.ui.content.Content;

public abstract class ChangeListTodosPanel extends TodoPanel{
  private MyChangeListManagerListener myChangeListManagerListener = new MyChangeListManagerListener();

  public ChangeListTodosPanel(Project project,TodoPanelSettings settings, Content content){
    super(project,settings,false,content);
    ChangeListManager changeListManager = ChangeListManager.getInstance(project);
    changeListManager.addChangeListListener(myChangeListManagerListener);
  }

  void dispose(){
    ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListManagerListener);
    super.dispose();
  }

  private final class MyChangeListManagerListener extends ChangeListAdapter {
    public void defaultListChanged(final ChangeList newDefaultList) {
      PsiDocumentManager.getInstance(myProject).commitAllDocuments();
      myTodoTreeBuilder.rebuildCache();
      setDisplayName(IdeBundle.message("changelist.todo.title", newDefaultList.getName()));
    }

    public void changeListRenamed(final ChangeList list, final String oldName) {
      setDisplayName(IdeBundle.message("changelist.todo.title", list.getName())); //todo i18n 
    }
  }
}
@@ -309,32 +309,80 @@
 ngeListManager;%0A
+import com.intellij.openapi.vcs.changes.Change;%0A
 import com.intel
@@ -450,16 +450,46 @@
 ntent;%0A%0A
+import java.util.Collection;%0A%0A
 public a
@@ -1609,21 +1609,242 @@
 )));
- //todo i18n 
+%0A    %7D%0A%0A    public void changesMoved(final Collection%3CChange%3E changes, final ChangeList fromList, final ChangeList toList) %7B%0A      PsiDocumentManager.getInstance(myProject).commitAllDocuments();%0A      myTodoTreeBuilder.rebuildCache();
 %0A   

move changes fix