public void unregister() { try { forceUnregister(SERVICE.getFileExtensionAssociation(extention)); forceUnregister(SERVICE.getMimeTypeAssociation(extention)); } catch (IllegalArgumentException ignored) { // SEE: LWC-1170 LOG.warn("Can't unregister!", ignored); } }
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))); }
public void register() { try { SERVICE.registerUserAssociation(association); SystemUtils.flushIconCache(); } catch (AssociationAlreadyRegisteredException ignore) { LOG.error("can't register", ignore); } catch (RegisterFailedException ignore) { LOG.error("can't register", ignore); } }
private void forceUnregister(Association f) { if (f == null) return; try { SERVICE.unregisterUserAssociation(f); SystemUtils.flushIconCache(); } catch (AssociationNotRegisteredException ignore) { LOG.error("can't unregister", ignore); } catch (RegisterFailedException ignore) { LOG.error("can't unregister", ignore); } }
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)); }