From 155212625a3880e4b59fc4b5d4de095e353c3098 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Fri, 18 Dec 2020 19:47:01 +0100 Subject: [PATCH] resource bundles: remove redundant handler (IDEA-258166) no need to unexpectedly select first file in a bundle during rename, automatic renamer would suggest to rename them all anyway GitOrigin-RevId: 85a52f48d157f0ef8c498c2743f1d213055be82c --- plugins/properties/src/META-INF/plugin.xml | 1 - ...rceBundleFromProjectViewRenameHandler.java | 46 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromProjectViewRenameHandler.java diff --git a/plugins/properties/src/META-INF/plugin.xml b/plugins/properties/src/META-INF/plugin.xml index ea9cfb02c9ee..c4a75b8b89a3 100644 --- a/plugins/properties/src/META-INF/plugin.xml +++ b/plugins/properties/src/META-INF/plugin.xml @@ -56,7 +56,6 @@ - diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromProjectViewRenameHandler.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromProjectViewRenameHandler.java deleted file mode 100644 index f55e9d9c912b..000000000000 --- a/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromProjectViewRenameHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.lang.properties.refactoring.rename; - -import com.intellij.lang.properties.ResourceBundle; -import com.intellij.lang.properties.editor.ResourceBundleUtil; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.project.Project; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import com.intellij.refactoring.RefactoringActionHandlerFactory; -import com.intellij.refactoring.rename.RenameHandler; -import org.jetbrains.annotations.NotNull; - -/** - * @author Dmitry Batkovich - */ -public class ResourceBundleFromProjectViewRenameHandler implements RenameHandler { - - @Override - public boolean isAvailableOnDataContext(@NotNull DataContext dataContext) { - final Project project = CommonDataKeys.PROJECT.getData(dataContext); - if (project == null) { - return false; - } - final ResourceBundle bundle = ResourceBundleUtil.getResourceBundleFromDataContext(dataContext); - if (bundle == null || bundle.getPropertiesFiles().size() < 2) { - return false; - } - return PlatformDataKeys.FILE_EDITOR.getData(dataContext) == null; - } - - @Override - public void invoke(final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) { - final ResourceBundle resourceBundle = ResourceBundleUtil.getResourceBundleFromDataContext(dataContext); - assert resourceBundle != null; - RefactoringActionHandlerFactory.getInstance().createRenameHandler().invoke(project, new PsiElement[] {resourceBundle.getDefaultPropertiesFile().getContainingFile()}, dataContext); - } - - @Override - public void invoke(@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { - invoke(project, null, null, dataContext); - } -}