本文整理汇总了Java中com.intellij.profile.codeInspection.InspectionProjectProfileManager类的典型用法代码示例。如果您正苦于以下问题:Java InspectionProjectProfileManager类的具体用法?Java InspectionProjectProfileManager怎么用?Java InspectionProjectProfileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InspectionProjectProfileManager类属于com.intellij.profile.codeInspection包,在下文中一共展示了InspectionProjectProfileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyFix
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
if (myTag == null) return;
if (!myAdditionalJavadocTags.isEmpty()) {
myAdditionalJavadocTags += "," + myTag;
}
else {
myAdditionalJavadocTags = myTag;
}
final InspectionProfile inspectionProfile =
InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
//correct save settings
InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
//TODO lesya
/*
try {
inspectionProfile.save();
}
catch (IOException e) {
Messages.showErrorDialog(project, e.getMessage(), CommonBundle.getErrorTitle());
}
*/
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:JavaDocLocalInspectionBase.java
示例2: doQuickFixInternal
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
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).getInspectionProfile();
//correct save settings
//TODO lesya
InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
/*
try {
inspectionProfile.save();
}
catch (IOException e) {
Messages.showErrorDialog(project, e.getMessage(), CommonBundle.getErrorTitle());
}
*/
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SpecialAnnotationsUtilBase.java
示例3: registerFixesForUnusedParameter
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void registerFixesForUnusedParameter(@NotNull PsiParameter parameter, @NotNull Object highlightInfo) {
Project myProject = parameter.getProject();
InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
UnusedParametersInspection unusedParametersInspection =
(UnusedParametersInspection)profile.getUnwrappedTool(UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME, parameter);
LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || unusedParametersInspection != null);
List<IntentionAction> options = new ArrayList<IntentionAction>();
HighlightDisplayKey myUnusedSymbolKey = HighlightDisplayKey.find(UnusedSymbolLocalInspectionBase.SHORT_NAME);
options.addAll(IntentionManager.getInstance().getStandardIntentionOptions(myUnusedSymbolKey, parameter));
if (unusedParametersInspection != null) {
SuppressQuickFix[] batchSuppressActions = unusedParametersInspection.getBatchSuppressActions(parameter);
Collections.addAll(options, SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions));
}
//need suppress from Unused Parameters but settings from Unused Symbol
QuickFixAction.registerQuickFixAction((HighlightInfo)highlightInfo, new SafeDeleteFix(parameter),
options, HighlightDisplayKey.getDisplayNameByKey(myUnusedSymbolKey));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:QuickFixFactoryImpl.java
示例4: doTest
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
private static void doTest(final String dirName) throws Exception {
InspectionProfileImpl.INIT_INSPECTIONS = true;
try {
final String relativePath = "/inspection/converter/";
final File projectFile = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.ipr");
for (Element element : JDOMUtil.loadDocument(projectFile).getRootElement().getChildren("component")) {
if (Comparing.strEqual(element.getAttributeValue("name"), "InspectionProjectProfileManager")) {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(getProject());
profileManager.loadState(element);
Element configElement = profileManager.getState();
final File file = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.after.xml");
PlatformTestUtil.assertElementsEqual(JDOMUtil.loadDocument(file).getRootElement(), configElement);
break;
}
}
}
finally {
InspectionProfileImpl.INIT_INSPECTIONS = false;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InspectionProfilesConverterTest.java
示例5: testPreserveCompatibility
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public void testPreserveCompatibility() throws Exception {
InspectionProfileImpl foo = new InspectionProfileImpl("foo", InspectionToolRegistrar.getInstance(), InspectionProjectProfileManager.getInstance(getProject()));
String test = "<profile version=\"1.0\" is_locked=\"false\">\n" +
" <option name=\"myName\" value=\"idea.default\" />\n" +
" <option name=\"myLocal\" value=\"false\" />\n" +
" <inspection_tool class=\"AbstractMethodCallInConstructor\" enabled=\"true\" level=\"WARNING\" enabled_by_default=\"true\" />\n" +
" <inspection_tool class=\"AssignmentToForLoopParameter\" enabled=\"true\" level=\"WARNING\" enabled_by_default=\"true\">\n" +
" <option name=\"m_checkForeachParameters\" value=\"false\" />\n" +
" </inspection_tool>\n" +
"</profile>";
foo.readExternal(JDOMUtil.loadDocument(test).getRootElement());
foo.initInspectionTools(getProject());
Element serialized = new Element("profile");
foo.writeExternal(serialized);
assertEquals(test, JDOMUtil.writeElement(serialized));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InspectionProfileTest.java
示例6: testSettingsModification
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public void testSettingsModification() throws Exception {
Project project = ProjectManager.getInstance().getDefaultProject();
InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE);
profile.initInspectionTools(project);
InspectionProfileImpl model = (InspectionProfileImpl)profile.getModifiableModel();
SingleInspectionProfilePanel panel = new SingleInspectionProfilePanel(profileManager, PROFILE, model, profile);
panel.setVisible(true);
panel.reset();
JavaDocLocalInspection tool = getInspection(model);
assertEquals("", tool.myAdditionalJavadocTags);
tool.myAdditionalJavadocTags = "foo";
model.setModified(true);
panel.apply();
assertEquals(1, InspectionProfileTest.countInitializedTools(model));
assertEquals("foo", getInspection(profile).myAdditionalJavadocTags);
panel.disposeUI();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SingleInspectionProfilePanelTest.java
示例7: testModifyInstantiatedTool
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public void testModifyInstantiatedTool() throws Exception {
Project project = ProjectManager.getInstance().getDefaultProject();
InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE);
profile.initInspectionTools(project);
JavaDocLocalInspection originalTool = getInspection(profile);
originalTool.myAdditionalJavadocTags = "foo";
InspectionProfileImpl model = (InspectionProfileImpl)profile.getModifiableModel();
SingleInspectionProfilePanel panel = new SingleInspectionProfilePanel(profileManager, PROFILE, model, profile);
panel.setVisible(true);
panel.reset();
assertEquals(InspectionProfileTest.getInitializedTools(model).toString(), 1, InspectionProfileTest.countInitializedTools(model));
JavaDocLocalInspection copyTool = getInspection(model);
copyTool.myAdditionalJavadocTags = "bar";
model.setModified(true);
panel.apply();
assertEquals(1, InspectionProfileTest.countInitializedTools(model));
assertEquals("bar", getInspection(profile).myAdditionalJavadocTags);
panel.disposeUI();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SingleInspectionProfilePanelTest.java
示例8: testDoNotChangeSettingsOnCancel
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public void testDoNotChangeSettingsOnCancel() throws Exception {
Project project = ProjectManager.getInstance().getDefaultProject();
InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE);
profile.initInspectionTools(project);
JavaDocLocalInspection originalTool = getInspection(profile);
assertEquals("", originalTool.myAdditionalJavadocTags);
InspectionProfileImpl model = (InspectionProfileImpl)profile.getModifiableModel();
JavaDocLocalInspection copyTool = getInspection(model);
copyTool.myAdditionalJavadocTags = "foo";
// this change IS NOT COMMITTED
assertEquals("", getInspection(profile).myAdditionalJavadocTags);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SingleInspectionProfilePanelTest.java
示例9: findTool2RunInBatch
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public static InspectionToolWrapper findTool2RunInBatch(@NotNull Project project, @Nullable PsiElement element, @NotNull String name) {
final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final InspectionToolWrapper toolWrapper = element == null
? inspectionProfile.getInspectionTool(name, project)
: inspectionProfile.getInspectionTool(name, element);
if (toolWrapper instanceof LocalInspectionToolWrapper && ((LocalInspectionToolWrapper)toolWrapper).isUnfair()) {
final LocalInspectionTool inspectionTool = ((LocalInspectionToolWrapper)toolWrapper).getTool();
if (inspectionTool instanceof PairedUnfairLocalInspectionTool) {
final String oppositeShortName = ((PairedUnfairLocalInspectionTool)inspectionTool).getInspectionForBatchShortName();
return element == null
? inspectionProfile.getInspectionTool(oppositeShortName, project)
: inspectionProfile.getInspectionTool(oppositeShortName, element);
}
return null;
}
return toolWrapper;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LocalInspectionToolWrapper.java
示例10: getCurrentProfile
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public InspectionProfile getCurrentProfile() {
if (myExternalProfile != null) return myExternalProfile;
InspectionManagerBase managerEx = (InspectionManagerBase)InspectionManager.getInstance(myProject);
String currentProfile = managerEx.getCurrentProfile();
final InspectionProjectProfileManager inspectionProfileManager = InspectionProjectProfileManager.getInstance(myProject);
Profile profile = inspectionProfileManager.getProfile(currentProfile, false);
if (profile == null) {
profile = InspectionProfileManager.getInstance().getProfile(currentProfile);
if (profile != null) return (InspectionProfile)profile;
final String[] availableProfileNames = inspectionProfileManager.getAvailableProfileNames();
if (availableProfileNames.length == 0) {
//can't be
return null;
}
profile = inspectionProfileManager.getProfile(availableProfileNames[0]);
}
return (InspectionProfile)profile;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GlobalInspectionContextBase.java
示例11: enableInspectionTool
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
public static void enableInspectionTool(@NotNull final Project project, @NotNull final InspectionToolWrapper toolWrapper) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final String shortName = toolWrapper.getShortName();
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null) {
HighlightDisplayKey.register(shortName, toolWrapper.getDisplayName(), toolWrapper.getID());
}
InspectionProfileImpl.initAndDo(new Computable() {
@Override
public Object compute() {
InspectionProfileImpl impl = (InspectionProfileImpl)profile;
InspectionToolWrapper existingWrapper = impl.getInspectionTool(shortName, project);
if (existingWrapper == null || existingWrapper.isInitialized() != toolWrapper.isInitialized() || toolWrapper.isInitialized() && toolWrapper.getTool() != existingWrapper.getTool()) {
impl.addTool(project, toolWrapper, new THashMap<String, List<String>>());
}
impl.enableTool(shortName, project);
return null;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LightPlatformTestCase.java
示例12: loadProfileByName
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Nullable
private Profile loadProfileByName(final String profileName) {
Profile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getProfile(profileName, false);
if (inspectionProfile != null) {
logMessageLn(1, "Loaded shared project profile \'" + profileName + "\'");
}
else {
//check if ide profile is used for project
final Collection<Profile> profiles = InspectionProjectProfileManager.getInstance(myProject).getProfiles();
for (Profile profile : profiles) {
if (Comparing.strEqual(profile.getName(), profileName)) {
inspectionProfile = profile;
logMessageLn(1, "Loaded local profile \'" + profileName + "\'");
break;
}
}
}
return inspectionProfile;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:InspectionApplication.java
示例13: getSeverity
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
protected HighlightSeverity getSeverity(@NotNull RefElement element) {
final PsiElement psiElement = element.getPointer().getContainingFile();
if (psiElement != null) {
final GlobalInspectionContextImpl context = getContext();
final String shortName = getSeverityDelegateName();
final Tools tools = context.getTools().get(shortName);
if (tools != null) {
for (ScopeToolState state : tools.getTools()) {
InspectionToolWrapper toolWrapper = state.getTool();
if (toolWrapper == getToolWrapper()) {
return context.getCurrentProfile().getErrorLevel(HighlightDisplayKey.find(shortName), psiElement).getSeverity();
}
}
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
final HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(shortName), psiElement);
return level.getSeverity();
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DefaultInspectionToolPresentation.java
示例14: guessProfileToSelect
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
private InspectionProfile guessProfileToSelect(final InspectionProjectProfileManager profileManager) {
final Set<InspectionProfile> profiles = new HashSet<InspectionProfile>();
final RefEntity[] selectedElements = myTree.getSelectedElements();
for (RefEntity selectedElement : selectedElements) {
if (selectedElement instanceof RefElement) {
final RefElement refElement = (RefElement)selectedElement;
final PsiElement element = refElement.getElement();
if (element != null) {
profiles.add(profileManager.getInspectionProfile());
}
}
}
if (profiles.isEmpty()) {
return (InspectionProfile)profileManager.getProjectProfileImpl();
}
return profiles.iterator().next();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:InspectionResultsView.java
示例15: actionPerformed
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(myProject);
final InspectionToolWrapper toolWrapper = myTree.getSelectedToolWrapper();
InspectionProfile inspectionProfile = myInspectionProfile;
final boolean profileIsDefined = isProfileDefined();
if (!profileIsDefined) {
inspectionProfile = guessProfileToSelect(profileManager);
}
if (toolWrapper != null) {
final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName()); //do not search for dead code entry point tool
if (key != null){
if (new EditInspectionToolsSettingsAction(key).editToolSettings(myProject, (InspectionProfileImpl)inspectionProfile, profileIsDefined)
&& profileIsDefined){
updateCurrentProfile();
}
return;
}
}
if (EditInspectionToolsSettingsAction.editToolSettings(myProject, inspectionProfile, profileIsDefined, null) && profileIsDefined) {
updateCurrentProfile();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InspectionResultsView.java
示例16: invoke
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
final ProjectInspectionToolsConfigurable configurable =
new ProjectInspectionToolsConfigurable(InspectionProfileManager.getInstance(), 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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditCleanupProfileIntentionAction.java
示例17: applyFix
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final PsiElement element = descriptor.getPsiElement();
if (element != null) {
final PyPackageRequirementsInspection inspection = getInstance(element);
if (inspection != null) {
final JDOMExternalizableStringList ignoredPackages = inspection.ignoredPackages;
boolean changed = false;
for (String name : myPackageNames) {
if (!ignoredPackages.contains(name)) {
ignoredPackages.add(name);
changed = true;
}
}
if (changed) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
InspectionProfileManager.getInstance().fireProfileChanged(profile);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PyPackageRequirementsInspection.java
示例18: applyFix
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final PsiElement element = descriptor.getPsiElement();
if (element != null) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
profile.modifyProfile(new Consumer<ModifiableModel>() {
@Override
public void consume(ModifiableModel model) {
final String toolName = PyShadowingBuiltinsInspection.class.getSimpleName();
final PyShadowingBuiltinsInspection inspection = (PyShadowingBuiltinsInspection)model.getUnwrappedTool(toolName, element);
if (inspection != null) {
if (!inspection.ignoredNames.contains(myName)) {
inspection.ignoredNames.add(myName);
}
}
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PyShadowingBuiltinsInspection.java
示例19: getHighlighLevelAndInspection
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@Nullable
public static Pair<AndroidLintInspectionBase, HighlightDisplayLevel> getHighlighLevelAndInspection(@NotNull Project project,
@NotNull Issue issue,
@NotNull PsiElement context) {
final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
if (inspectionShortName == null) {
return null;
}
final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
if (key == null) {
return null;
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
if (!profile.isToolEnabled(key, context)) {
return null;
}
final AndroidLintInspectionBase inspection = (AndroidLintInspectionBase)profile.getUnwrappedTool(inspectionShortName, context);
if (inspection == null) return null;
final HighlightDisplayLevel errorLevel = profile.getErrorLevel(key, context);
return Pair.create(inspection,
errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidLintUtil.java
示例20: getIssuesFromInspections
import com.intellij.profile.codeInspection.InspectionProjectProfileManager; //导入依赖的package包/类
@NotNull
static List<Issue> getIssuesFromInspections(@NotNull Project project, @Nullable PsiElement context) {
final List<Issue> result = new ArrayList<Issue>();
final IssueRegistry fullRegistry = new IntellijLintIssueRegistry();
for (Issue issue : fullRegistry.getIssues()) {
final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
if (inspectionShortName == null) {
continue;
}
final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
if (key == null) {
continue;
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final boolean enabled = context != null ? profile.isToolEnabled(key, context) : profile.isToolEnabled(key);
if (!enabled) {
continue;
}
result.add(issue);
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidLintExternalAnnotator.java
注:本文中的com.intellij.profile.codeInspection.InspectionProjectProfileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论