当前位置: 首页>>代码示例>>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;未经允许,请勿转载。