@Test public void testFindAll() { ApplicationFinder f = new LaunchServicesApplicationFinder(); final List<Application> applications = f.findAll("file.txt"); assertFalse(applications.isEmpty()); assertTrue(applications.contains(new Application("com.apple.TextEdit", "T"))); }
@Override public List<Application> findAll(final String filename) { final String extension = Path.getExtension(filename); if(StringUtils.isEmpty(extension)) { return Collections.emptyList(); } if(!defaultApplicationListCache.contains(extension)) { final List<Application> applications = new ArrayList<Application>(); for(String identifier : this.findAllForType(extension)) { applications.add(this.getDescription(identifier)); } final Application defaultApplication = this.find(filename); if(this.isInstalled(defaultApplication)) { if(!applications.contains(defaultApplication)) { applications.add(defaultApplication); } } defaultApplicationListCache.put(extension, applications); } return defaultApplicationListCache.get(extension); }
LaunchServicesApplicationFinder implements ApplicationFinder { @Override public List<Application> findAll(final String filename) { final String extension = Path.getExtension(filename); if(StringUtils.isEmpty(extension)) { return Collections.emptyList(); } if(!defaultApplicationListCache.contains(extension)) { final List<Application> applications = new ArrayList<Application>(); for(String identifier : this.findAllForType(extension)) { applications.add(this.getDescription(identifier)); } final Application defaultApplication = this.find(filename); if(this.isInstalled(defaultApplication)) { if(!applications.contains(defaultApplication)) { applications.add(defaultApplication); } } defaultApplicationListCache.put(extension, applications); } return defaultApplicationListCache.get(extension); } }
LaunchServicesApplicationFinder implements ApplicationFinder { @Override public List<Application> findAll(final String filename) { final String extension = Path.getExtension(filename); if(StringUtils.isEmpty(extension)) { return Collections.emptyList(); } if(!defaultApplicationListCache.contains(extension)) { final List<Application> applications = new ArrayList<Application>(); for(String identifier : this.findAllForType(extension)) { applications.add(this.getDescription(identifier)); } final Application defaultApplication = this.find(filename); if(this.isInstalled(defaultApplication)) { if(!applications.contains(defaultApplication)) { applications.add(defaultApplication); } } defaultApplicationListCache.put(extension, applications); } return defaultApplicationListCache.get(extension); } LaunchServicesApplicationFinder(); }
LaunchServicesApplicationFinder implements ApplicationFinder { @Override public List<Application> findAll(final String filename) { final String extension = Path.getExtension(filename); if(StringUtils.isEmpty(extension)) { return Collections.emptyList(); } if(!defaultApplicationListCache.contains(extension)) { final List<Application> applications = new ArrayList<Application>(); for(String identifier : this.findAllForType(extension)) { applications.add(this.getDescription(identifier)); } final Application defaultApplication = this.find(filename); if(this.isInstalled(defaultApplication)) { if(!applications.contains(defaultApplication)) { applications.add(defaultApplication); } } defaultApplicationListCache.put(extension, applications); } return defaultApplicationListCache.get(extension); } LaunchServicesApplicationFinder(); @Override List<Application> findAll(final String filename); @Override Application find(final String filename); @Override Application getDescription(final String search); @Override boolean isInstalled(final Application application); boolean register(final Local application); }
LaunchServicesApplicationFinder implements ApplicationFinder { @Override public List<Application> findAll(final String filename) { final String extension = Path.getExtension(filename); if(StringUtils.isEmpty(extension)) { return Collections.emptyList(); } if(!defaultApplicationListCache.contains(extension)) { final List<Application> applications = new ArrayList<Application>(); for(String identifier : this.findAllForType(extension)) { applications.add(this.getDescription(identifier)); } final Application defaultApplication = this.find(filename); if(this.isInstalled(defaultApplication)) { if(!applications.contains(defaultApplication)) { applications.add(defaultApplication); } } defaultApplicationListCache.put(extension, applications); } return defaultApplicationListCache.get(extension); } LaunchServicesApplicationFinder(); @Override List<Application> findAll(final String filename); @Override Application find(final String filename); @Override Application getDescription(final String search); @Override boolean isInstalled(final Application application); boolean register(final Local application);  }