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


Java InspectionProfileManager.getInstance方法代码示例

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


在下文中一共展示了InspectionProfileManager.getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDoNotInstantiateOnSave

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public void testDoNotInstantiateOnSave() throws Exception {
  InspectionProfileImpl profile = new InspectionProfileImpl("profile", InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile());
  assertEquals(0, countInitializedTools(profile));
  InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
  assertTrue(toolWrappers.length > 0);
  InspectionToolWrapper toolWrapper = profile.getInspectionTool(new DataFlowInspection().getShortName(), getProject());
  assertNotNull(toolWrapper);
  String id = toolWrapper.getShortName();
  System.out.println(id);
  if (profile.isToolEnabled(HighlightDisplayKey.findById(id))) {
    profile.disableTool(id, getProject());
  }
  else {
    profile.enableTool(id, getProject());
  }
  assertEquals(0, countInitializedTools(profile));
  profile.writeExternal(new Element("profile"));
  List<InspectionToolWrapper> initializedTools = getInitializedTools(profile);
  if (initializedTools.size() > 0) {
    for (InspectionToolWrapper initializedTool : initializedTools) {
      System.out.println(initializedTool.getShortName());
    }
    fail();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InspectionProfileTest.java

示例2: createSimple

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
@NotNull
public static InspectionProfileImpl createSimple(@NotNull String name,
                                                 @NotNull final Project project,
                                                 @NotNull final InspectionToolWrapper... toolWrappers) {
  InspectionToolRegistrar registrar = new InspectionToolRegistrar() {
    @NotNull
    @Override
    public List<InspectionToolWrapper> createTools() {
      return Arrays.asList(toolWrappers);
    }
  };
  final InspectionProfileImpl profile = new InspectionProfileImpl(name, registrar, InspectionProfileManager.getInstance());
  initAndDo(new Computable() {
    @Override
    public Object compute() {
      profile.initInspectionTools(project);
      return null;
    }
  });
  for (InspectionToolWrapper toolWrapper : toolWrappers) {
    profile.enableTool(toolWrapper.getShortName(), project);
  }
  return profile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InspectionProfileImpl.java

示例3: invoke

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的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

示例4: createSimple

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
@NotNull
public static InspectionProfileImpl createSimple(@NotNull String name,
                                                 @NotNull Project project,
                                                 @NotNull final InspectionToolWrapper... toolWrappers) {
  InspectionToolRegistrar registrar = new InspectionToolRegistrar() {
    @NotNull
    @Override
    public List<InspectionToolWrapper> createTools() {
      return Arrays.asList(toolWrappers);
    }
  };
  InspectionProfileImpl profile = new InspectionProfileImpl(name, registrar, InspectionProfileManager.getInstance());
  boolean init = INIT_INSPECTIONS;
  try {
    INIT_INSPECTIONS = true;
    profile.initialize(project);
  }
  finally {
    INIT_INSPECTIONS = init;
  }
  for (InspectionToolWrapper toolWrapper : toolWrappers) {
    profile.enableTool(toolWrapper.getShortName(), project);
  }
  return profile;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:InspectionProfileImpl.java

示例5: createSimple

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
@Nonnull
public static InspectionProfileImpl createSimple(@Nonnull String name,
                                                 @Nonnull Project project,
                                                 @Nonnull final InspectionToolWrapper... toolWrappers) {
  InspectionToolRegistrar registrar = new InspectionToolRegistrar() {
    @Nonnull
    @Override
    public List<InspectionToolWrapper> createTools() {
      return Arrays.asList(toolWrappers);
    }
  };
  InspectionProfileImpl profile = new InspectionProfileImpl(name, registrar, InspectionProfileManager.getInstance());
  boolean init = INIT_INSPECTIONS;
  try {
    INIT_INSPECTIONS = true;
    profile.initialize(project);
  }
  finally {
    INIT_INSPECTIONS = init;
  }
  for (InspectionToolWrapper toolWrapper : toolWrappers) {
    profile.enableTool(toolWrapper.getShortName(), project);
  }
  return profile;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:InspectionProfileImpl.java

示例6: configureInspections

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public static void configureInspections(@NotNull InspectionProfileEntry[] tools,
                                        @NotNull final Project project,
                                        @NotNull final Collection<String> disabledInspections,
                                        @NotNull Disposable parentDisposable) {
  InspectionToolWrapper[] wrapped =
    ContainerUtil.map2Array(tools, InspectionToolWrapper.class, new Function<InspectionProfileEntry, InspectionToolWrapper>() {
      @Override
      public InspectionToolWrapper fun(InspectionProfileEntry tool) {
        return InspectionToolRegistrar.wrapTool(tool);
      }
    });

  final InspectionProfileImpl profile = InspectionProfileImpl.createSimple(LightPlatformTestCase.PROFILE, project, wrapped);
  profile.disableToolByDefault(new ArrayList<String>(disabledInspections), project);

  final InspectionProfileManager inspectionProfileManager = InspectionProfileManager.getInstance();
  final Profile oldRootProfile = inspectionProfileManager.getRootProfile();
  inspectionProfileManager.addProfile(profile);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      inspectionProfileManager.deleteProfile(profile.getName());
      inspectionProfileManager.setRootProfile(oldRootProfile.getName());
      clearAllToolsIn(InspectionProfileImpl.getDefaultProfile(), project);
    }
  });
  inspectionProfileManager.setRootProfile(profile.getName());
  InspectionProfileImpl.initAndDo(new Computable() {
    @Override
    public Object compute() {
      InspectionProjectProfileManager.getInstance(project).updateProfile(profile);
      InspectionProjectProfileManager.getInstance(project).setProjectProfile(profile.getName());
      return null;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:CodeInsightTestFixtureImpl.java

示例7: apply

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public void apply() throws ConfigurationException {
  final boolean modified = isModified();
  if (!modified) {
    return;
  }
  final ModifiableModel selectedProfile = getSelectedProfile();

  ProfileManager profileManager = myIsProjectLevel ? myProjectProfileManager : InspectionProfileManager.getInstance();
  selectedProfile.setProjectLevel(myIsProjectLevel);
  if (selectedProfile.getProfileManager() != profileManager) {
    if (selectedProfile.getProfileManager().getProfile(selectedProfile.getName(), false) == myOriginal) {
      selectedProfile.getProfileManager().deleteProfile(selectedProfile.getName());
    }
    selectedProfile.setName(myCurrentProfileName);
    copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
    selectedProfile.setProfileManager(profileManager);
  } else {
    if (!Comparing.equal(myCurrentProfileName, selectedProfile.getName())) {
      if (selectedProfile.getProfileManager().getProfile(selectedProfile.getName(), false) == myOriginal) {
        selectedProfile.getProfileManager().deleteProfile(selectedProfile.getName());
      }
      selectedProfile.setName(myCurrentProfileName);
      selectedProfile.getProfileManager().updateProfile(selectedProfile);
    }
  }

  final InspectionProfile parentProfile = selectedProfile.getParentProfile();
  try {
    selectedProfile.commit();
  }
  catch (IOException e) {
    throw new ConfigurationException(e.getMessage());
  }
  setSelectedProfile(parentProfile.getModifiableModel());
  setSelectedProfileModified(false);
  myModified = false;
  myOriginal = selectedProfile.getProfileManager().getProfile(selectedProfile.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:SingleInspectionProfilePanel.java

示例8: createProfile

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
private static InspectionProfileImpl createProfile(InspectionToolRegistrar registrar) {
  InspectionProfileImpl base = new InspectionProfileImpl("Base", registrar, InspectionProfileManager.getInstance());
  base.setBaseProfile(null);
  InspectionProfileImpl profile = new InspectionProfileImpl("Foo", registrar, InspectionProfileManager.getInstance());
  profile.setBaseProfile(base);
  return profile;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:InspectionProfileTest.java

示例9: apply

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public void apply() throws ConfigurationException {
  final boolean modified = isModified();
  if (!modified) {
    return;
  }
  final ModifiableModel selectedProfile = getSelectedProfile();
  final ProfileManager profileManager =
    myShareProfile ? myProjectProfileManager : InspectionProfileManager.getInstance();
  selectedProfile.setLocal(!myShareProfile);
  if (selectedProfile.getProfileManager() != profileManager) {
    if (selectedProfile.getProfileManager().getProfile(selectedProfile.getName(), false) != null) {
      selectedProfile.getProfileManager().deleteProfile(selectedProfile.getName());
    }
    copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
    selectedProfile.setProfileManager(profileManager);
  }
  final InspectionProfile parentProfile = selectedProfile.getParentProfile();

  if (((InspectionProfileManagerImpl)InspectionProfileManager.getInstance()).getSchemesManager().isShared(selectedProfile)) {
    if (descriptorsAreChanged()) {
      throw new ConfigurationException("Shared profile cannot be modified. Please do \"Save As...\" first.");
    }

  }

  try {
    selectedProfile.commit();
  }
  catch (IOException e) {
    throw new ConfigurationException(e.getMessage());
  }
  setSelectedProfile(parentProfile.getModifiableModel());
  setSelectedProfileModified(false);
  myModified = false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:SingleInspectionProfilePanel.java

示例10: invoke

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
@Override
public void invoke(@Nonnull 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();
            }
          };
  ShowSettingsUtil.getInstance().editConfigurable(CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME,  project, configurable);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:EditCleanupProfileIntentionAction.java

示例11: apply

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public void apply() throws ConfigurationException {
  final boolean modified = isModified();
  if (!modified) {
    return;
  }
  final ModifiableModel selectedProfile = getSelectedProfile();

  if (!Comparing.equal(myCurrentProfileName, selectedProfile.getName())) {
    selectedProfile.getProfileManager().deleteProfile(selectedProfile.getName());
    selectedProfile.setName(myCurrentProfileName);
    selectedProfile.getProfileManager().updateProfile(selectedProfile);
  }
  ProfileManager profileManager = myShareProfile ? myProjectProfileManager : InspectionProfileManager.getInstance();
  selectedProfile.setProjectLevel(myShareProfile);
  if (selectedProfile.getProfileManager() != profileManager) {
    if (selectedProfile.getProfileManager().getProfile(selectedProfile.getName(), false) != null) {
      selectedProfile.getProfileManager().deleteProfile(selectedProfile.getName());
    }
    copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
    selectedProfile.setProfileManager(profileManager);
  }

  final InspectionProfile parentProfile = selectedProfile.getParentProfile();
  try {
    selectedProfile.commit();
  }
  catch (IOException e) {
    throw new ConfigurationException(e.getMessage());
  }
  setSelectedProfile(parentProfile.getModifiableModel());
  setSelectedProfileModified(false);
  myModified = false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:34,代码来源:SingleInspectionProfilePanel.java

示例12: createProfile

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
private static InspectionProfileImpl createProfile() {
  return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:InspectionProfileTest.java

示例13: InspectionProfileImpl

import com.intellij.profile.codeInspection.InspectionProfileManager; //导入方法依赖的package包/类
public InspectionProfileImpl(@NotNull @NonNls String profileName) {
  this(profileName, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:InspectionProfileImpl.java


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