List of usage examples for org.apache.commons.vfs2 FileName getExtension
String getExtension();
From source file:org.metaborg.intellij.idea.projects.ArtifactProjectService.java
/** * Determines whether the specified file name points to a language artifact root. * <p>/*w ww . ja v a 2s . com*/ * For example, <code>zip:file:///dir/archive.spoofax-language!/</code> is a language artifact root. * * @param fileName The file name to check. * @return <code>true</code> when the file is a language artifact root; * otherwise, <code>false</code>. */ private boolean isArtifactRoot(final FileName fileName) { @Nullable final FileName outerFileName = FileNameUtils.getOuterFileName(fileName); if (outerFileName == null) return false; return "spoofax-language".equals(outerFileName.getExtension()); }
From source file:pl.otros.vfs.browser.table.FileNameWithTypeTableCellRenderer.java
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);/* w ww . j a v a 2 s. com*/ FileNameWithType fileNameWithType = (FileNameWithType) value; FileName fileName = fileNameWithType.getFileName(); label.setText(fileName.getBaseName()); label.setToolTipText(fileName.getFriendlyURI()); FileType fileType = fileNameWithType.getFileType(); Icon icon = null; Icons icons = Icons.getInstance(); if (fileNameWithType.getFileName().getBaseName().equals(ParentFileObject.PARENT_NAME)) { icon = icons.getArrowTurn90(); } else if (FileType.FOLDER.equals(fileType)) { icon = icons.getFolderOpen(); } else if (VFSUtils.isArchive(fileName)) { if ("jar".equalsIgnoreCase(fileName.getExtension())) { icon = icons.getJarIcon(); } else { icon = icons.getFolderZipper(); } } else if (FileType.FILE.equals(fileType)) { icon = icons.getFile(); } else if (FileType.IMAGINARY.equals(fileType)) { icon = icons.getShortCut(); } label.setIcon(icon); return label; }
From source file:pl.otros.vfs.browser.util.VFSUtils.java
public static boolean isArchive(FileName fileName) { String extension = fileName.getExtension(); return archivesSuffixes.contains(extension.toLowerCase()); }