Search in sources :

Example 1 with MockLocalFileSystem

use of com.intellij.mock.MockLocalFileSystem 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)

Aggregations

MockLocalFileSystem (com.intellij.mock.MockLocalFileSystem)1 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)1 ProjectJdkTable (com.intellij.openapi.projectRoots.ProjectJdkTable)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 ProjectJdkTableImpl (com.intellij.openapi.projectRoots.impl.ProjectJdkTableImpl)1 VirtualFileSystem (com.intellij.openapi.vfs.VirtualFileSystem)1 VirtualFileManagerImpl (com.intellij.openapi.vfs.impl.VirtualFileManagerImpl)1 MessageBus (com.intellij.util.messages.MessageBus)1 ElixirSdkType (org.elixir_lang.sdk.ElixirSdkType)1