write access for elements which probably differ from the current file

This commit is contained in:
Anna.Kozlova
2016-11-28 11:47:06 +01:00
parent a9d9485b9a
commit 01bf7bfecd
38 changed files with 241 additions and 105 deletions
@@ -24,6 +24,7 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNameIdentifierOwner;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.LocalSearchScope;
@@ -99,9 +100,10 @@ public class PyRenameElementQuickFix implements LocalQuickFix {
return false;
}
@Nullable
@Override
public boolean shouldMakeCurrentFileWritable() {
return true;
public PsiElement getElementToMakeWritable(@NotNull PsiFile file) {
return file;
}
private static void renameInUnitTestMode(@NotNull Project project, @NotNull PsiNameIdentifierOwner nameOwner,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -53,11 +53,6 @@ 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;