mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not init project inspection profile on updateProfile — it will be done in any case (was already discussed and confirmed, this part of code was not updated)
This commit is contained in:
+1
-4
@@ -16,13 +16,11 @@
|
||||
package com.intellij.codeInspection.util;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiModifierList;
|
||||
@@ -63,11 +61,10 @@ public class SpecialAnnotationsUtilBase {
|
||||
static void doQuickFixInternal(@NotNull Project project, @NotNull List<String> targetList, @NotNull String qualifiedName) {
|
||||
targetList.add(qualifiedName);
|
||||
Collections.sort(targetList);
|
||||
final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
//correct save settings
|
||||
|
||||
//TODO lesya
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
/*
|
||||
try {
|
||||
inspectionProfile.save();
|
||||
|
||||
@@ -6,13 +6,15 @@ package com.intellij.codeInspection.javaDoc;
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInsight.intention.impl.AddJavadocIntention;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
@@ -397,8 +399,7 @@ public class JavaDocLocalInspection extends JavaDocLocalInspectionBase {
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
myInspection.registerAdditionalTag(myTag);
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(profile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-4
@@ -24,11 +24,13 @@
|
||||
*/
|
||||
package org.jetbrains.lang.manifest.highlighting;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -184,8 +186,7 @@ public class MisspelledHeaderInspection extends LocalInspectionTool {
|
||||
public void invoke(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
|
||||
myHeaders.add(myHeaderName);
|
||||
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(profile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 15-Feb-2006
|
||||
@@ -39,10 +37,13 @@ public interface ModifiableModel extends InspectionProfile {
|
||||
|
||||
void setErrorLevel(HighlightDisplayKey key, @NotNull HighlightDisplayLevel level, Project project);
|
||||
|
||||
@Override
|
||||
HighlightDisplayLevel getErrorLevel(HighlightDisplayKey inspectionToolKey, PsiElement element);
|
||||
|
||||
@Override
|
||||
boolean isToolEnabled(HighlightDisplayKey key);
|
||||
|
||||
@Override
|
||||
boolean isToolEnabled(@Nullable HighlightDisplayKey key, @Nullable PsiElement element);
|
||||
|
||||
void commit();
|
||||
@@ -57,8 +58,10 @@ public interface ModifiableModel extends InspectionProfile {
|
||||
|
||||
void resetToEmpty(Project project);
|
||||
|
||||
@Override
|
||||
InspectionProfileEntry getUnwrappedTool(@NotNull String shortName, @NotNull PsiElement element);
|
||||
|
||||
@Override
|
||||
InspectionToolWrapper[] getInspectionTools(PsiElement element);
|
||||
|
||||
/**
|
||||
@@ -66,8 +69,6 @@ public interface ModifiableModel extends InspectionProfile {
|
||||
*/
|
||||
void setSingleTool(@NotNull String toolShortName);
|
||||
|
||||
void save() throws IOException;
|
||||
|
||||
boolean isProfileLocked();
|
||||
|
||||
void lockProfile(boolean isLocked);
|
||||
|
||||
+4
-4
@@ -458,10 +458,10 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(this);
|
||||
}
|
||||
//@Override
|
||||
//public void save() {
|
||||
// InspectionProfileManager.getInstance().fireProfileChanged(this);
|
||||
//}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
+2
-4
@@ -51,10 +51,8 @@ abstract class BaseInspectionProfileManager(messageBus: MessageBus) : Inspectio
|
||||
}
|
||||
}
|
||||
|
||||
override final fun fireProfileChanged(profile: InspectionProfile?) {
|
||||
if (profile is InspectionProfileImpl) {
|
||||
profile.profileChanged()
|
||||
}
|
||||
override final fun fireProfileChanged(profile: InspectionProfileImpl?) {
|
||||
profile?.profileChanged()
|
||||
for (adapter in profileListeners) {
|
||||
adapter.profileChanged(profile)
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public interface InspectionProfileManager {
|
||||
return InspectionProjectProfileManager.getInstance(project);
|
||||
}
|
||||
|
||||
void fireProfileChanged(@Nullable InspectionProfile profile);
|
||||
void fireProfileChanged(@Nullable InspectionProfileImpl profile);
|
||||
|
||||
void fireProfileChanged(@Nullable InspectionProfile oldProfile, @NotNull InspectionProfile profile);
|
||||
|
||||
|
||||
-6
@@ -161,12 +161,6 @@ class ProjectInspectionProfileManager(val project: Project,
|
||||
|
||||
fun isCurrentProfileInitialized() = currentProfile.wasInitialized()
|
||||
|
||||
@Synchronized override fun updateProfile(profile: InspectionProfileImpl) {
|
||||
super.updateProfile(profile)
|
||||
|
||||
profile.initInspectionTools(project)
|
||||
}
|
||||
|
||||
override fun schemeRemoved(scheme: InspectionProfile) {
|
||||
scheme.cleanup(project)
|
||||
}
|
||||
|
||||
+1
-12
@@ -93,6 +93,7 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
|
||||
return fileNameWithoutExtension;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public InspectionProfileImpl createScheme(@NotNull SchemeDataHolder<? super InspectionProfileImpl> dataHolder,
|
||||
@NotNull String name,
|
||||
@@ -203,18 +204,6 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
|
||||
return getProfile(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProfile(@NotNull InspectionProfileImpl profile) {
|
||||
super.updateProfile(profile);
|
||||
updateProfileImpl(profile);
|
||||
}
|
||||
|
||||
private static void updateProfileImpl(@NotNull InspectionProfileImpl profile) {
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
profile.initInspectionTools(project);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Element getState() {
|
||||
|
||||
+4
-4
@@ -1126,12 +1126,12 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
if (parentProfile.getProfileManager().getProfile(parentProfile.getName(), false) == parentProfile) {
|
||||
parentProfile.getProfileManager().deleteProfile(parentProfile.getName());
|
||||
}
|
||||
if (selectedProfile.getProfileManager() != profileManager) {
|
||||
copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
|
||||
selectedProfile.setProfileManager(profileManager);
|
||||
if (selectedProfile.getProfileManager() == profileManager) {
|
||||
profileManager.updateProfile(selectedProfile);
|
||||
}
|
||||
else {
|
||||
selectedProfile.getProfileManager().updateProfile(selectedProfile);
|
||||
copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
|
||||
selectedProfile.setProfileManager(profileManager);
|
||||
}
|
||||
|
||||
selectedProfile.commit();
|
||||
|
||||
+5
-8
@@ -15,12 +15,14 @@
|
||||
*/
|
||||
package com.siyeh.ig.maturity;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.RemoveAnnotationQuickFix;
|
||||
import com.intellij.codeInspection.SuppressionUtilCore;
|
||||
import com.intellij.codeInspection.ui.ListEditForm;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -98,12 +100,7 @@ public class SuppressionAnnotationInspection extends SuppressionAnnotationInspec
|
||||
myAllowedSuppressions.add(id);
|
||||
}
|
||||
}
|
||||
saveProfile(project);
|
||||
}
|
||||
|
||||
private void saveProfile(Project project) {
|
||||
final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+7
-4
@@ -22,7 +22,6 @@ import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.util.JDOMExternalizableStringList;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -65,16 +64,19 @@ public class DependsOnGroupsInspection extends BaseJavaLocalInspectionTool {
|
||||
return SHORT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JComponent createOptionsPanel() {
|
||||
final LabeledComponent<JTextField> definedGroups = new LabeledComponent<>();
|
||||
definedGroups.setText("&Defined Groups");
|
||||
final JTextField textField = new JTextField(StringUtil.join(ArrayUtil.toStringArray(groups), ","));
|
||||
textField.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(final DocumentEvent e) {
|
||||
groups.clear();
|
||||
String text = textField.getText();
|
||||
@@ -152,22 +154,23 @@ public class DependsOnGroupsInspection extends BaseJavaLocalInspectionTool {
|
||||
myGroupName = groupName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return "Add '" + myGroupName + "' as a defined test group.";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
return "TestNG";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor problemDescriptor) {
|
||||
groups.add(myGroupName);
|
||||
final InspectionProfile inspectionProfile =
|
||||
InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
//correct save settings
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
//TODO lesya
|
||||
/*
|
||||
try {
|
||||
|
||||
+1
-3
@@ -1,6 +1,5 @@
|
||||
package com.jetbrains.edu.coursecreator.actions;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.ide.IdeView;
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -71,8 +70,7 @@ public class CCChangeCourseInfo extends DumbAwareAction {
|
||||
course.setDescription(panel.getDescription());
|
||||
setVersion(course, panel);
|
||||
ProjectView.getInstance(project).refresh();
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(profile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProjectProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
package com.jetbrains.rest.quickfixes;
|
||||
|
||||
import com.intellij.codeInsight.intention.LowPriorityAction;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.jetbrains.rest.RestBundle;
|
||||
import com.jetbrains.rest.inspections.RestRoleInspection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -54,8 +52,7 @@ public class AddIgnoredRoleFix implements LocalQuickFix, LowPriorityAction {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
if (!myInspection.ignoredRoles.contains(myRole)) {
|
||||
myInspection.ignoredRoles.add(myRole);
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(profile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.codeInspection.ui.ListEditForm;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
@@ -50,8 +49,6 @@ import java.util.*;
|
||||
* @author vlan
|
||||
*/
|
||||
public class PyPackageRequirementsInspection extends PyInspection {
|
||||
private static final Logger LOG = Logger.getInstance(PyPackageRequirementsInspection.class);
|
||||
|
||||
public JDOMExternalizableStringList ignoredPackages = new JDOMExternalizableStringList();
|
||||
|
||||
@NotNull
|
||||
@@ -331,7 +328,7 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
|
||||
private void installRequirements(Project project, List<PyRequirement> requirements) {
|
||||
final PyPackageManagerUI ui = new PyPackageManagerUI(project, mySdk, new UIListener(myModule));
|
||||
ui.install(requirements, Collections.<String>emptyList());
|
||||
ui.install(requirements, Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,11 +350,13 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
mySdk = PythonSdkType.findPythonSdk(myModule);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
return "Install and import package " + myPackageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
|
||||
final PyPackageManagerUI ui = new PyPackageManagerUI(project, mySdk, new UIListener(myModule) {
|
||||
@Override
|
||||
@@ -375,7 +374,7 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.install(Collections.singletonList(new PyRequirement(myPackageName)), Collections.<String>emptyList());
|
||||
ui.install(Collections.singletonList(new PyRequirement(myPackageName)), Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,8 +426,7 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(profile);
|
||||
InspectionProfileManager.getInstance().fireProfileChanged(InspectionProfileManager.getInstance(project).getCurrentProfile());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -454,9 +452,7 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
PyPackageUtil.addRequirementToTxtOrSetupPy(myModule, myPackageName, myLanguageLevel);
|
||||
}), getName(), null);
|
||||
CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> PyPackageUtil.addRequirementToTxtOrSetupPy(myModule, myPackageName, myLanguageLevel)), getName(), null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user