From 8d8ff57115e1ab2fa0cff54b6e25a5f579b4866a Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Fri, 4 Feb 2011 16:14:57 +0300 Subject: [PATCH] IDEA-37228 Live Template abbreviation is shown cutted if new name is longer then old one --- .../codeInsight/template/impl/TemplateListPanel.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java index 833576847ae6..dd2c4a4c40d4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java @@ -35,6 +35,7 @@ import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.Alarm; import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.tree.TreeUtil; import com.intellij.util.ui.update.UiNotifyConnector; import org.jetbrains.annotations.Nullable; @@ -494,6 +495,17 @@ class TemplateListPanel extends JPanel { myTree.setSelectionInterval(selected, selected); updateTemplateTextArea(); + + List expandedPaths = TreeUtil.collectExpandedPaths(myTree); + TreePath[] selectedPaths = myTree.getSelectionPaths(); + ((DefaultTreeModel)myTree.getModel()).nodeStructureChanged(myTreeRoot); + TreeUtil.restoreExpandedPaths(myTree, expandedPaths); + if (selectedPaths != null) { + myTree.setSelectionPaths(selectedPaths); + } + + myTree.validate(); + myTree.repaint(); } private Map getOptions(final TemplateImpl template) {