com.intellij.openapi.roots.libraries.PersistentLibraryKind Java Examples

The following examples show how to use com.intellij.openapi.roots.libraries.PersistentLibraryKind. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LibraryGroupNode.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
static VirtualFile[] getLibraryRoots(@Nonnull LibraryOrderEntry orderEntry) {
  Library library = orderEntry.getLibrary();
  if (library == null) return VirtualFile.EMPTY_ARRAY;
  OrderRootType[] rootTypes = LibraryType.getDefaultExternalRootTypes();
  if (library instanceof LibraryEx) {
    if (((LibraryEx)library).isDisposed()) return VirtualFile.EMPTY_ARRAY;
    PersistentLibraryKind<?> libKind = ((LibraryEx)library).getKind();
    if (libKind != null) {
      rootTypes = LibraryType.findByKind(libKind).getExternalRootTypes();
    }
  }
  final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
  for (OrderRootType rootType : rootTypes) {
    files.addAll(Arrays.asList(library.getFiles(rootType)));
  }
  return VfsUtilCore.toVirtualFileArray(files);
}
 
Example #2
Source File: FileOrDirectoryDependencyTabContext.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Library createLibraryFromRoots(ModifiableModuleRootLayer layer, List<OrderRoot> roots, @Nullable final LibraryType libraryType) {
  final LibraryTable.ModifiableModel moduleLibraryModel = layer.getModuleLibraryTable().getModifiableModel();

  final PersistentLibraryKind kind = libraryType == null ? null : libraryType.getKind();
  final Library library = ((LibraryTableBase.ModifiableModelEx)moduleLibraryModel).createLibrary(null, kind);
  final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();

  for (OrderRoot root : roots) {
    if (root.isJarDirectory()) {
      libModel.addJarDirectory(root.getFile(), false, root.getType());
    }
    else {
      libModel.addRoot(root.getFile(), root.getType());
    }
  }
  libModel.commit();
  return library;
}
 
Example #3
Source File: LibraryTableBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Library createLibrary(String name, @javax.annotation.Nullable PersistentLibraryKind kind) {
  assertWritable();
  final LibraryImpl library = new LibraryImpl(name, kind, LibraryTableBase.this, null);
  myLibraries.add(library);
  return library;
}
 
Example #4
Source File: SandLibraryType.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
protected SandLibraryType() {
  super(new PersistentLibraryKind<DummyLibraryProperties>("sand") {
    @Nonnull
    @Override
    public DummyLibraryProperties createDefaultProperties() {
      return new DummyLibraryProperties();
    }
  });
}
 
Example #5
Source File: LibrariesModifiableModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Library createLibrary(String name, @Nullable PersistentLibraryKind type) {
  final Library library = ((LibraryTableBase.ModifiableModelEx)getLibrariesModifiableModel()).createLibrary(name, type);
  //createLibraryEditor(library);                     \
  final BaseLibrariesConfigurable configurable = ProjectStructureConfigurable.getInstance(myProject).getConfigurableFor(library);
  configurable.createLibraryNode(library);
  return library;
}
 
Example #6
Source File: PythonLibraryType.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
public PythonLibraryType() {
  super(
    new PersistentLibraryKind<LibraryVersionProperties>("dummy.type") {
      @NotNull
      @Override
      public LibraryVersionProperties createDefaultProperties() {
        return new LibraryVersionProperties();
      }
    }
  );
}
 
Example #7
Source File: FlutterPluginsLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
@NotNull
protected PersistentLibraryKind<FlutterPluginLibraryProperties> getLibraryKind() {
  return FlutterPluginLibraryType.LIBRARY_KIND;
}
 
Example #8
Source File: LibraryTableImplUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static Library createModuleLevelLibrary(@Nullable String name,
                                               final PersistentLibraryKind kind,
                                               ModuleRootLayerImpl rootModel) {
  return new LibraryImpl(name, kind, null, rootModel);
}
 
Example #9
Source File: AndroidModuleLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
@Override
protected PersistentLibraryKind<AndroidModuleLibraryProperties> getLibraryKind() {
  return LIBRARY_KIND;
}
 
Example #10
Source File: ModuleLibraryTable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Library createLibrary(String name, @javax.annotation.Nullable PersistentLibraryKind kind) {
  final ModuleLibraryOrderEntryImpl orderEntry = new ModuleLibraryOrderEntryImpl(name, kind, myRootLayer);
  myRootLayer.addOrderEntry(orderEntry);
  return orderEntry.getLibrary();
}
 
Example #11
Source File: ModuleLibraryOrderEntryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
ModuleLibraryOrderEntryImpl(String name, final PersistentLibraryKind kind, ModuleRootLayerImpl moduleRootLayer) {
  super(ModuleLibraryOrderEntryType.getInstance(), moduleRootLayer, ProjectRootManagerImpl.getInstanceImpl(moduleRootLayer.getProject()));
  myLibrary = LibraryTableImplUtil.createModuleLevelLibrary(name, kind, moduleRootLayer);
  Disposer.register(this, myLibrary);
  init();
}
 
Example #12
Source File: LibraryEx.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
PersistentLibraryKind<?> getKind();
 
Example #13
Source File: AbstractLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
protected abstract PersistentLibraryKind<K> getLibraryKind();
 
Example #14
Source File: FlutterPluginsLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
@NotNull
protected PersistentLibraryKind<FlutterPluginLibraryProperties> getLibraryKind() {
  return FlutterPluginLibraryType.LIBRARY_KIND;
}
 
Example #15
Source File: AbstractLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
protected abstract PersistentLibraryKind<K> getLibraryKind();
 
Example #16
Source File: AndroidModuleLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
@Override
protected PersistentLibraryKind<AndroidModuleLibraryProperties> getLibraryKind() {
  return LIBRARY_KIND;
}
 
Example #17
Source File: LibraryTableBase.java    From consulo with Apache License 2.0 votes vote down vote up
Library createLibrary(String name, @Nullable PersistentLibraryKind type); 
Example #18
Source File: LibraryEx.java    From consulo with Apache License 2.0 votes vote down vote up
void setKind(PersistentLibraryKind<?> type); 
Example #19
Source File: LibraryEx.java    From consulo with Apache License 2.0 votes vote down vote up
PersistentLibraryKind<?> getKind();