1 20 21 package org.jdesktop.jdic.filetypes.internal; 22 23 import java.net.URL ; 24 import java.util.List ; 25 26 27 30 public class GnomeAppAssociationReader implements AppAssociationReader { 31 32 38 public String getDescriptionByMimeType(String mimeType) { 39 return GnomeAssociationUtil.getDescriptionByMimeType(mimeType); 40 } 41 42 48 public String getDescriptionByFileExt(String fileExt) { 49 fileExt = AppUtility.removeDotFromFileExtension(fileExt); 51 if (getMimeTypeByFileExt(fileExt) == null) { 52 return null; 53 } else { 54 return getDescriptionByMimeType(getMimeTypeByFileExt(fileExt)); 55 } 56 } 57 58 65 public String getMimeTypeByURL(URL url) { 66 return GnomeAssociationUtil.getMimeTypeByURL(url); 67 } 68 69 75 public List getFileExtListByMimeType(String mimeType) { 76 return GnomeAssociationUtil.getFileExtListByMimeType(mimeType); 77 } 78 79 85 public String getMimeTypeByFileExt(String fileExt) { 86 fileExt = AppUtility.removeDotFromFileExtension(fileExt); 88 return GnomeAssociationUtil.getMimeTypeByFileExt(fileExt); 89 } 90 91 97 public String getIconFileNameByMimeType(String mimeType) { 98 return GnomeAssociationUtil.getIconFileNameByMimeType(mimeType); 99 } 100 101 107 public String getIconFileNameByFileExt(String fileExt) { 108 fileExt = AppUtility.removeDotFromFileExtension(fileExt); 110 if (getMimeTypeByFileExt(fileExt) == null) { 111 return null; 112 } else { 113 return getIconFileNameByMimeType(getMimeTypeByFileExt(fileExt)); 114 } 115 } 116 117 123 public List getActionListByMimeType(String mimeType) { 124 return GnomeAssociationUtil.getActionListByMimeType(mimeType); 125 } 126 127 133 public List getActionListByFileExt(String fileExt) { 134 fileExt = AppUtility.removeDotFromFileExtension(fileExt); 136 if (getMimeTypeByFileExt(fileExt) == null) { 137 return null; 138 } else { 139 return getActionListByMimeType(getMimeTypeByFileExt(fileExt)); 140 } 141 } 142 143 149 public boolean isMimeTypeExist(String mimeType) { 150 boolean isExist = GnomeAssociationUtil.isMimeTypeExist(mimeType); 153 154 if (!isExist) { 155 String iconFileName = getIconFileNameByMimeType(mimeType); 157 String description = getDescriptionByMimeType(mimeType); 158 List actionList = getActionListByMimeType(mimeType); 159 160 if (iconFileName != null || description != null || actionList != null) { 162 isExist = true; 163 } 164 } 165 166 return isExist; 167 } 168 169 175 public boolean isFileExtExist(String fileExt) { 176 fileExt = AppUtility.removeDotFromFileExtension(fileExt); 178 179 return GnomeAssociationUtil.isFileExtExist(fileExt); 180 } 181 } 182 | Popular Tags |