Search in sources :

Example 1 with TipAndTrickBean

use of com.intellij.ide.util.TipAndTrickBean in project intellij-community by JetBrains.

the class IdeResourcesTestCase method testTipFilesPresent.

public void testTipFilesPresent() {
    Collection<String> errors = ContainerUtil.newTreeSet();
    TipAndTrickBean[] tips = TipAndTrickBean.EP_NAME.getExtensions();
    assertNotEmpty(Arrays.asList(tips));
    for (TipAndTrickBean tip : tips) {
        URL url = ResourceUtil.getResource(tip.getPluginDescriptor().getPluginClassLoader(), "/tips/", tip.fileName);
        if (url == null) {
            errors.add(tip.fileName);
        }
    }
    assertEquals(tips.length + " tips are checked, the following files are missing:\n" + StringUtil.join(errors, "\n"), 0, errors.size());
}
Also used : TipAndTrickBean(com.intellij.ide.util.TipAndTrickBean) URL(java.net.URL)

Example 2 with TipAndTrickBean

use of com.intellij.ide.util.TipAndTrickBean in project intellij-community by JetBrains.

the class IdeResourcesTestCase method testFeatureTipsRegistered.

public void testFeatureTipsRegistered() {
    ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance();
    Set<String> ids = registry.getFeatureIds();
    assertNotEmpty(ids);
    Collection<String> errors = ContainerUtil.newTreeSet();
    for (String id : ids) {
        FeatureDescriptor descriptor = registry.getFeatureDescriptor(id);
        TipAndTrickBean tip = TipAndTrickBean.findByFileName(descriptor.getTipFileName());
        if (tip == null) {
            errors.add("<tipAndTrick file=\"" + descriptor.getTipFileName() + "\" feature-id=\"" + id + "\"/>");
        }
    }
    assertEquals("Register the following extensions:\n" + StringUtil.join(errors, "\n"), 0, errors.size());
}
Also used : TipAndTrickBean(com.intellij.ide.util.TipAndTrickBean) FeatureDescriptor(com.intellij.featureStatistics.FeatureDescriptor) ProductivityFeaturesRegistry(com.intellij.featureStatistics.ProductivityFeaturesRegistry)

Example 3 with TipAndTrickBean

use of com.intellij.ide.util.TipAndTrickBean in project intellij-community by JetBrains.

the class IdeResourcesTestCase method testTipFilesDuplicates.

public void testTipFilesDuplicates() {
    Collection<String> errors = ContainerUtil.newTreeSet();
    TipAndTrickBean[] tips = TipAndTrickBean.EP_NAME.getExtensions();
    assertNotEmpty(Arrays.asList(tips));
    Set<String> visited = ContainerUtil.newLinkedHashSet();
    for (TipAndTrickBean tip : tips) {
        if (!visited.add(tip.fileName)) {
            errors.add(tip.fileName);
        }
    }
    assertEquals("The following tip files are registered more than once:\n" + StringUtil.join(errors, "\n"), 0, errors.size());
}
Also used : TipAndTrickBean(com.intellij.ide.util.TipAndTrickBean)

Example 4 with TipAndTrickBean

use of com.intellij.ide.util.TipAndTrickBean in project intellij-community by JetBrains.

the class PyCharmEduInitialConfigurator method patchRootAreaExtensions.

private static void patchRootAreaExtensions() {
    ExtensionsArea rootArea = Extensions.getArea(null);
    rootArea.unregisterExtensionPoint("com.intellij.runLineMarkerContributor");
    for (ToolWindowEP ep : Extensions.getExtensions(ToolWindowEP.EP_NAME)) {
        if (ToolWindowId.FAVORITES_VIEW.equals(ep.id) || ToolWindowId.TODO_VIEW.equals(ep.id) || EventLog.LOG_TOOL_WINDOW_ID.equals(ep.id) || ToolWindowId.STRUCTURE_VIEW.equals(ep.id)) {
            rootArea.getExtensionPoint(ToolWindowEP.EP_NAME).unregisterExtension(ep);
        }
    }
    for (DirectoryProjectConfigurator ep : Extensions.getExtensions(DirectoryProjectConfigurator.EP_NAME)) {
        if (ep instanceof PlatformProjectViewOpener) {
            rootArea.getExtensionPoint(DirectoryProjectConfigurator.EP_NAME).unregisterExtension(ep);
        }
    }
    // unregister unrelated tips
    for (TipAndTrickBean tip : Extensions.getExtensions(TipAndTrickBean.EP_NAME)) {
        if (UNRELATED_TIPS.contains(tip.fileName)) {
            rootArea.getExtensionPoint(TipAndTrickBean.EP_NAME).unregisterExtension(tip);
        }
    }
    for (IntentionActionBean ep : Extensions.getExtensions(IntentionManager.EP_INTENTION_ACTIONS)) {
        if ("org.intellij.lang.regexp.intention.CheckRegExpIntentionAction".equals(ep.className)) {
            rootArea.getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS).unregisterExtension(ep);
        }
    }
    final ExtensionPoint<ProjectAttachProcessor> point = Extensions.getRootArea().getExtensionPoint(ProjectAttachProcessor.EP_NAME);
    for (ProjectAttachProcessor attachProcessor : Extensions.getExtensions(ProjectAttachProcessor.EP_NAME)) {
        point.unregisterExtension(attachProcessor);
    }
}
Also used : ProjectAttachProcessor(com.intellij.projectImport.ProjectAttachProcessor) ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) DirectoryProjectConfigurator(com.intellij.platform.DirectoryProjectConfigurator) TipAndTrickBean(com.intellij.ide.util.TipAndTrickBean) IntentionActionBean(com.intellij.codeInsight.intention.IntentionActionBean) PlatformProjectViewOpener(com.intellij.platform.PlatformProjectViewOpener)

Aggregations

TipAndTrickBean (com.intellij.ide.util.TipAndTrickBean)4 IntentionActionBean (com.intellij.codeInsight.intention.IntentionActionBean)1 FeatureDescriptor (com.intellij.featureStatistics.FeatureDescriptor)1 ProductivityFeaturesRegistry (com.intellij.featureStatistics.ProductivityFeaturesRegistry)1 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)1 DirectoryProjectConfigurator (com.intellij.platform.DirectoryProjectConfigurator)1 PlatformProjectViewOpener (com.intellij.platform.PlatformProjectViewOpener)1 ProjectAttachProcessor (com.intellij.projectImport.ProjectAttachProcessor)1 URL (java.net.URL)1