@Override
 public List<String> identifyType(final VirtualFile file) {
   final String filename = file.getName();
   if (filename != null) {
     final int dotPos = filename.lastIndexOf('.');
     if (dotPos
         < 1) { // either -1 (not found) or 0 (first position, for example .project or .codenvy
                // etc.
       Log.debug(ExtensionFileTypeIdentifier.class, "File name has no suffix ");
       return null;
     }
     final String suffix = filename.substring(dotPos + 1);
     Log.debug(ExtensionFileTypeIdentifier.class, "Looking for a type for suffix " + suffix);
     List<String> result = mappings.get(suffix);
     Log.debug(ExtensionFileTypeIdentifier.class, "Found mime-types: " + printList(result));
     return result;
   }
   return null;
 }
예제 #2
0
 @Inject(optional = true)
 private void register(Set<ImportWizardRegistrar> registrars) {
   for (ImportWizardRegistrar registrar : registrars) {
     final String id = registrar.getImporterId();
     if (this.registrars.containsKey(id)) {
       Log.warn(
           ImportWizardRegistryImpl.class,
           "Wizard for project importer " + id + " already registered.");
     } else {
       this.registrars.put(id, registrar);
     }
   }
 }