@NotNull
  @Override
  public Set<UsageDescriptor> getProjectUsages(@Nullable Project project) {
    if (project == null) return Collections.emptySet();

    final Set<LibraryKind> usedKinds = new HashSet<LibraryKind>();
    final Processor<Library> processor =
        new Processor<Library>() {
          @Override
          public boolean process(Library library) {
            usedKinds.addAll(LibraryPresentationManagerImpl.getLibraryKinds(library, null));
            return true;
          }
        };
    for (Module module : ModuleManager.getInstance(project).getModules()) {
      ModuleRootManager.getInstance(module)
          .orderEntries()
          .librariesOnly()
          .forEachLibrary(processor);
    }

    final HashSet<UsageDescriptor> usageDescriptors = new HashSet<UsageDescriptor>();
    for (LibraryKind kind : usedKinds) {
      usageDescriptors.add(new UsageDescriptor(kind.getKindId(), 1));
    }
    return usageDescriptors;
  }
public class JsHeaderLibraryPresentationProvider
    extends LibraryPresentationProvider<LibraryVersionProperties> {
  public static final LibraryKind KOTLIN_JAVASCRIPT_HEADER_KIND =
      LibraryKind.create("kotlin-js-header");

  public static JsHeaderLibraryPresentationProvider getInstance() {
    return LibraryPresentationProvider.EP_NAME.findExtension(
        JsHeaderLibraryPresentationProvider.class);
  }

  protected JsHeaderLibraryPresentationProvider() {
    super(KOTLIN_JAVASCRIPT_HEADER_KIND);
  }

  @Nullable
  @Override
  public Icon getIcon() {
    return JetIcons.SMALL_LOGO_13;
  }

  @Nullable
  @Override
  public LibraryVersionProperties detect(@NotNull List<VirtualFile> classesRoots) {
    return JsHeaderLibraryDetectionUtil.isJsHeaderLibraryDetected(classesRoots)
        ? new LibraryVersionProperties(null)
        : null;
  }
}
Пример #3
0
  private void readProperties(Element element) {
    final String typeId = element.getAttributeValue(LIBRARY_TYPE_ATTR);
    if (typeId == null) return;

    myKind = (PersistentLibraryKind<?>) LibraryKind.findById(typeId);
    if (myKind == null) return;

    myProperties = myKind.createDefaultProperties();
    final Element propertiesElement = element.getChild(PROPERTIES_ELEMENT);
    if (propertiesElement != null) {
      ComponentSerializationUtil.loadComponentState(myProperties, propertiesElement);
    }
  }
Пример #4
0
 LibraryImpl(LibraryTable table, Element element, ModifiableRootModel rootModel)
     throws InvalidDataException {
   this(
       table,
       rootModel,
       null,
       element.getAttributeValue(LIBRARY_NAME_ATTR),
       (PersistentLibraryKind<?>)
           LibraryKind.findById(element.getAttributeValue(LIBRARY_TYPE_ATTR)));
   readProperties(element);
   myJarDirectories.readExternal(element);
   readRoots(element);
   myRootsWatcher.updateWatchedRoots();
 }
Пример #5
0
 public MoonLibraryType() {
   super(LibraryKind.<MoonLibraryProperties>create(MOON_LIBRARY_TYPE_ID));
 }
Пример #6
0
/** Created by IntelliJ IDEA. User: Jon S Akhtar Date: 8/24/12 Time: 6:09 PM */
public interface LuaLibrary {
  String LUA_LIBRARY_TYPE_ID = "Lua";
  String LUA_LIBRARY_CATEGORY_NAME = "Lua";
  String LUA_LIBRARY_KIND_ID = "Lua";
  LibraryKind KIND = LibraryKind.create(LUA_LIBRARY_KIND_ID);
}