From cfb11fac51168f0a857a67d18b57d70515e2d42e Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Fri, 8 Nov 2013 17:37:24 +0400 Subject: [PATCH] cleanup --- .../actions/InjectionAwareEditorAction.java | 42 ------------------- .../hint/actions/NextParameterAction.java | 4 +- .../hint/actions/PrevParameterAction.java | 4 +- .../impl/actions/NextVariableAction.java | 4 +- .../impl/actions/PreviousVariableAction.java | 4 +- .../ExpandLiveTemplateByTabAction.java | 5 ++- 6 files changed, 13 insertions(+), 50 deletions(-) delete mode 100644 platform/lang-impl/src/com/intellij/codeInsight/hint/actions/InjectionAwareEditorAction.java diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/InjectionAwareEditorAction.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/InjectionAwareEditorAction.java deleted file mode 100644 index 45c7bf434098..000000000000 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/InjectionAwareEditorAction.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2013 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.codeInsight.hint.actions; - -import com.intellij.codeInsight.actions.BaseCodeInsightAction; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.actionSystem.EditorAction; -import com.intellij.openapi.editor.actionSystem.EditorActionHandler; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.Nullable; - -/** - * @author ignatov - */ -public class InjectionAwareEditorAction extends EditorAction { - protected InjectionAwareEditorAction(EditorActionHandler defaultHandler) { - super(defaultHandler); - } - - @Nullable - protected Editor getEditor(final DataContext dataContext) { - Editor editor = super.getEditor(dataContext); - Project project = CommonDataKeys.PROJECT.getData(dataContext); - Editor injected = project == null ? null : BaseCodeInsightAction.getInjectedEditor(project, editor); - return injected == null ? editor : injected; - } -} diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/NextParameterAction.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/NextParameterAction.java index 407e169ed4b9..9bf90de5a958 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/NextParameterAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/NextParameterAction.java @@ -17,12 +17,14 @@ package com.intellij.codeInsight.hint.actions; import com.intellij.codeInsight.hint.PrevNextParameterHandler; +import com.intellij.openapi.editor.actionSystem.EditorAction; /** * @author ven */ -public class NextParameterAction extends InjectionAwareEditorAction { +public class NextParameterAction extends EditorAction { public NextParameterAction() { super(new PrevNextParameterHandler(true)); + setInjectedContext(true); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/PrevParameterAction.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/PrevParameterAction.java index 5c4647731609..ec8f8b916273 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/PrevParameterAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/PrevParameterAction.java @@ -17,12 +17,14 @@ package com.intellij.codeInsight.hint.actions; import com.intellij.codeInsight.hint.PrevNextParameterHandler; +import com.intellij.openapi.editor.actionSystem.EditorAction; /** * @author ven */ -public class PrevParameterAction extends InjectionAwareEditorAction { +public class PrevParameterAction extends EditorAction { public PrevParameterAction() { super(new PrevNextParameterHandler(false)); + setInjectedContext(true); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/NextVariableAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/NextVariableAction.java index 697686bcc0df..6605dacbc209 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/NextVariableAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/NextVariableAction.java @@ -25,16 +25,16 @@ package com.intellij.codeInsight.template.impl.actions; import com.intellij.codeInsight.CodeInsightBundle; -import com.intellij.codeInsight.hint.actions.InjectionAwareEditorAction; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateState; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; -public class NextVariableAction extends InjectionAwareEditorAction { +public class NextVariableAction extends EditorAction { public NextVariableAction() { super(new Handler()); setInjectedContext(true); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/PreviousVariableAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/PreviousVariableAction.java index adedfef9bbc5..bbb1f6a2bdf7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/PreviousVariableAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/actions/PreviousVariableAction.java @@ -25,16 +25,16 @@ package com.intellij.codeInsight.template.impl.actions; import com.intellij.codeInsight.CodeInsightBundle; -import com.intellij.codeInsight.hint.actions.InjectionAwareEditorAction; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateState; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; -public class PreviousVariableAction extends InjectionAwareEditorAction { +public class PreviousVariableAction extends EditorAction { public PreviousVariableAction() { super(new Handler()); setInjectedContext(true); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java index 876fe5d9e7af..67aca8ebfc1f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java @@ -15,19 +15,19 @@ */ package com.intellij.codeInsight.template.impl.editorActions; -import com.intellij.codeInsight.hint.actions.InjectionAwareEditorAction; import com.intellij.codeInsight.template.TemplateManager; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateSettings; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; import com.intellij.openapi.project.Project; /** * @author peter */ -public class ExpandLiveTemplateByTabAction extends InjectionAwareEditorAction { +public class ExpandLiveTemplateByTabAction extends EditorAction { public ExpandLiveTemplateByTabAction() { super(new EditorWriteActionHandler() { @Override @@ -43,5 +43,6 @@ public class ExpandLiveTemplateByTabAction extends InjectionAwareEditorAction { ((TemplateManagerImpl)TemplateManager.getInstance(project)).prepareTemplate(editor, TemplateSettings.TAB_CHAR, null) != null; } }); + setInjectedContext(true); } }