private Icon getFileItemIcon() { Icon icn = null; if (this.tBrowse.ftpServer.type == FTPType.FILE) { try { JFileChooser chooser = new JFileChooser(); File file = new File(path + File.separator + fileInfo.getName()); if (file.exists()) icn = chooser.getIcon(file); else icn = (fileInfo.isDirectory() ? AppMain.icoFolderLarge : AppMain.icoFileLarge); } catch (Exception e) { icn = (fileInfo.isDirectory() ? AppMain.icoFolderLarge : AppMain.icoFileLarge); } } else if (this.tBrowse.ftpServer.type == FTPType.XSHARE) { icn = fileInfo.isDirectory() ? AppMain.icoFolderLarge : AppMain.icoFileLarge; if (((TGShareFileInfo) fileInfo).isShared()) { icn = IconFactory.getOverlayIcon( this, new ImageIcon(IconFactory.iconToImage(icn)), AppMain.icoShareItem16, SwingConstants.SOUTH_EAST); } } else { icn = (fileInfo.isDirectory() ? AppMain.icoFolderLarge : AppMain.icoFileLarge); } return icn; }
@Override public mpv5.utils.images.MPIcon getIcon() { if (icon == null) { try { Log.Debug(this, "Determining Icon for " + __getCname()); icon = new MPIcon( MPIcon.DIRECTORY_DEFAULT_ICONS + __getCname() .substring(__getCname().lastIndexOf(".") + 1, __getCname().length()) + ".png"); return icon; } catch (Exception e) { Log.Debug(this, "Icon file not existing in " + MPIcon.DIRECTORY_DEFAULT_ICONS); try { JFileChooser chooser = new JFileChooser(); icon = new MPIcon(chooser.getIcon(new File(filename))); return icon; } catch (Exception ez) { Log.Debug(this, ez); icon = new MPIcon(MPIcon.DIRECTORY_DEFAULT_ICONS + "folder_tar.png"); return icon; } } } else { return icon; } }