From 53df3e657c4796a1ed5e39cf86ba65125c8be436 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 23 Nov 2016 15:55:14 +0100 Subject: [PATCH] make file writable in python rename quick fixes --- .../inspections/quickfix/PyRenameElementQuickFix.java | 5 +++++ .../inspections/quickfix/RenameParameterQuickFix.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/inspections/quickfix/PyRenameElementQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/PyRenameElementQuickFix.java index 02a760247f67..83f2d15049ab 100644 --- a/python/src/com/jetbrains/python/inspections/quickfix/PyRenameElementQuickFix.java +++ b/python/src/com/jetbrains/python/inspections/quickfix/PyRenameElementQuickFix.java @@ -99,6 +99,11 @@ public class PyRenameElementQuickFix implements LocalQuickFix { return false; } + @Override + public boolean shouldMakeCurrentFileWritable() { + return true; + } + private static void renameInUnitTestMode(@NotNull Project project, @NotNull PsiNameIdentifierOwner nameOwner, @Nullable Editor editor) { final PsiElement substitution = RenamePsiElementProcessor.forElement(nameOwner).substituteElementToRename(nameOwner, editor); diff --git a/python/src/com/jetbrains/python/inspections/quickfix/RenameParameterQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/RenameParameterQuickFix.java index 7869568c6203..b19febf369db 100644 --- a/python/src/com/jetbrains/python/inspections/quickfix/RenameParameterQuickFix.java +++ b/python/src/com/jetbrains/python/inspections/quickfix/RenameParameterQuickFix.java @@ -38,7 +38,7 @@ public class RenameParameterQuickFix implements LocalQuickFix { public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { final PsiElement elt = descriptor.getPsiElement(); - if (elt != null && elt instanceof PyNamedParameter && elt.isWritable()) { + if (elt != null && elt instanceof PyNamedParameter) { new RenameProcessor(project, elt, myNewName, false, true).run(); } } @@ -53,6 +53,11 @@ public class RenameParameterQuickFix implements LocalQuickFix { return PyBundle.message("QFIX.rename.parameter.to.$0", myNewName); } + @Override + public boolean shouldMakeCurrentFileWritable() { + return true; + } + @Override public boolean startInWriteAction() { return false;