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


Java VfsUtil.getUrlForLibraryRoot方法代碼示例

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


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

示例1: checkTestNGInClasspath

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
public static boolean checkTestNGInClasspath(PsiElement psiElement) {
  final Project project = psiElement.getProject();
  final PsiManager manager = PsiManager.getInstance(project);
  if (JavaPsiFacade.getInstance(manager.getProject()).findClass(TestNG.class.getName(), psiElement.getResolveScope()) == null) {
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      if (Messages.showOkCancelDialog(psiElement.getProject(), "TestNG will be added to module classpath", "Unable to convert.", Messages.getWarningIcon()) !=
          Messages.OK) {
        return false;
      }
    }
    final Module module = ModuleUtilCore.findModuleForPsiElement(psiElement);
    if (module == null) return false;
    String url = VfsUtil.getUrlForLibraryRoot(new File(PathUtil.getJarPathForClass(Assert.class)));
    ModuleRootModificationUtil.addModuleLibrary(module, url);
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:TestNGUtil.java

示例2: getOrmLibSources

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
@NotNull
public VirtualFile[] getOrmLibSources() {
  final File libsDir = new File(myHomePath, "src/orm");
  final File[] files = libsDir.listFiles();
  List<VirtualFile> roots = new ArrayList<VirtualFile>();
  if (files != null) {
    for (File file : files) {
      final String url = VfsUtil.getUrlForLibraryRoot(file);
      final VirtualFile zipRoot = VirtualFileManager.getInstance().findFileByUrl(url);
      if (zipRoot != null && zipRoot.isDirectory()) {
        String fileName = file.getName();
        final String srcDirName = StringUtil.trimEnd(fileName, "-src.zip");
        final VirtualFile sourcesDir = zipRoot.findFileByRelativePath(srcDirName + "/src/java");
        if (sourcesDir != null) {
          roots.add(sourcesDir);
        }
        else {
          roots.add(zipRoot);
        }
      }
    }
  }
  return VfsUtilCore.toVirtualFileArray(roots);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:AppEngineSdkImpl.java

示例3: createModule

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
@Override
protected Module createModule(final String name) {
  final Module module = super.createModule(name);
  final String url = VfsUtil.getUrlForLibraryRoot(new File(PathUtil.getJarPathForClass(Before.class)));
  ModuleRootModificationUtil.addModuleLibrary(module, url);
  return module;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:IntroduceFieldWitSetUpInitializationTest.java

示例4: getUrlByPath

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
private static String getUrlByPath(final String path) {
    return VfsUtil.getUrlForLibraryRoot(new File(path));
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:4,代碼來源:GravModuleBuilder.java

示例5: getUrlByPath

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
private static String getUrlByPath(final String path) {
  return VfsUtil.getUrlForLibraryRoot(new File(path));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:JavaModuleBuilder.java

示例6: refreshAndConvertToUrl

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
@NotNull
private static String refreshAndConvertToUrl(String jarPath) {
  final File libraryRoot = new File(jarPath);
  LocalFileSystem.getInstance().refreshAndFindFileByIoFile(libraryRoot);
  return VfsUtil.getUrlForLibraryRoot(libraryRoot);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:OrderEntryFix.java

示例7: getLibraryRoot

import com.intellij.openapi.vfs.VfsUtil; //導入方法依賴的package包/類
@Nullable
public VirtualFile getLibraryRoot() {
  final String url = VfsUtil.getUrlForLibraryRoot(new File(FileUtil.toSystemDependentName(getFilePath())));
  return VirtualFileManager.getInstance().findFileByUrl(url);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:FileCopyPackagingElement.java


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