From 8900f469e1ca86a6935b8924a54d95c28d174d0a Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Tue, 21 Jun 2016 13:45:53 +0300 Subject: [PATCH] [vcs]: provide full completion for move to another changelist panel including combobox model and tasks from task plugin --- .../completion/ComboEditorCompletionContributor.java | 7 ++++++- .../vcs/changes/ui/ChangeListChooserPanel.java | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/ComboEditorCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/ComboEditorCompletionContributor.java index 59159a84a440..0246e779a10a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/ComboEditorCompletionContributor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/ComboEditorCompletionContributor.java @@ -18,6 +18,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.openapi.editor.Document; +import com.intellij.openapi.util.Key; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.ui.StringComboboxEditor; @@ -30,6 +31,8 @@ import javax.swing.*; */ public class ComboEditorCompletionContributor extends CompletionContributor{ + public static final Key CONTINUE_RUN_COMPLETION = Key.create("CONTINUE_RUN_COMPLETION"); + @Override public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) { if (parameters.getInvocationCount() == 0) { @@ -60,7 +63,9 @@ public class ComboEditorCompletionContributor extends CompletionContributor{ }), count-i)); } } - result.stopHere(); + if (!Boolean.TRUE.equals(document.getUserData(CONTINUE_RUN_COMPLETION))) { + result.stopHere(); + } } } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListChooserPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListChooserPanel.java index 11b9be18052e..bf679b26b99c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListChooserPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListChooserPanel.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.vcs.changes.ui; +import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ComboBox; @@ -37,6 +38,8 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import static com.intellij.codeInsight.completion.ComboEditorCompletionContributor.CONTINUE_RUN_COMPLETION; + public class ChangeListChooserPanel extends JPanel { private final MyEditorComboBox myExistingListsCombo; @@ -185,7 +188,13 @@ public class ChangeListChooserPanel extends JPanel { public MyEditorComboBox(Project project) { super(); - setEditor(new StringComboboxEditor(project, FileTypes.PLAIN_TEXT, this)); + setEditor(new StringComboboxEditor(project, FileTypes.PLAIN_TEXT, this) { + @Override + protected void onEditorCreate(EditorEx editor) { + super.onEditorCreate(editor); + getDocument().putUserData(CONTINUE_RUN_COMPLETION, true); + } + }); } @NotNull