本文整理汇总了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;
}
示例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);
}
示例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));
}
示例5: getUrlByPath
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static String getUrlByPath(final String path) {
return VfsUtil.getUrlForLibraryRoot(new File(path));
}
示例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);
}
示例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);
}