当前位置: 首页>>代码示例>>Java>>正文


Java VirtualFile.getCanonicalPath方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.VirtualFile.getCanonicalPath方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFile.getCanonicalPath方法的具体用法?Java VirtualFile.getCanonicalPath怎么用?Java VirtualFile.getCanonicalPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.VirtualFile的用法示例。


在下文中一共展示了VirtualFile.getCanonicalPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findFileModules

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
public static List<PsiFile> findFileModules(@NotNull Project project, String extension, @NotNull String name, boolean exact) {
    ArrayList<PsiFile> result = new ArrayList<>();

    Bucklescript bucklescript = BucklescriptProjectComponent.getInstance(project);
    PsiManager psiManager = PsiManager.getInstance(project);

    Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, extension);
    for (VirtualFile vFile : files) {
        String canonicalPath = vFile.getCanonicalPath();
        if (bucklescript.isDependency(canonicalPath)) {
            FileBase file = (FileBase) psiManager.findFile(vFile);
            if (file != null) {
                String fileModuleName = file.asModuleName();
                boolean found = exact ? fileModuleName.equals(name) : fileModuleName.startsWith(name);
                if (found) {
                    result.add(file);
                }
            }
        }
    }

    return result;
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:25,代码来源:RmlPsiUtil.java

示例2: getProjectForFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
/**
 * Look through all open projects and see if git head symlink file is contained in it.
 */
private Project getProjectForFile(VirtualFile gitHeadFile) {
  //
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    try {
      VirtualFile[] contentRootArray = ProjectRootManager.getInstance(project).getContentRoots();
      for (VirtualFile virtualFile : contentRootArray) {
        String expectedLoc = virtualFile.getCanonicalPath() + "/.git/HEAD";
        if (expectedLoc.equals(gitHeadFile.getCanonicalPath())) {
          return project;
        }
      }
    } catch (Exception e) {
      // ignore
    }
  }
  return null;
}
 
开发者ID:PracticeInsight,项目名称:branch-window-title,代码行数:21,代码来源:BranchNameFrameTitleBuilder.java

示例3: getBinaryPath

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
public static String getBinaryPath(Project project, String binary) {
    if (binary == null) {
        return null;
    }

    if (new File(binary).isAbsolute()) {
        return binary;
    }

    VirtualFile baseDir = Platform.findBaseRoot(project);
    VirtualFile absoluteBinary = baseDir.findFileByRelativePath(binary);

    return absoluteBinary == null ? null : absoluteBinary.getCanonicalPath();
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:16,代码来源:Platform.java

示例4: getPropertyValue

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static String getPropertyValue(String key, boolean isOptional) {
    if (key == null) {
        return "";
    }
    VirtualFile baseDir = ProjectManager.getInstance().getOpenProjects()[0].getBaseDir();
    if (baseDir == null || !baseDir.isDirectory()) {
        System.out.println("Base dir not exist");
        return "";
    }
    Properties properties = new Properties();
    String value = null;
    try {
        VirtualFile crowdinProperties = baseDir.findChild(PROPERTIES_FILE);
        if (crowdinProperties == null) {
            showInformationMessage("File '" + PROPERTIES_FILE + "' with Crowdin plugin configuration doesn't exist in project root directory");
            LOGGER.info("File '" + PROPERTIES_FILE + "' with Crowdin plugin configuration doesn't exist in project root directory");
            return "";
        }
        InputStream in = new FileInputStream(crowdinProperties.getCanonicalPath());
        properties.load(in);
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (properties != null && properties.get(key) != null) {
        value = properties.get(key).toString();
    } else if (!isOptional) {
        showInformationMessage("Check does property '" + key + "' exist in your configuration file '" + PROPERTIES_FILE + "'");
        LOGGER.info("Check does property '" + key + "' exist in your configuration file '" + PROPERTIES_FILE + "'");
    }
    return value;
}
 
开发者ID:crowdin,项目名称:android-studio-plugin,代码行数:33,代码来源:Utils.java

示例5: isTemplateFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static boolean isTemplateFile(VirtualFile vFile) {
	return vFile != null && vFile.getCanonicalPath() != null &&
		vFile.getCanonicalPath().replace('\\', '/').startsWith(CptUtil.getTemplatesPath().getAbsolutePath().replace('\\', '/'));
}
 
开发者ID:xylo,项目名称:intellij-postfix-templates,代码行数:5,代码来源:CptUtil.java


注:本文中的com.intellij.openapi.vfs.VirtualFile.getCanonicalPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。