當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。