Search in sources :

Example 1 with ExternalSystemConfigLocator

use of com.intellij.openapi.externalSystem.service.settings.ExternalSystemConfigLocator in project intellij-community by JetBrains.

the class ExternalSystemNodeAction method getExternalConfig.

@Nullable
protected VirtualFile getExternalConfig(@NotNull ExternalConfigPathAware data, ProjectSystemId externalSystemId) {
    String path = data.getLinkedExternalProjectPath();
    LocalFileSystem fileSystem = LocalFileSystem.getInstance();
    VirtualFile externalSystemConfigPath = fileSystem.refreshAndFindFileByPath(path);
    if (externalSystemConfigPath == null) {
        return null;
    }
    VirtualFile toOpen = externalSystemConfigPath;
    for (ExternalSystemConfigLocator locator : ExternalSystemConfigLocator.EP_NAME.getExtensions()) {
        if (externalSystemId.equals(locator.getTargetExternalSystemId())) {
            toOpen = locator.adjust(toOpen);
            if (toOpen == null) {
                return null;
            }
            break;
        }
    }
    return toOpen.isDirectory() ? null : toOpen;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) ExternalSystemConfigLocator(com.intellij.openapi.externalSystem.service.settings.ExternalSystemConfigLocator) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ExternalSystemConfigLocator (com.intellij.openapi.externalSystem.service.settings.ExternalSystemConfigLocator)1 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1