コード例 #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 FileTypeAssociation(
     String extention,
     String mimeType,
     String executable,
     String verb,
     String description,
     String iconPath) {
   this.extention = extention;
   this.mimeType = mimeType;
   this.executable = executable;
   this.verb = verb;
   Action action = new Action(verb, executable);
   association.addAction(action);
   association.addFileExtension(extention);
   association.setMimeType(mimeType);
   association.setName(description); // only used on unix
   association.setDescription(description);
   if (iconPath != null) // don't chance passing null to jdic
   association.setIconFileName(iconPath);
 }