From f8f7a14ee5ef51fc05248615688082d64eb7f490 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Nov 2011 17:46:01 +0100 Subject: [PATCH] do not complete during inplace refactorings --- ...CompletionContributorForInplaceRename.java | 41 +++++++++++++++++++ .../src/META-INF/LangExtensions.xml | 1 + 2 files changed, 42 insertions(+) create mode 100644 platform/lang-impl/src/com/intellij/refactoring/rename/inplace/CompletionContributorForInplaceRename.java diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/CompletionContributorForInplaceRename.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/CompletionContributorForInplaceRename.java new file mode 100644 index 000000000000..1a6069b582a9 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/CompletionContributorForInplaceRename.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.refactoring.rename.inplace; + +import com.intellij.codeInsight.completion.CompletionContributor; +import com.intellij.codeInsight.completion.CompletionParameters; +import com.intellij.codeInsight.completion.CompletionResultSet; +import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.codeInsight.template.impl.TemplateState; +import com.intellij.openapi.editor.Editor; + +/** + * User: anna + * Date: 11/22/11 + */ +public class CompletionContributorForInplaceRename extends CompletionContributor { + + @Override + public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) { + final Editor editor = parameters.getLookup().getEditor(); + final TemplateState state = TemplateManagerImpl.getTemplateState(editor); + if (state != null) { + if (editor.getUserData(VariableInplaceRenamer.INPLACE_RENAMER) != null) { + result.stopHere(); + } + } + } +} diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index accdf885ecdd..903cfba08491 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -654,6 +654,7 @@ +