public interface FileModifier extends WriteActionAware
IntentionAction and LocalQuickFix share.| Modifier and Type | Method and Description |
|---|---|
default PsiElement |
getElementToMakeWritable(PsiFile currentFile)
Controls whether this intention/fix is going to modify the current file.
|
startInWriteActiondefault PsiElement getElementToMakeWritable(PsiFile currentFile)
@NotNull, and the current file is read-only,
it will be made writable (honoring version control integration) before the intention/fix is invoked.
By default, as a heuristic, returns the same as WriteActionAware.startInWriteAction().
If the action is going to modify multiple files, or the set of the files is unknown in advance, please
don't bother overriding this method, return false from WriteActionAware.startInWriteAction(), and call FileModificationService methods in the implementation, and take write actions yourself as needed.currentFile - the same file where intention would be invoked (for LocalQuickFix it would be the containing file of ProblemDescriptor.getPsiElement())