use of com.intellij.profile.codeInspection.ProjectInspectionProfileManager in project intellij-community by JetBrains.
the class InspectionProfileTest method testSameNameSharedProfile.
public void testSameNameSharedProfile() throws Exception {
BaseInspectionProfileManager profileManager = getApplicationProfileManager();
InspectionProfileImpl localProfile = createProfile();
updateProfile(profileManager, localProfile);
ProjectInspectionProfileManager projectProfileManager = ProjectInspectionProfileManager.getInstance(getProject());
try {
//normally on open project profile wrappers are init for both managers
updateProfile(profileManager, localProfile);
InspectionProfileImpl profile = new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), projectProfileManager, null);
updateProfile(projectProfileManager, profile);
projectProfileManager.setRootProfile(profile.getName());
assertTrue(projectProfileManager.getCurrentProfile() == profile);
} finally {
projectProfileManager.deleteProfile(PROFILE);
}
}
use of com.intellij.profile.codeInspection.ProjectInspectionProfileManager in project intellij-community by JetBrains.
the class EditCleanupProfileIntentionAction method invoke.
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
final ProjectInspectionProfileManager profileManager = ProjectInspectionProfileManager.getInstance(project);
final ProjectInspectionToolsConfigurable configurable = new ProjectInspectionToolsConfigurable(profileManager) {
@Override
protected boolean acceptTool(InspectionToolWrapper entry) {
return super.acceptTool(entry) && entry.isCleanupTool();
}
@Override
public String getDisplayName() {
return CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
}
};
ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
}
use of com.intellij.profile.codeInspection.ProjectInspectionProfileManager in project intellij-community by JetBrains.
the class QuickChangeInspectionProfileAction method fillActions.
@Override
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
final ProjectInspectionProfileManager projectProfileManager = ProjectInspectionProfileManager.getInstance(project);
InspectionProfile current = projectProfileManager.getCurrentProfile();
for (InspectionProfile profile : projectProfileManager.getProfiles()) {
addScheme(group, projectProfileManager, current, profile);
}
}
use of com.intellij.profile.codeInspection.ProjectInspectionProfileManager in project intellij-community by JetBrains.
the class CodeInspectionAction method getAdditionalActionSettings.
@Override
protected JComponent getAdditionalActionSettings(@NotNull final Project project, final BaseAnalysisActionDialog dialog) {
final AdditionalPanel panel = new AdditionalPanel();
final InspectionManagerEx manager = (InspectionManagerEx) InspectionManager.getInstance(project);
final SchemesCombo<InspectionProfileImpl> profiles = (SchemesCombo<InspectionProfileImpl>) panel.myBrowseProfilesCombo.getComboBox();
final InspectionProfileManager profileManager = InspectionProfileManager.getInstance();
final ProjectInspectionProfileManager projectProfileManager = ProjectInspectionProfileManager.getInstance(project);
panel.myBrowseProfilesCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ExternalProfilesComboboxAwareInspectionToolsConfigurable errorConfigurable = createConfigurable(projectProfileManager, profiles);
final MySingleConfigurableEditor editor = new MySingleConfigurableEditor(project, errorConfigurable, manager);
if (editor.showAndGet()) {
reloadProfiles(profiles, profileManager, projectProfileManager, project);
if (errorConfigurable.mySelectedName != null) {
final InspectionProfileImpl profile = (errorConfigurable.mySelectedIsProjectProfile ? projectProfileManager : profileManager).getProfile(errorConfigurable.mySelectedName);
profiles.selectScheme(profile);
}
} else {
//if profile was disabled and cancel after apply was pressed
final InspectionProfile profile = profiles.getSelectedScheme();
final boolean canExecute = profile != null && profile.isExecutable(project);
dialog.setOKActionEnabled(canExecute);
}
}
});
profiles.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myExternalProfile = profiles.getSelectedScheme();
final boolean canExecute = myExternalProfile != null && myExternalProfile.isExecutable(project);
dialog.setOKActionEnabled(canExecute);
if (canExecute) {
PropertiesComponent.getInstance(project).setValue(LAST_SELECTED_PROFILE_PROP, (myExternalProfile.isProjectLevel() ? 'p' : 'a') + myExternalProfile.getName());
manager.setProfile(myExternalProfile.getName());
}
}
});
reloadProfiles(profiles, profileManager, projectProfileManager, project);
return panel.myAdditionalPanel;
}
use of com.intellij.profile.codeInspection.ProjectInspectionProfileManager in project intellij-community by JetBrains.
the class GlobalInspectionContextBase method getCurrentProfile.
public InspectionProfileImpl getCurrentProfile() {
if (myExternalProfile != null) {
return myExternalProfile;
}
String currentProfile = ((InspectionManagerBase) InspectionManager.getInstance(myProject)).getCurrentProfile();
ProjectInspectionProfileManager profileManager = ProjectInspectionProfileManager.getInstance(myProject);
InspectionProfileImpl profile = profileManager.getProfile(currentProfile, false);
if (profile == null) {
profile = InspectionProfileManager.getInstance().getProfile(currentProfile);
if (profile != null) {
return profile;
}
final String[] availableProfileNames = profileManager.getAvailableProfileNames();
if (availableProfileNames.length == 0) {
//can't be
return null;
}
profile = profileManager.getProfile(availableProfileNames[0], true);
}
return profile;
}
Aggregations