當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiDirectory.getVirtualFile方法代碼示例

本文整理匯總了Java中com.intellij.psi.PsiDirectory.getVirtualFile方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiDirectory.getVirtualFile方法的具體用法?Java PsiDirectory.getVirtualFile怎麽用?Java PsiDirectory.getVirtualFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.PsiDirectory的用法示例。


在下文中一共展示了PsiDirectory.getVirtualFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findContainingExtension

import com.intellij.psi.PsiDirectory; //導入方法依賴的package包/類
/**
 * Traverses the given directories and returns the first valid
 * extension definition that's applicable.
 *
 * @param directories List of directories to analyze
 */
public static TYPO3ExtensionDefinition findContainingExtension(PsiDirectory[] directories) {
    for (PsiDirectory directory : directories) {
        VirtualDirectoryImpl virtualFile = (VirtualDirectoryImpl) directory.getVirtualFile();

        while (!isExtensionRootDirectory(virtualFile)) {
            if (virtualFile.getParent() == null) {
                return null;
            }

            virtualFile = virtualFile.getParent();
        }

        TYPO3ExtensionDefinition extensionDefinition = ExtensionDefinitionFactory.fromDirectory(virtualFile);
        if (extensionDefinition != null) {
            return extensionDefinition;
        }
    }

    return null;
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:27,代碼來源:TYPO3ExtensionUtil.java

示例2: actionPerformed

import com.intellij.psi.PsiDirectory; //導入方法依賴的package包/類
public void actionPerformed(final AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null) return;
  final PsiDirectory[] directories = view.getDirectories();

  PsiDirectory currentDirectory = directories.length > 0 ? directories[0] : null;
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) return;

  VirtualFile directoryFile = currentDirectory != null ? currentDirectory.getVirtualFile() : project.getBaseDir();
  openLoadDirectoryDialog(project, directoryFile, null);
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:14,代碼來源:LoadDictionaryAction.java

示例3: isValidFilePath

import com.intellij.psi.PsiDirectory; //導入方法依賴的package包/類
protected String isValidFilePath(@NotNull String fullFilePath, @NotNull PsiDirectory baseDirectory) {
    String filePath = StringUtil.replace(
            fullFilePath,
            File.separator,
            "/"
    );

    if(filePath.length() == 0) {
        return PhpBundle.message(
            "validation.file.not.valid.name",
                fullFilePath);
    } else {
        List<String> split = StringUtil.split(filePath, "/");
        if(split.size() == 0) {
            return PhpBundle.message(
                "validation.file.not.valid.name",
                    fullFilePath);
        } else {
            for (String aSplit : split) {
                if (!PhpNameUtil.isValidFileName(aSplit)) {
                    return PhpBundle.message(
                        "validation.file.not.valid.name",
                            fullFilePath);
                }
            }

            VirtualFile baseDirectoryFile = baseDirectory.getVirtualFile();
            VirtualFile fileByRelativePath = baseDirectoryFile.findFileByRelativePath(
                    PhpNameUtil.trimStart(
                            filePath,
                            '/')
            );

            if (fileByRelativePath != null) {
                return PhpBundle.message(
                    "validation.file.already.exists",
                        fullFilePath);
            } else {
                return null;
            }
        }
    }
}
 
開發者ID:aurimasniekis,項目名稱:idea-php-class-templates,代碼行數:44,代碼來源:PhpNewClassDialog.java


注:本文中的com.intellij.psi.PsiDirectory.getVirtualFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。