mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java & platform: write action is unnecessary in some quick fixes
This commit is contained in:
+5
@@ -162,6 +162,11 @@ public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool
|
||||
return "Remove dependency";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
|
||||
final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
|
||||
|
||||
+5
-1
@@ -39,7 +39,6 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -131,6 +130,11 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool {
|
||||
myFiles = files;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
|
||||
+5
@@ -90,6 +90,11 @@ public class DefaultFileTemplateUsageInspection extends BaseJavaLocalInspectionT
|
||||
return InspectionsBundle.message("default.file.template.edit.template");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
|
||||
final FileTemplateConfigurable configurable = new FileTemplateConfigurable(project);
|
||||
|
||||
+5
@@ -79,6 +79,11 @@ public class DependencyInspection extends DependencyInspectionBase {
|
||||
return InspectionsBundle.message("edit.dependency.rules.family");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
ShowSettingsUtil.getInstance().editConfigurable(project, new DependencyConfigurable(project));
|
||||
|
||||
+5
@@ -45,6 +45,11 @@ public class ProblematicWhitespaceInspection extends LocalInspectionTool {
|
||||
return InspectionsBundle.message("problematic.whitespace.show.whitespaces.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(project);
|
||||
|
||||
+5
@@ -126,6 +126,11 @@ public class EmptyDirectoryInspection extends BaseGlobalInspection {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
+5
-2
@@ -23,7 +23,6 @@ import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -33,7 +32,6 @@ import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.ui.AnActionButtonRunnable;
|
||||
import com.intellij.ui.ToolbarDecorator;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jdom.Element;
|
||||
@@ -146,6 +144,11 @@ public class SuspiciousLocalesLanguagesInspection extends BaseLocalInspectionToo
|
||||
return PropertiesBundle.message("dissociate.resource.bundle.quick.fix.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
DissociateResourceBundleAction.dissociate(Collections.singleton(myResourceBundle), project);
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.ex.BaseLocalInspectionTool;
|
||||
import com.intellij.ide.util.TreeClassChooser;
|
||||
import com.intellij.ide.util.TreeClassChooserFactory;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -438,15 +437,17 @@ public class I18nInspection extends BaseLocalInspectionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
|
||||
//do it later because it is invoked from write action
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
PsiElement element = descriptor.getPsiElement();
|
||||
if (!(element instanceof PsiExpression)) return;
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiExpression[] expressions = {(PsiExpression)element};
|
||||
new IntroduceConstantHandler().invoke(project, expressions);
|
||||
}, project.getDisposed());
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
|
||||
PsiElement element = descriptor.getPsiElement();
|
||||
if (!(element instanceof PsiExpression)) return;
|
||||
|
||||
PsiExpression[] expressions = {(PsiExpression)element};
|
||||
new IntroduceConstantHandler().invoke(project, expressions);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ public class AcceptWordAsCorrect implements SpellCheckerQuickFix {
|
||||
return Anchor.LAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
SpellCheckerManager spellCheckerManager = SpellCheckerManager.getInstance(project);
|
||||
if (myWord != null) {
|
||||
|
||||
Reference in New Issue
Block a user