mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-62880: auto-popup re-enabled in Open Task dialog
This commit is contained in:
@@ -92,7 +92,7 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
mySelectedTask = task;
|
||||
taskChanged();
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
myTaskName.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TaskChangelistSupport implements EditChangelistSupport {
|
||||
|
||||
public void installSearch(EditorTextField name, final EditorTextField comment) {
|
||||
Document document = name.getDocument();
|
||||
TaskCompletionContributor.installCompletion(document, myProject, null);
|
||||
TaskCompletionContributor.installCompletion(document, myProject, null, false);
|
||||
}
|
||||
|
||||
public Consumer<LocalChangeList> addControls(JPanel bottomPanel, LocalChangeList initial) {
|
||||
|
||||
@@ -28,16 +28,18 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class TaskCompletionContributor extends CompletionContributor {
|
||||
|
||||
public static void installCompletion(Document document, Project project, Consumer<Task> consumer) {
|
||||
private static final Key<Consumer<Task>> KEY = Key.create("task completion available");
|
||||
private static final Key<Boolean> AUTO_POPUP_KEY = Key.create("task completion auto-popup");
|
||||
|
||||
public static void installCompletion(Document document, Project project, Consumer<Task> consumer, boolean autoPopup) {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile != null) {
|
||||
//noinspection unchecked
|
||||
psiFile.putUserData(KEY, consumer == null ? (Consumer<Task>)Consumer.EMPTY_CONSUMER : consumer);
|
||||
psiFile.putUserData(AUTO_POPUP_KEY, autoPopup);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Key<Consumer<Task>> KEY = Key.create("task completion available");
|
||||
|
||||
@Override
|
||||
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
|
||||
PsiFile file = parameters.getOriginalFile();
|
||||
@@ -48,7 +50,7 @@ public class TaskCompletionContributor extends CompletionContributor {
|
||||
String text = parameters.getOriginalFile().getText();
|
||||
int i = text.lastIndexOf(' ', parameters.getOffset() - 1) + 1;
|
||||
final String prefix = text.substring(i, parameters.getOffset());
|
||||
if (parameters.getInvocationCount() == 0) { // is autopopup
|
||||
if (parameters.getInvocationCount() == 0 && !file.getUserData(AUTO_POPUP_KEY)) { // is autopopup
|
||||
return;
|
||||
}
|
||||
result = result.withPrefixMatcher(new PlainPrefixMatcher(prefix));
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.tasks.impl.TaskCompletionContributor;
|
||||
import com.intellij.tasks.impl.TaskManagerImpl;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.Consumer;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -31,12 +30,7 @@ public class TaskCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
private void doTest(String text, String after) {
|
||||
PsiFile psiFile = myFixture.configureByText("test.txt", text);
|
||||
TaskCompletionContributor.installCompletion(myFixture.getDocument(psiFile), getProject(), new Consumer<Task>() {
|
||||
@Override
|
||||
public void consume(Task task) {
|
||||
|
||||
}
|
||||
});
|
||||
TaskCompletionContributor.installCompletion(myFixture.getDocument(psiFile), getProject(), null, false);
|
||||
TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(getProject());
|
||||
manager.setRepositories(Arrays.asList(new TestRepository()));
|
||||
manager.getState().updateEnabled = false;
|
||||
|
||||
Reference in New Issue
Block a user