本文整理匯總了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);
}