本文整理汇总了Java中com.intellij.openapi.roots.impl.libraries.LibraryImpl类的典型用法代码示例。如果您正苦于以下问题:Java LibraryImpl类的具体用法?Java LibraryImpl怎么用?Java LibraryImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LibraryImpl类属于com.intellij.openapi.roots.impl.libraries包,在下文中一共展示了LibraryImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFiles
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Override
public VirtualFile[] getFiles(OrderRootType rootType) {
List<VirtualFile> result = new ArrayList<VirtualFile>();
for (LightFilePointer pointer : myRoots.get(rootType)) {
final VirtualFile file = pointer.getFile();
if (file == null) {
continue;
}
if (file.isDirectory()) {
final String url = file.getUrl();
if (myJarDirectories.contains(rootType, url)) {
LibraryImpl.collectJarFiles(file, result, myJarDirectories.isRecursive(rootType, url));
continue;
}
}
result.add(file);
}
return VfsUtil.toVirtualFileArray(result);
}
示例2: selectLibrary
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Override
public void selectLibrary(@NotNull Library library) {
final LibraryTable table = library.getTable();
if (table != null) {
ProjectStructureConfigurable.getInstance(getProject()).selectProjectOrGlobalLibrary(library, true);
}
else {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
final ModuleRootModel rootModel = myParent.getModulesProvider().getRootModel(module);
final String libraryName = library.getName();
for (OrderEntry entry : rootModel.getOrderEntries()) {
if (entry instanceof ModuleLibraryOrderEntryImpl) {
final ModuleLibraryOrderEntryImpl libraryEntry = (ModuleLibraryOrderEntryImpl)entry;
if (libraryName != null && libraryName.equals(libraryEntry.getLibraryName())
|| libraryName == null && library.equals(libraryEntry.getLibrary())) {
ProjectStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
return;
}
}
}
}
}
}
示例3: createLibraryElements
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@NotNull
@Override
public List<? extends PackagingElement<?>> createLibraryElements(@NotNull Library library) {
final LibraryTable table = library.getTable();
final String libraryName = library.getName();
if (table != null) {
return Collections.singletonList(createLibraryFiles(libraryName, table.getTableLevel(), null));
}
if (libraryName != null) {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
return Collections.singletonList(createLibraryFiles(libraryName, LibraryTableImplUtil.MODULE_LEVEL, module.getName()));
}
}
final List<PackagingElement<?>> elements = new ArrayList<PackagingElement<?>>();
for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
final String path = FileUtil.toSystemIndependentName(PathUtil.getLocalPath(file));
elements.add(file.isDirectory() && file.isInLocalFileSystem() ? new DirectoryCopyPackagingElement(path) : new FileCopyPackagingElement(path));
}
return elements;
}
示例4: getFiles
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
final VirtualFilePointerContainer container = myRoots.get(rootType);
if (container == null) return VirtualFile.EMPTY_ARRAY;
final List<VirtualFile> expanded = new ArrayList<VirtualFile>();
for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
if (pointer == null) continue;
VirtualFile file = pointer.getFile();
if (file == null) continue;
if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
continue;
}
expanded.add(file);
}
return VfsUtilCore.toVirtualFileArray(expanded);
}
示例5: addLibrariesFromModule
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
private static void addLibrariesFromModule(Module module, Collection<String> list) {
final OrderEntry[] entries = ModuleRootManager.getInstance(module).getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry) {
final String name = ((LibraryOrderEntry)entry).getLibraryName();
if (name != null && name.endsWith(LibraryContributingFacet.PYTHON_FACET_LIBRARY_NAME_SUFFIX)) {
// skip libraries from Python facet
continue;
}
for (VirtualFile root : ((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES)) {
final Library library = ((LibraryOrderEntry)entry).getLibrary();
if (!PlatformUtils.isPyCharm()) {
addToPythonPath(root, list);
}
else if (library instanceof LibraryImpl) {
final PersistentLibraryKind<?> kind = ((LibraryImpl)library).getKind();
if (kind == PythonLibraryType.getInstance().getKind()) {
addToPythonPath(root, list);
}
}
}
}
}
}
示例6: createLibraryElements
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Nonnull
@Override
public List<? extends PackagingElement<?>> createLibraryElements(@Nonnull Library library) {
final LibraryTable table = library.getTable();
final String libraryName = library.getName();
if (table != null) {
return Collections.singletonList(createLibraryFiles(libraryName, table.getTableLevel(), null));
}
if (libraryName != null) {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
return Collections.singletonList(createLibraryFiles(libraryName, LibraryTableImplUtil.MODULE_LEVEL, module.getName()));
}
}
final List<PackagingElement<?>> elements = new ArrayList<PackagingElement<?>>();
for (VirtualFile file : library.getFiles(BinariesOrderRootType.getInstance())) {
final String path = FileUtil.toSystemIndependentName(PathUtil.getLocalPath(file));
elements.add(
file.isDirectory() && file.isInLocalFileSystem() ? new DirectoryCopyPackagingElement(path) : new FileCopyPackagingElement(path));
}
return elements;
}
示例7: selectLibrary
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Override
public void selectLibrary(@Nonnull Library library) {
final LibraryTable table = library.getTable();
if (table != null) {
ProjectStructureConfigurable.getInstance(getProject()).selectProjectOrGlobalLibrary(library, true);
}
else {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
final ModuleRootModel rootModel = myParent.getModulesProvider().getRootModel(module);
final String libraryName = library.getName();
for (OrderEntry entry : rootModel.getOrderEntries()) {
if (entry instanceof ModuleLibraryOrderEntryImpl) {
final ModuleLibraryOrderEntryImpl libraryEntry = (ModuleLibraryOrderEntryImpl)entry;
if (libraryName != null && libraryName.equals(libraryEntry.getLibraryName())
|| libraryName == null && library.equals(libraryEntry.getLibrary())) {
ProjectStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
return;
}
}
}
}
}
}
示例8: getLibraryEditor
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
public ExistingLibraryEditor getLibraryEditor(Library library){
final Library source = ((LibraryImpl)library).getSource();
if (source != null) {
return getLibraryEditor(source);
}
ExistingLibraryEditor libraryEditor = myLibrary2EditorMap.get(library);
if (libraryEditor == null){
libraryEditor = createLibraryEditor(library);
}
return libraryEditor;
}
示例9: getSourceOrThis
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@NotNull
private Library getSourceOrThis() {
final InvocationHandler invocationHandler = Proxy.isProxyClass(myLibrary.getClass()) ? Proxy.getInvocationHandler(myLibrary) : null;
final Library realLibrary = invocationHandler instanceof ModuleEditor.ProxyDelegateAccessor ?
(Library)((ModuleEditor.ProxyDelegateAccessor)invocationHandler).getDelegate() : myLibrary;
final Library source = realLibrary instanceof LibraryImpl? ((LibraryImpl)realLibrary).getSource() : null;
return source != null ? source : myLibrary;
}
示例10: update
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
if (myTree.getSelectionPaths() == null || myTree.getSelectionPaths().length != 1) {
e.getPresentation().setEnabled(false);
} else {
e.getPresentation().setEnabled(getSelectedObject() instanceof LibraryImpl);
}
}
示例11: getLibraryTableComment
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
public static String getLibraryTableComment(final Library library) {
LibraryTable libraryTable = library.getTable();
String displayName;
if (libraryTable != null) {
displayName = libraryTable.getPresentation().getDisplayName(false);
}
else {
Module module = ((LibraryImpl)library).getModule();
String tableName = getLibraryTableDisplayName(library);
displayName = module != null ? "'" + module.getName() + "' " + tableName : tableName;
}
return " (" + displayName + ")";
}
示例12: ModuleLibraryOrderEntryImpl
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
private ModuleLibraryOrderEntryImpl(@NotNull Library library, @NotNull RootModelImpl rootModel, boolean isExported, @NotNull DependencyScope scope) {
super(rootModel, ProjectRootManagerImpl.getInstanceImpl(rootModel.getProject()));
myLibrary = ((LibraryImpl)library).cloneLibrary(getRootModel());
doinit();
myExported = isExported;
myScope = scope;
}
示例13: findProjectLibraryElement
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Nullable
private Element findProjectLibraryElement(String name) throws CannotConvertException {
final Collection<? extends Element> libraries = getProjectLibrariesSettings().getProjectLibraries();
final Condition<Element> filter = JDomConvertingUtil.createElementWithAttributeFilter(LibraryImpl.ELEMENT,
LibraryImpl.LIBRARY_NAME_ATTR, name);
return ContainerUtil.find(libraries, filter);
}
示例14: findModuleLibraryElement
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Nullable
private Element findModuleLibraryElement(String libraryName) {
for (Element element : getOrderEntries()) {
if (ModuleLibraryOrderEntryImpl.ENTRY_TYPE.equals(element.getAttributeValue(OrderEntryFactory.ORDER_ENTRY_TYPE_ATTR))) {
final Element library = element.getChild(LibraryImpl.ELEMENT);
if (library != null && libraryName.equals(library.getAttributeValue(LibraryImpl.LIBRARY_NAME_ATTR))) {
return library;
}
}
}
return null;
}
示例15: getProjectLibraries
import com.intellij.openapi.roots.impl.libraries.LibraryImpl; //导入依赖的package包/类
@Override
@NotNull
public Collection<? extends Element> getProjectLibraries() {
final List<Element> result = new ArrayList<Element>();
if (myProjectFile != null) {
result.addAll(JDOMUtil.getChildren(myProjectFile.findComponent("libraryTable"), LibraryImpl.ELEMENT));
}
for (SettingsXmlFile file : myLibrariesFiles) {
result.addAll(JDOMUtil.getChildren(file.getRootElement(), LibraryImpl.ELEMENT));
}
return result;
}