@@ -0,0 +1,1918 @@
+package com.cedricziel.idea.typo3.psi;%0A%0Aimport com.cedricziel.idea.typo3.domain.TYPO3ExtensionDefinition;%0Aimport com.cedricziel.idea.typo3.domain.factory.ExtensionDefinitionFactory;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl;%0Aimport com.intellij.psi.PsiDirectory;%0A%0Apublic class TYPO3ExtensionUtil %7B%0A    /**%0A     * Traverses the given directories and returns the first valid%0A     * extension definition that's applicable.%0A     *%0A     * @param directories List of directories to analyze%0A     */%0A    public static TYPO3ExtensionDefinition findContainingExtension(PsiDirectory%5B%5D directories) %7B%0A        for (PsiDirectory directory : directories) %7B%0A            VirtualDirectoryImpl virtualFile = (VirtualDirectoryImpl) directory.getVirtualFile();%0A%0A            while (!isExtensionRootDirectory(virtualFile)) %7B%0A                if (virtualFile.getParent() == null) %7B%0A                    return null;%0A                %7D%0A%0A                virtualFile = virtualFile.getParent();%0A            %7D%0A%0A            TYPO3ExtensionDefinition extensionDefinition = ExtensionDefinitionFactory.fromDirectory(virtualFile);%0A            if (extensionDefinition != null) %7B%0A                return extensionDefinition;%0A            %7D%0A        %7D%0A%0A        return null;%0A    %7D%0A%0A    /**%0A     * Determines if a directory is the top-most directory of an extension.%0A     * It does so by searching the %22ext_emconf.php%22%0A     *%0A     * @param virtualFile Directory to scan%0A     * @return true if the current directory is a root directory.%0A     */%0A    private static boolean isExtensionRootDirectory(VirtualDirectoryImpl virtualFile) %7B%0A        VirtualFile%5B%5D immediateChildren = virtualFile.getChildren();%0A        for (VirtualFile file : immediateChildren) %7B%0A            if (file.getName().equals(%22ext_emconf.php%22)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

Add TYPO3ExtensionUtil and add methods to find extensions from directories