Example #1
0
  public static Icon getIcon(final String name, final ExtensionsFilterInterface extension) {
    Icon newIcon = null;
    final String ext = Files.getExtension(name);
    if (CrossSystem.isWindows() && ext != null) {
      try {
        newIcon = CrossSystem.getMime().getFileIcon(ext, 16, 16);

      } catch (Throwable e) {
        LogController.CL().log(e);
      }
    }
    if (newIcon == null) {
      String iconID = null;
      if (extension != null && extension.getIconID() != null) {
        iconID = extension.getIconID();
      }
      if (StringUtils.isEmpty(iconID)) {
        iconID = "file";
      }
      newIcon = NewTheme.I().getIcon(iconID, 16);
    }
    return newIcon;
  }
Example #2
0
 @Override
 public Boolean isSupported(final ArchiveFactory factory, final boolean allowDeepInspection) {
   if (splitType.matches(factory.getFilePath())) {
     if (factory instanceof DownloadLinkArchiveFactory) {
       for (final DownloadLink link : ((DownloadLinkArchiveFactory) factory).getDownloadLinks()) {
         final ExtensionsFilterInterface hint =
             CompiledFiletypeFilter.getExtensionsFilterInterface(link.getMimeHint());
         if (hint != null
             && !hint.isSameExtensionGroup(CompiledFiletypeFilter.ArchiveExtensions.NUM)) {
           return false;
         }
       }
     } else if (factory instanceof CrawledLinkFactory) {
       for (final CrawledLink link : ((CrawledLinkFactory) factory).getLinks()) {
         final DownloadLink dlLink = link.getDownloadLink();
         if (dlLink != null) {
           final ExtensionsFilterInterface hint =
               CompiledFiletypeFilter.getExtensionsFilterInterface(dlLink.getMimeHint());
           if (hint != null
               && !hint.isSameExtensionGroup(CompiledFiletypeFilter.ArchiveExtensions.NUM)) {
             return false;
           }
         }
       }
     }
     if (allowDeepInspection) {
       try {
         return SplitType.createArchive(factory, splitType, allowDeepInspection) != null;
       } catch (ArchiveException e) {
         getLogger().log(e);
       }
     } else {
       return true;
     }
   }
   return false;
 }