use of com.intellij.openapi.roots.libraries.LibraryProperties in project intellij-community by JetBrains.
the class RepositoryLibraryDependencyScopeSuggester method getDefaultDependencyScope.
@Nullable
@Override
public DependencyScope getDefaultDependencyScope(@NotNull Library library) {
if (!(library instanceof LibraryEx)) {
return null;
}
LibraryEx libraryEx = (LibraryEx) library;
LibraryProperties libraryProperties = libraryEx.getProperties();
if (libraryProperties == null || !(libraryProperties instanceof RepositoryLibraryProperties)) {
return null;
}
RepositoryLibraryProperties repositoryLibraryProperties = (RepositoryLibraryProperties) libraryProperties;
RepositoryLibraryDescription libraryDescription = RepositoryLibraryDescription.findDescription(repositoryLibraryProperties);
return libraryDescription.getSuggestedScope();
}
use of com.intellij.openapi.roots.libraries.LibraryProperties in project intellij-community by JetBrains.
the class RepositoryLibrarySupport method isLibraryEqualsToSelected.
private boolean isLibraryEqualsToSelected(Library library) {
if (!(library instanceof LibraryEx)) {
return false;
}
LibraryEx libraryEx = (LibraryEx) library;
if (!RepositoryLibraryType.REPOSITORY_LIBRARY_KIND.equals(libraryEx.getKind())) {
return false;
}
LibraryProperties libraryProperties = libraryEx.getProperties();
if (libraryProperties == null || !(libraryProperties instanceof RepositoryLibraryProperties)) {
return false;
}
RepositoryLibraryProperties repositoryLibraryProperties = (RepositoryLibraryProperties) libraryProperties;
RepositoryLibraryDescription description = RepositoryLibraryDescription.findDescription(repositoryLibraryProperties);
if (!description.equals(libraryDescription)) {
return false;
}
return Comparing.equal(repositoryLibraryProperties.getVersion(), model.getVersion());
}
use of com.intellij.openapi.roots.libraries.LibraryProperties in project intellij-plugins by JetBrains.
the class DartUrlResolverImpl method initPackagesMapFromLib.
private void initPackagesMapFromLib(@NotNull final VirtualFile contextFile) {
final Module module = ModuleUtilCore.findModuleForFile(contextFile, myProject);
final List<OrderEntry> orderEntries = module != null ? Arrays.asList(ModuleRootManager.getInstance(module).getOrderEntries()) : ProjectRootManager.getInstance(myProject).getFileIndex().getOrderEntriesForFile(contextFile);
for (OrderEntry orderEntry : orderEntries) {
if (orderEntry instanceof LibraryOrderEntry && LibraryTablesRegistrar.PROJECT_LEVEL.equals(((LibraryOrderEntry) orderEntry).getLibraryLevel()) && DartPackagesLibraryType.DART_PACKAGES_LIBRARY_NAME.equals(((LibraryOrderEntry) orderEntry).getLibraryName())) {
final LibraryEx library = (LibraryEx) ((LibraryOrderEntry) orderEntry).getLibrary();
final LibraryProperties properties = library == null ? null : library.getProperties();
if (properties instanceof DartPackagesLibraryProperties) {
for (Map.Entry<String, List<String>> entry : ((DartPackagesLibraryProperties) properties).getPackageNameToDirsMap().entrySet()) {
if (entry != null && entry.getKey() != null && entry.getValue() != null) {
myPackagesMapFromLib.put(entry.getKey(), entry.getValue());
}
}
return;
}
}
}
}
Aggregations