コード例 #1
0
 public boolean isRegistered() {
   Association f;
   try {
     f = SERVICE.getFileExtensionAssociation(extention);
   } catch (IllegalArgumentException iae) {
     // SEE: LWC-1170
     LOG.warn("Can't check registration!", iae);
     return false;
   }
   if (f == null) return false;
   Action open = f.getActionByVerb(verb);
   if (open == null) return false;
   if (executable.equals(open.getCommand())) return true;
   return executable.equals(SystemUtils.getDefaultExtentionHandler(extention))
       && executable.equals(SystemUtils.getDefaultMimeHandler(mimeType));
 }
コード例 #2
0
  public boolean isAvailable() {
    try {
      // if no association at all, then it is available
      Association f = SERVICE.getFileExtensionAssociation(extention);
      if (f == null && f == SERVICE.getMimeTypeAssociation(mimeType)) return true;
    } catch (IllegalArgumentException iae) {
      // SEE: LWC-1170
      // If JDIC bails on us, the registry might be a little confused...
      // so let's fix it by inserting ours.
      LOG.warn("Can't check availability!", iae);
      return true;
    }

    // still check for a default handler.
    String extHandler = SystemUtils.getDefaultExtentionHandler(extention);
    return ("".equals(extHandler) && "".equals(SystemUtils.getDefaultMimeHandler(mimeType)));
  }