Fix "Default Changelist Changelist" duplication in the TODO view (IDEA-195273)

This commit is contained in:
Kirill Likhodedov
2018-07-13 15:16:29 +03:00
parent 99a848078a
commit 7152417a62
3 changed files with 11 additions and 9 deletions
@@ -16,7 +16,6 @@
package com.intellij.ide.todo;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList;
@@ -41,12 +40,12 @@ public abstract class ChangeListTodosPanel extends TodoPanel{
@Override
public void defaultListChanged(final ChangeList oldDefaultList, final ChangeList newDefaultList) {
rebuildWithAlarm(myAlarm);
AppUIUtil.invokeOnEdt(() -> setDisplayName(IdeBundle.message("changelist.todo.title", newDefaultList.getName())));
AppUIUtil.invokeOnEdt(() -> setDisplayName(TodoView.getTabNameForChangeList(newDefaultList.getName())));
}
@Override
public void changeListRenamed(final ChangeList list, final String oldName) {
AppUIUtil.invokeOnEdt(() -> setDisplayName(IdeBundle.message("changelist.todo.title", list.getName())));
AppUIUtil.invokeOnEdt(() -> setDisplayName(TodoView.getTabNameForChangeList(list.getName())));
}
@Override
@@ -1,7 +1,6 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.todo;
import com.intellij.ide.CommonActionsManager;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.TreeExpander;
import com.intellij.openapi.Disposable;
@@ -20,6 +19,7 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsListener;
import com.intellij.openapi.vcs.changes.ChangeListManager;
@@ -147,10 +147,8 @@ public class TodoView implements PersistentStateComponent<TodoView.State>, Dispo
Disposer.register(this, currentFileTodos);
currentFileTodosContent.setComponent(currentFileTodos);
myChangeListTodosContent = contentFactory
.createContent(null, IdeBundle.message("changelist.todo.title",
ChangeListManager.getInstance(myProject).getDefaultChangeList().getName()),
false);
String tabName = getTabNameForChangeList(ChangeListManager.getInstance(myProject).getDefaultChangeList().getName());
myChangeListTodosContent = contentFactory.createContent(null, tabName, false);
ChangeListTodosPanel changeListTodos = new ChangeListTodosPanel(myProject, state.current, myChangeListTodosContent) {
@Override
protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
@@ -237,6 +235,12 @@ public class TodoView implements PersistentStateComponent<TodoView.State>, Dispo
// CommonActionsManager.getInstance().createCollapseAllAction(proxyExpander, toolWindow.getComponent()));
}
@NotNull
static String getTabNameForChangeList(@NotNull String changelistName) {
String suffix = "Changelist";
return StringUtil.endsWithIgnoreCase(changelistName, suffix) ? changelistName : changelistName + " " + suffix;
}
@NotNull
protected AllTodosTreeBuilder createAllTodoBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
return new AllTodosTreeBuilder(tree, treeModel, project);
@@ -1146,7 +1146,6 @@ plugin.manager.incompatible.tooltip=Plugin is incompatible with current {0} inst
#new wizard components
project.new.wizard.project.identification=project
project.new.wizard.module.identification=module
changelist.todo.title={0} Changelist
hierarchy.scope.test=Test
file.structure.toggle.show.inherited=&Show inherited members