Search in sources :

Example 1 with ExtensionsArea

use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-elixir by KronicDeth.

the class ParsingTestCase method setProjectSdkFromSdkHome.

private void setProjectSdkFromSdkHome(@NotNull String sdkHome) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
    MessageBus messageBus = messageBus();
    registerProjectFileIndex(messageBus);
    ProjectRootManager projectRootManager = registerProjectRootManager();
    assertTrue(pathIsValidSdkHome(sdkHome));
    registerExtensionPoint(OrderRootType.EP_NAME, OrderRootType.class);
    registerExtension(OrderRootType.EP_NAME, new JavadocOrderRootType());
    getApplication().addComponent(VirtualFileManager.class, new VirtualFileManagerImpl(new VirtualFileSystem[] { new MockLocalFileSystem() }, messageBus));
    ProjectJdkTable projectJdkTable = new ProjectJdkTableImpl();
    registerApplicationService(ProjectJdkTable.class, projectJdkTable);
    registerExtensionPoint(com.intellij.openapi.projectRoots.SdkType.EP_NAME, com.intellij.openapi.projectRoots.SdkType.class);
    registerExtension(com.intellij.openapi.projectRoots.SdkType.EP_NAME, new ElixirSdkType());
    Sdk sdk = ElixirSdkType.createMockSdk(sdkHome, elixirSdkRelease());
    projectJdkTable.addJdk(sdk);
    ExtensionsArea area = Extensions.getArea(myProject);
    registerExtensionPoint(area, ProjectExtension.EP_NAME, ProjectExtension.class);
    registerExtensionPoint(FilePropertyPusher.EP_NAME, FilePropertyPusher.class);
    myProject.addComponent(PushedFilePropertiesUpdater.class, new PushedFilePropertiesUpdaterImpl(myProject));
    projectRootManager.setProjectSdk(sdk);
}
Also used : MockLocalFileSystem(com.intellij.mock.MockLocalFileSystem) ProjectJdkTableImpl(com.intellij.openapi.projectRoots.impl.ProjectJdkTableImpl) ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) MessageBus(com.intellij.util.messages.MessageBus) VirtualFileSystem(com.intellij.openapi.vfs.VirtualFileSystem) ProjectJdkTable(com.intellij.openapi.projectRoots.ProjectJdkTable) VirtualFileManagerImpl(com.intellij.openapi.vfs.impl.VirtualFileManagerImpl) Sdk(com.intellij.openapi.projectRoots.Sdk) ElixirSdkType(org.elixir_lang.sdk.ElixirSdkType)

Example 2 with ExtensionsArea

use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-community by JetBrains.

the class DumpExtensionsAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    List<ExtensionsArea> areas = new ArrayList<>();
    areas.add(Extensions.getRootArea());
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
        areas.add(Extensions.getArea(project));
        final Module[] modules = ModuleManager.getInstance(project).getModules();
        if (modules.length > 0) {
            areas.add(Extensions.getArea(modules[0]));
        }
    }
    System.out.print(areas.size() + " extension areas: ");
    for (ExtensionsArea area : areas) {
        System.out.print(area.getAreaClass() + " ");
    }
    System.out.println("\n");
    List<ExtensionPoint> points = new ArrayList<>();
    for (ExtensionsArea area : areas) {
        points.addAll(Arrays.asList(area.getExtensionPoints()));
    }
    System.out.println(points.size() + " extension points: ");
    for (ExtensionPoint point : points) {
        System.out.println(" " + point.getName());
    }
    List<Object> extensions = new ArrayList<>();
    for (ExtensionPoint point : points) {
        extensions.addAll(Arrays.asList(point.getExtensions()));
    }
    System.out.println("\n" + extensions.size() + " extensions:");
    for (Object extension : extensions) {
        if (extension instanceof Configurable) {
            System.out.println("!!!! Configurable extension found. Kill it !!!");
        }
        System.out.println(extension);
    }
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) Project(com.intellij.openapi.project.Project) ExtensionPoint(com.intellij.openapi.extensions.ExtensionPoint) ArrayList(java.util.ArrayList) Configurable(com.intellij.openapi.options.Configurable) Module(com.intellij.openapi.module.Module)

Example 3 with ExtensionsArea

use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-community by JetBrains.

the class UsageNodeTreeBuilderTest method buildUsageTree.

private GroupNode buildUsageTree(int[] indices, UsageGroupingRule[] rules) {
    Usage[] usages = new Usage[indices.length];
    for (int i = 0; i < usages.length; i++) {
        usages[i] = createUsage(indices[i]);
    }
    UsageViewPresentation presentation = new UsageViewPresentation();
    presentation.setUsagesString("searching for mock usages");
    ExtensionsArea area = Extensions.getRootArea();
    ExtensionPoint<UsageGroupingRuleProvider> point = area.getExtensionPoint(UsageGroupingRuleProvider.EP_NAME);
    UsageGroupingRuleProvider provider = new UsageGroupingRuleProvider() {

        @NotNull
        @Override
        public UsageGroupingRule[] getActiveRules(Project project) {
            return rules;
        }

        @NotNull
        @Override
        public AnAction[] createGroupingActions(UsageView view) {
            return AnAction.EMPTY_ARRAY;
        }
    };
    point.registerExtension(provider);
    try {
        UsageViewImpl usageView = new UsageViewImpl(getProject(), presentation, UsageTarget.EMPTY_ARRAY, null);
        Disposer.register(getTestRootDisposable(), usageView);
        for (Usage usage : usages) {
            usageView.appendUsage(usage);
        }
        UIUtil.dispatchAllInvocationEvents();
        return usageView.getRoot();
    } finally {
        point.unregisterExtension(provider);
    }
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) Project(com.intellij.openapi.project.Project) UsageGroupingRule(com.intellij.usages.rules.UsageGroupingRule) AnAction(com.intellij.openapi.actionSystem.AnAction) ExtensionPoint(com.intellij.openapi.extensions.ExtensionPoint) UsageGroupingRuleProvider(com.intellij.usages.rules.UsageGroupingRuleProvider)

Example 4 with ExtensionsArea

use of com.intellij.openapi.extensions.ExtensionsArea in project android by JetBrains.

the class GradleRunnerCleanupTask method doCleanUp.

@Override
void doCleanUp(@NotNull Project project) {
    ExtensionsArea area = Extensions.getArea(project);
    ExtensionPoint<ConfigurableEP<Configurable>> projectConfigurable = area.getExtensionPoint(PROJECT_CONFIGURABLE);
    // Disable the Gradle -> Runner settings.
    for (ConfigurableEP<Configurable> configurableEP : projectConfigurable.getExtensions()) {
        if (GradleConfigurable.class.getName().equals(configurableEP.instanceClass)) {
            List<ConfigurableEP> children = new ArrayList<>();
            for (ConfigurableEP child : configurableEP.children) {
                if (!GradleRunnerConfigurable.class.getName().equals(child.instanceClass)) {
                    children.add(child);
                }
            }
            configurableEP.children = children.toArray(new ConfigurableEP[children.size()]);
        }
    }
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) ConfigurableEP(com.intellij.openapi.options.ConfigurableEP) ArrayList(java.util.ArrayList) GradleConfigurable(org.jetbrains.plugins.gradle.service.settings.GradleConfigurable) GradleConfigurable(org.jetbrains.plugins.gradle.service.settings.GradleConfigurable) GradleRunnerConfigurable(org.jetbrains.plugins.gradle.settings.GradleRunnerConfigurable) Configurable(com.intellij.openapi.options.Configurable)

Example 5 with ExtensionsArea

use of com.intellij.openapi.extensions.ExtensionsArea in project android by JetBrains.

the class ProjectPreferencesCleanUpTask method doCleanUp.

@Override
void doCleanUp(@NotNull Project project) {
    ExtensionsArea area = Extensions.getArea(project);
    ExtensionPoint<ConfigurableEP<Configurable>> projectConfigurable = area.getExtensionPoint(PROJECT_CONFIGURABLE);
    cleanUpPreferences(projectConfigurable, PROJECT_PREFERENCES_TO_REMOVE);
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) ConfigurableEP(com.intellij.openapi.options.ConfigurableEP)

Aggregations

ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)9 ExtensionPoint (com.intellij.openapi.extensions.ExtensionPoint)2 Configurable (com.intellij.openapi.options.Configurable)2 ConfigurableEP (com.intellij.openapi.options.ConfigurableEP)2 Project (com.intellij.openapi.project.Project)2 ArrayList (java.util.ArrayList)2 IntentionActionBean (com.intellij.codeInsight.intention.IntentionActionBean)1 Executor (com.intellij.execution.Executor)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 SelectInTarget (com.intellij.ide.SelectInTarget)1 AbstractProjectViewPane (com.intellij.ide.projectView.impl.AbstractProjectViewPane)1 TipAndTrickBean (com.intellij.ide.util.TipAndTrickBean)1 MockLocalFileSystem (com.intellij.mock.MockLocalFileSystem)1 Disposable (com.intellij.openapi.Disposable)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 ModalityState (com.intellij.openapi.application.ModalityState)1 ApplicationEx (com.intellij.openapi.application.ex.ApplicationEx)1 DefaultPluginDescriptor (com.intellij.openapi.extensions.DefaultPluginDescriptor)1 Module (com.intellij.openapi.module.Module)1 ProjectJdkTable (com.intellij.openapi.projectRoots.ProjectJdkTable)1