mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
requestWriting method
This commit is contained in:
@@ -32,10 +32,8 @@ public class GenerateDelegateHandler implements CodeInsightActionHandler {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.GenerateDelegateHandler");
|
||||
|
||||
public void invoke(final Project project, final Editor editor, final PsiFile file) {
|
||||
if (!file.isWritable()) {
|
||||
if (!FileDocumentManager.fileForDocumentCheckedOutSuccessfully(editor.getDocument(), project)){
|
||||
return;
|
||||
}
|
||||
if (!file.isWritable() && !FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
|
||||
return;
|
||||
}
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
|
||||
|
||||
+2
-4
@@ -44,10 +44,8 @@ public abstract class GenerateMembersHandlerBase implements CodeInsightActionHan
|
||||
}
|
||||
|
||||
public final void invoke(final Project project, final Editor editor, PsiFile file) {
|
||||
if (!file.isWritable()){
|
||||
if (!FileDocumentManager.fileForDocumentCheckedOutSuccessfully(editor.getDocument(), project)){
|
||||
return;
|
||||
}
|
||||
if (!file.isWritable() && !FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, false);
|
||||
if (aClass == null || aClass.isInterface()) return; //?
|
||||
|
||||
+3
-5
@@ -100,11 +100,9 @@ public class ImplementAbstractMethodHandler {
|
||||
|
||||
private void implementInClass(final PsiClass psiClass) {
|
||||
if (!psiClass.isValid()) return;
|
||||
if (!psiClass.isWritable()) {
|
||||
if (!FileDocumentManager.fileForDocumentCheckedOutSuccessfully(PsiDocumentManager.getInstance(myProject).getDocument(psiClass.getContainingFile()), myProject)){
|
||||
MessagesEx.fileIsReadOnly(myProject, psiClass.getContainingFile().getVirtualFile()).showNow();
|
||||
return;
|
||||
}
|
||||
if (!psiClass.isWritable() && !FileDocumentManager.getInstance().requestWriting(PsiDocumentManager.getInstance(myProject).getDocument(psiClass.getContainingFile()), myProject)) {
|
||||
MessagesEx.fileIsReadOnly(myProject, psiClass.getContainingFile().getVirtualFile()).showNow();
|
||||
return;
|
||||
}
|
||||
|
||||
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user