当前位置: 首页>>代码示例>>Java>>正文


Java InspectionProjectProfileManager类代码示例

本文整理汇总了Java中com.intellij.profile.codeInspection.InspectionProjectProfileManager的典型用法代码示例。如果您正苦于以下问题:Java InspectionProjectProfileManager类的具体用法?Java InspectionProjectProfileManager怎么用?Java InspectionProjectProfileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InspectionProjectProfileManager类属于com.intellij.profile.codeInspection包,在下文中一共展示了InspectionProjectProfileManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的com.intellij.profile.codeInspection.InspectionProjectProfileManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。