Arq: add libs to container - draft

This commit is contained in:
Nikolay Mikhaylov
2015-09-17 15:44:52 +03:00
parent 8cd684dac7
commit 8d0681819e
2 changed files with 17 additions and 17 deletions
@@ -68,22 +68,18 @@ public class RepositoryLibrarySupport {
}
final DependencyScope dependencyScope = LibraryDependencyScopeSuggester.getDefaultScope(library);
final ModifiableRootModel moduleModifiableModel = modifiableModelsProvider.getModuleModifiableModel(module);
try {
LibraryOrderEntry foundEntry =
(LibraryOrderEntry)Iterables.find(Arrays.asList(moduleModifiableModel.getOrderEntries()), new Predicate<OrderEntry>() {
@Override
public boolean apply(@Nullable OrderEntry entry) {
return entry instanceof LibraryOrderEntry
&& ((LibraryOrderEntry)entry).getScope() == dependencyScope
&& isLibraryEqualsToSelected(((LibraryOrderEntry)entry).getLibrary());
}
}, null);
if (foundEntry == null) {
rootModel.addLibraryEntry(library).setScope(dependencyScope);
}
}
finally {
moduleModifiableModel.dispose();
LibraryOrderEntry foundEntry =
(LibraryOrderEntry)Iterables.find(Arrays.asList(moduleModifiableModel.getOrderEntries()), new Predicate<OrderEntry>() {
@Override
public boolean apply(@Nullable OrderEntry entry) {
return entry instanceof LibraryOrderEntry
&& ((LibraryOrderEntry)entry).getScope() == dependencyScope
&& isLibraryEqualsToSelected(((LibraryOrderEntry)entry).getLibrary());
}
}, null);
modifiableModelsProvider.disposeModuleModifiableModel(moduleModifiableModel);
if (foundEntry == null) {
rootModel.addLibraryEntry(library).setScope(dependencyScope);
}
}
@@ -74,7 +74,11 @@ public class RepositoryLibraryType extends LibraryType<RepositoryLibraryProperti
if (properties == null || !(properties instanceof RepositoryLibraryProperties)) {
return MavenIcons.MavenLogo;
}
return RepositoryLibraryDescription.findDescription((RepositoryLibraryProperties)properties).getIcon();
RepositoryLibraryProperties repositoryLibraryProperties = (RepositoryLibraryProperties)properties;
if (repositoryLibraryProperties.getGroupId() == null || repositoryLibraryProperties.getArtifactId() == null) {
return MavenIcons.MavenLogo;
}
return RepositoryLibraryDescription.findDescription(repositoryLibraryProperties).getIcon();
}
@NotNull