本文整理汇总了Java中com.intellij.openapi.roots.libraries.LibraryTable.getLibraries方法的典型用法代码示例。如果您正苦于以下问题:Java LibraryTable.getLibraries方法的具体用法?Java LibraryTable.getLibraries怎么用?Java LibraryTable.getLibraries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.roots.libraries.LibraryTable
的用法示例。
在下文中一共展示了LibraryTable.getLibraries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findIdeLibrary
import com.intellij.openapi.roots.libraries.LibraryTable; //导入方法依赖的package包/类
@Nullable
@Override
public Library findIdeLibrary(@NotNull LibraryData libraryData) {
final LibraryTable libraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
for (Library ideLibrary : libraryTable.getLibraries()) {
if (isRelated(ideLibrary, libraryData)) return ideLibrary;
}
return null;
}
示例2: attachSourcesToLibraries
import com.intellij.openapi.roots.libraries.LibraryTable; //导入方法依赖的package包/类
private void attachSourcesToLibraries() {
LibraryTable libraryTable = ProjectLibraryTable.getInstance(myProject);
LibraryAttachments storedLibraryAttachments = getStoredLibraryAttachments(myProject);
for (Library library : libraryTable.getLibraries()) {
Set<String> sourcePaths = Sets.newHashSet();
for (VirtualFile file : library.getFiles(SOURCES)) {
sourcePaths.add(file.getUrl());
}
Library.ModifiableModel libraryModel = library.getModifiableModel();
// Find the source attachment based on the location of the library jar file.
for (VirtualFile classFile : library.getFiles(CLASSES)) {
VirtualFile sourceJar = findSourceJarForJar(classFile);
if (sourceJar != null) {
String url = pathToUrl(sourceJar.getPath());
if (!sourcePaths.contains(url)) {
libraryModel.addRoot(url, SOURCES);
sourcePaths.add(url);
}
}
}
if (storedLibraryAttachments != null) {
storedLibraryAttachments.addUrlsTo(libraryModel);
}
libraryModel.commit();
}
if (storedLibraryAttachments != null) {
storedLibraryAttachments.removeFromProject();
}
}
示例3: getLibraries
import com.intellij.openapi.roots.libraries.LibraryTable; //导入方法依赖的package包/类
@NotNull
protected Library[] getLibraries(@NotNull LibraryTable table) {
return table.getLibraries();
}