public static String uploadFile( FileType filetype, File file, String projectcode, String moduletype) { if (!file.exists()) { logger.error(" file not exists:" + file.getAbsolutePath()); return null; } String upypath = getUpYunBucketPath(projectcode, moduletype, file.getName()); String upyurl = getUpYunBucketUrl(projectcode, filetype, moduletype, file.getName()); if (filetype.equals(FileType.图片)) { boolean result = writeImages(file, upypath); if (result) { return upyurl; } return null; } if (filetype.equals(FileType.文件)) { boolean result = writeFile(file, upypath); if (result) { return upyurl; } return null; } if (filetype.equals(FileType.静态资源)) { boolean result = writeStatic(file, upypath); if (result) { return upyurl; } return null; } return null; }
private static Language calcBaseLanguage(@NotNull VirtualFile file, @NotNull Project project) { if (file instanceof LightVirtualFile) { final Language language = ((LightVirtualFile) file).getLanguage(); if (language != null) { return language; } } FileType fileType = file.getFileType(); // Do not load content if (fileType == UnknownFileType.INSTANCE) { fileType = FileTypeRegistry.getInstance().detectFileTypeFromContent(file); } if (fileType.isBinary()) return Language.ANY; if (isTooLarge(file)) return PlainTextLanguage.INSTANCE; if (fileType instanceof LanguageFileType) { return LanguageSubstitutors.INSTANCE.substituteLanguage( ((LanguageFileType) fileType).getLanguage(), file, project); } final ContentBasedFileSubstitutor[] processors = Extensions.getExtensions(ContentBasedFileSubstitutor.EP_NAME); for (ContentBasedFileSubstitutor processor : processors) { Language language = processor.obtainLanguageForFile(file); if (language != null) return language; } return PlainTextLanguage.INSTANCE; }
private void determineFileType(File file) { for (FileType ft : FileType.values()) { if (file.getName().toLowerCase().endsWith(ft.name().toLowerCase())) { this.fileType = ft; } } }
/** @deprecated since 4.2 use {@link #onMain()} or {@link #onTest()} */ @Deprecated public static FileQuery on(FileType... types) { FileQuery query = new FileQuery(); for (FileType type : types) { query.on(InputFile.ATTRIBUTE_TYPE, type.typeValue()); } return query; }
public boolean openFile(FileSystemItem file, boolean canUseDefault) { FileType fileType = getTypeForFile(file, canUseDefault); if (fileType != null) { fileType.openFile(file, eventBus_); return true; } else { return false; } }
/** * Create text panel with the specified title, text, and mode * * @param container Reference to the container of this panel * @param title Title for this panel, to appear in the title field of a frame, or title of a tab * @param filename The name of the file to be opened * @param type The predefined file type * @param project */ public EPlusEditorPanel( Container container, String title, String filename, FileType type, JEPlusProject project) { initComponents(); initRSTA(type.getRSTA_Style()); FC.setFileFilter(type.getFileFilter()); FC.setMultiSelectionEnabled(false); this.ContainerComponent = container; this.Title = title; this.CurrentFileName = filename; if (CurrentFileName != null) { this.rsTextArea.setText(getFileContent(CurrentFileName)); } this.ContentType = type; this.ContentChanged = false; this.Project = project; switch (ContentType) { case IDF: updateSearchStrings((Project == null) ? null : Project.getSearchStrings()); this.cmdLoad.setEnabled(true); this.cmdCheck.setEnabled(false); this.cmdSave.setEnabled(true); break; case EPW: case RVI: updateSearchStrings(null); this.cmdLoad.setEnabled(false); this.cmdCheck.setEnabled(false); this.cmdSave.setEnabled(true); break; case RVX: updateSearchStrings(RVX.quickIndex()); this.cmdLoad.setEnabled(false); this.cmdCheck.setEnabled(true); this.cmdSave.setEnabled(true); break; case JSON: updateSearchStrings(null); this.cmdLoad.setEnabled(false); this.cmdCheck.setEnabled(true); this.cmdSave.setEnabled(false); break; case PYTHON: case CSV: case XML: case PLAIN: default: updateSearchStrings(null); this.cmdLoad.setEnabled(true); this.cmdCheck.setEnabled(false); this.cmdSave.setEnabled(true); } // this.cboSearchStrings.setEditable(true); this.Document = rsTextArea.getDocument(); Document.addDocumentListener(this); }
/** * @param bytes * @return */ public static FileType guessType(byte[] bytes) { Preconditions.isTrue(bytes.length >= 32); String hexHeader = fileHexHeader(bytes); for (FileType type : FileType.values()) { if (hexHeader.startsWith(type.getHexHeader())) { return type; } } return null; }
public void editFile(FileSystemItem file, FilePosition position) { if (satellite_.isCurrentWindowSatellite()) { satellite_.focusMainWindow(); callSatelliteEditFile(file.cast(), position.cast()); } else { FileType fileType = getTypeForFile(file); if (!(fileType instanceof TextFileType)) fileType = TEXT; if (fileType != null) fileType.openFile(file, position, eventBus_); } }
boolean manualContains(FileType[] fileTypes) { loadFolders(); for (BSAFolder folder : folders.values()) { for (String file : folder.files.keySet()) { for (FileType type : fileTypes) { if (file.endsWith(type.toString())) { return true; } } } } return false; }
@Override protected boolean validate(File obj) throws ParameterException { if (!super.validate(obj)) { return false; } if (fileType.equals(FileType.INPUT_FILE)) { try { if (!obj.exists()) { throw new WrongParameterValueException( "Given file " + obj.getPath() + " for parameter \"" + getName() + "\" does not exist!\n"); } } catch (SecurityException e) { throw new WrongParameterValueException( "Given file \"" + obj.getPath() + "\" cannot be read, access denied!\n" + e.getMessage()); } } return true; }
/** * @param fileType Filetype to query for. * @return True if BSA contains files of that type. */ public boolean contains(FileType fileType) { if (!fileFlags.isZeros()) { return fileFlags.get(fileType.ordinal()); } else { return manualContains(fileType); } }
public static FileType parseType(String extension) { for (FileType t : FileType.values()) { if (t.extension.equals(extension)) { return t; } } return FileType.UNKNOWN; }
@Override public String toString() { if (type.isSymlink()) { return String.format( "(%s: link_value=%s, real_path=%s)", type, unresolvedSymlinkTarget.getPathString(), realPath); } else { return String.format("(%s: real_path=%s)", type, realPath); } }
public void editFile(FileSystemItem file, FilePosition position, boolean highlightLine) { // edit the file in the main window unless this is a source satellite // (in which case we want to edit it locally) if (satellite_.isCurrentWindowSatellite() && !satellite_.getSatelliteName().startsWith(SourceSatellite.NAME_PREFIX)) { satellite_.focusMainWindow(); callSatelliteEditFile(file.cast(), position.cast(), highlightLine); } else { FileType fileType = getTypeForFile(file); if (fileType != null && !(fileType instanceof TextFileType)) fileType = TEXT; if (fileType != null) fileType.openFile( file, position, highlightLine ? NavigationMethods.HIGHLIGHT_LINE : NavigationMethods.DEFAULT, eventBus_); } }
@SuppressWarnings("unchecked") public static String getMD5(FileType type, String version) { YAMLProcessor config = MinecraftYML.getMinecraftYML(); Map<String, Map<String, String>> builds = (Map<String, Map<String, String>>) config.getProperty("versions"); if (builds.containsKey(version)) { Map<String, String> files = builds.get(version); return files.get(type.name()); } return null; }
public void openFile(final FileSystemItem file, final boolean canUseBrowser) { FileType fileType = getTypeForFile(file); if (fileType != null) { fileType.openFile(file, eventBus_); } else { // build default command to use if we have an error or the // file is not a text file final Command defaultCommand = new Command() { @Override public void execute() { if (canUseBrowser) { if (session_.getSessionInfo().getAllowFileDownloads()) { BROWSER.openFile(file, eventBus_); } else { globalDisplay_.showErrorMessage( "File Download Error", "Unable to show file because file downloads are " + "restricted on this server.\n"); } } } }; // check with the server to see if this is likely to be a text file server_.isTextFile( file.getPath(), new ServerRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean isText) { if (isText) TEXT.openFile(file, eventBus_); else defaultCommand.execute(); } @Override public void onError(ServerError error) { defaultCommand.execute(); } }); } }
public static String getMD5(FileType type, String version) { String md5 = getMD5Internal(type, version); if (md5 == null) { logger.log( Level.WARNING, "No MD5 Information found for filetype " + type.name() + ", for minecraft version: " + version); } return md5; }
@Nullable protected PsiFile createFile( @NotNull Project project, @NotNull VirtualFile file, @NotNull FileType fileType) { if (fileType.isBinary() || file.isSpecialFile()) { return new PsiBinaryFileImpl((PsiManagerImpl) getManager(), this); } if (!isTooLarge(file)) { final PsiFile psiFile = createFile(getBaseLanguage()); if (psiFile != null) return psiFile; } return new PsiPlainTextFileImpl(this); }
private PsiFile createFile() { try { final VirtualFile vFile = getVirtualFile(); if (vFile.isDirectory()) return null; if (isIgnored()) return null; final Project project = myManager.getProject(); if (isPhysical()) { // check directories consistency final VirtualFile parent = vFile.getParent(); if (parent == null) return null; final PsiDirectory psiDir = getManager().findDirectory(parent); if (psiDir == null) return null; } FileType fileType = vFile.getFileType(); PsiFile file = null; if (fileType.isBinary() || vFile.isSpecialFile()) { // TODO check why ClsFileImpl doesn't created automatically with create method file = new ClsFileImpl((PsiManagerImpl) getManager(), this); // file = new PsiBinaryFileImpl((PsiManagerImpl) getManager(), this); } else { if (!isTooLarge(vFile)) { final PsiFile psiFile = createFile(getBaseLanguage()); if (psiFile != null) file = psiFile; } else { file = new PsiPlainTextFileImpl(this); } } return file; } catch (ProcessCanceledException e) { e.printStackTrace(); throw e; } catch (Throwable e) { e.printStackTrace(); LOG.error(e); return null; } }
@SuppressWarnings("unchecked") private static String getMD5Internal(FileType type, String version) { YAMLProcessor config = Resources.Minecraft.getYAML(); try { Map<String, Object> versions = (Map<String, Object>) config.getProperty("versions"); Map<String, Object> map = (Map<String, Object>) versions.get(version); return (String) map.get(type.toString()); } catch (NullPointerException npe) { logger.log(Level.SEVERE, "MD5 Configuration was not populated!", npe); } catch (Exception e) { logger.log(Level.SEVERE, "Failed to read md5", e); } return null; }
public UserFile setType(FileType fileType) { this.type = fileType.getName(); return this; }
public UserFile setTypeByExtention(String extention) { this.type = FileType.findByExtention(extention).getName(); return this; }
@Override public boolean run(DatabaseRegistryEntry dbre) { boolean result = true; Connection con = dbre.getConnection(); FileType fileType = getFileType(); TableName tableName = getTableName(); HashMap<Integer, String> tableIDs = getTableIDs(dbre); try { for (Object o : tableIDs.entrySet()) { Map.Entry<Integer, String> pair = (Map.Entry<Integer, String>) o; int tableID = pair.getKey(); String name = pair.getValue(); // fetch file path for every table_id Statement stmt = con.createStatement(); ResultSet filePath = stmt.executeQuery( "SELECT path FROM " + "dbfile_registry WHERE table_name='" + tableName.toString() + "' AND file_type='" + fileType.toString() + "' AND table_id=" + tableID); if (!filePath.next()) { ReportManager.problem( this, con, "No " + fileType.toString() + " file entry found in " + "dbfile_registry table for " + tableName.toString() + " " + name + " with id " + tableID); result = false; } else { // check that the file actually exists on the disk String parentFuncgenDir = getSpeciesAssemblyDataFileBasePath(dbre); File file = new File(parentFuncgenDir + filePath.getString(1)); if (!file.exists()) { ReportManager.problem( this, con, " File " + file.getPath() + " does not exist on the disk."); result = false; } } } } catch (SQLException e) { e.printStackTrace(); } return result; }
public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof FileType)) return false; FileType other = (FileType) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.fileId == null && other.getFileId() == null) || (this.fileId != null && this.fileId.equals(other.getFileId()))) && ((this.fileType == null && other.getFileType() == null) || (this.fileType != null && this.fileType.equals(other.getFileType()))) && this.fileSize == other.getFileSize() && ((this.sourceURI == null && other.getSourceURI() == null) || (this.sourceURI != null && this.sourceURI.equals(other.getSourceURI()))) && ((this.createTime == null && other.getCreateTime() == null) || (this.createTime != null && this.createTime.equals(other.getCreateTime()))) && ((this.editTime == null && other.getEditTime() == null) || (this.editTime != null && this.editTime.equals(other.getEditTime()))) && ((this.fileDistributeList == null && other.getFileDistributeList() == null) || (this.fileDistributeList != null && java.util.Arrays.equals( this.fileDistributeList, other.getFileDistributeList()))); __equalsCalc = null; return _equals; }
/** * 接收文件数据。 * * @param name * @param request */ public void receive(String name, HttpServletRequest request) { ServletFileUpload upload = new ServletFileUpload(this.factory); upload.setSizeMax(this.fileSizeMax); upload.setHeaderEncoding("UTF-8"); // 设置文件上传进度监听器 FileProgressListener pl = new FileProgressListener(name, request.getSession()); upload.setProgressListener(pl); try { List<FileItem> items = upload.parseRequest(request); for (FileItem item : items) { if (!item.isFormField()) { // 原始文件名 String originFileName = item.getName(); // 文件后缀名 String extension = FileUtils.extractFileExtension(originFileName); // 文件别名 String aliasFileName = Utils.randomString(32) + "." + extension; FileType fileType = FileType.parseType(extension); if (FileType.UNKNOWN != fileType) { // 存储路径 String strFilePath = this.storePath + name + "/"; // 创建工作目录 File filePath = new File(this.workPath + name + "/"); if (!filePath.exists()) { filePath.mkdirs(); } // 创建存储目录 filePath = new File(strFilePath); if (!filePath.exists()) { filePath.mkdirs(); } filePath = null; // 删除相同文件 SharedFile sf = this.existSharedFile(originFileName); if (null != sf) { sf.delete(); this.removeSharedFile(sf); } // 原文件 File originFile = new File(strFilePath, originFileName); // 别名文件 File aliasFile = new File(this.workPath + name + "/", aliasFileName); sf = new SharedFile(name, originFile, aliasFile, fileType, request.getSession()); // 添加分享文件 this.addSharedFile(sf); synchronized (pl.files) { pl.files.add(sf); } // 写文件 item.write(originFile); request.getSession().setAttribute("name", name); request.getSession().setAttribute("filename", originFileName); } else { // 不支持的类型 Logger.w(this.getClass(), "不支持的文件类型: " + originFileName); request.getSession().setAttribute("name", name); request.getSession().setAttribute("filename", originFileName); request.getSession().setAttribute("state", 300); } } } // 结束 pl.finish(); } catch (FileUploadException e) { Logger.log(this.getClass(), e, LogLevel.ERROR); } catch (Exception e) { Logger.log(this.getClass(), e, LogLevel.ERROR); } }
private void cmdRefreshActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cmdRefreshActionPerformed if (ContentType.equals(FileType.IDF)) { updateSearchStrings((Project == null) ? null : Project.getSearchStrings()); } } // GEN-LAST:event_cmdRefreshActionPerformed
/** * 根据Java文件类型获取Package声明 * * @param type * @return */ public static String getPackage(FileType type) { if (type.getPakage() == null || "".equals(type.getPakage())) return BASE_PACKAGE + "." + type.getType(); else return type.getPakage(); }
@Inject public FileTypeRegistry(EventBus eventBus, Satellite satellite) { eventBus_ = eventBus; satellite_ = satellite; if (!satellite_.isCurrentWindowSatellite()) exportEditFileCallback(); FileIconResources icons = ICONS; register("", TEXT, icons.iconText()); register("*.txt", TEXT, icons.iconText()); register("*.log", TEXT, icons.iconText()); register("README", TEXT, icons.iconText()); register(".gitignore", TEXT, icons.iconText()); register("*.r", R, icons.iconRdoc()); register(".rprofile", R, icons.iconRprofile()); register("Rprofile.site", R, icons.iconRprofile()); register("DESCRIPTION", DCF, icons.iconText()); register("NAMESPACE", NAMESPACE, icons.iconText()); register("*.rhistory", RHISTORY, icons.iconRhistory()); register("*.rproj", RPROJECT, icons.iconRproject()); register("*.rnw", SWEAVE, icons.iconRsweave()); register("*.snw", SWEAVE, icons.iconRsweave()); register("*.nw", SWEAVE, icons.iconRsweave()); register("*.tex", TEX, icons.iconTex()); register("*.latex", TEX, icons.iconTex()); register("*.sty", TEX, icons.iconTex()); register("*.cls", TEX, icons.iconTex()); register("*.bbl", TEX, icons.iconTex()); register("*.rhtml", RHTML, icons.iconRhtml()); register("*.htm", HTML, icons.iconHTML()); register("*.html", HTML, icons.iconHTML()); register("*.css", CSS, icons.iconCss()); register("*.js", JS, icons.iconJavascript()); register("*.rmd", RMARKDOWN, icons.iconRmarkdown()); register("*.rmarkdown", RMARKDOWN, icons.iconRmarkdown()); register("*.md", MARKDOWN, icons.iconMarkdown()); register("*.mdtxt", MARKDOWN, icons.iconMarkdown()); register("*.markdown", MARKDOWN, icons.iconMarkdown()); register("*.bib", TEXT, icons.iconText()); register("*.c", C, icons.iconC()); register("*.cpp", CPP, icons.iconCpp()); register("*.h", H, icons.iconH()); register("*.hpp", HPP, icons.iconHpp()); register("*.Rout.save", TEXT, icons.iconText()); register("*.rd", RD, icons.iconRd()); register("*.rdata", RDATA, icons.iconRdata()); register("*.rda", RDATA, icons.iconRdata()); register("*.Rproj", RPROJECT, icons.iconRproject()); register("*.dcf", DCF, icons.iconText()); defaultType_ = BROWSER; registerIcon(".jpg", icons.iconPng()); registerIcon(".jpeg", icons.iconPng()); registerIcon(".gif", icons.iconPng()); registerIcon(".bmp", icons.iconPng()); registerIcon(".tiff", icons.iconPng()); registerIcon(".tif", icons.iconPng()); registerIcon(".png", icons.iconPng()); registerIcon(".pdf", icons.iconPdf()); registerIcon(".csv", icons.iconCsv()); for (FileType fileType : FileType.ALL_FILE_TYPES) { assert !fileTypesByTypeName_.containsKey(fileType.getTypeId()); fileTypesByTypeName_.put(fileType.getTypeId(), fileType); } }
@Inject public FileTypeRegistry( EventBus eventBus, Satellite satellite, Session session, GlobalDisplay globalDisplay, FilesServerOperations server) { eventBus_ = eventBus; satellite_ = satellite; server_ = server; session_ = session; globalDisplay_ = globalDisplay; if (!satellite_.isCurrentWindowSatellite()) exportEditFileCallback(); FileIconResources icons = ICONS; register("", TEXT, icons.iconText()); register("*.txt", TEXT, icons.iconText()); register("*.log", TEXT, icons.iconText()); register("README", TEXT, icons.iconText()); register(".gitignore", TEXT, icons.iconText()); register(".Rbuildignore", TEXT, icons.iconText()); register("packrat.lock", DCF, icons.iconText()); register("*.r", R, icons.iconRdoc()); register("*.q", R, icons.iconRdoc()); register("*.s", R, icons.iconRdoc()); register(".rprofile", R, icons.iconRprofile()); register("Rprofile.site", R, icons.iconRprofile()); register("DESCRIPTION", DCF, icons.iconText()); register("INDEX", TEXT, icons.iconText()); register("LICENCE", TEXT, icons.iconText()); register("MD5", TEXT, icons.iconText()); register("NEWS", TEXT, icons.iconText()); register("PORTING", TEXT, icons.iconText()); register("COPYING", TEXT, icons.iconText()); register("COPYING.LIB", TEXT, icons.iconText()); register("BUGS", TEXT, icons.iconText()); register("CHANGES", TEXT, icons.iconText()); register("CHANGELOG", TEXT, icons.iconText()); register("INSTALL", SH, icons.iconSh()); register("TODO", TEXT, icons.iconText()); register("THANKS", TEXT, icons.iconText()); register("configure", SH, icons.iconSh()); register("configure.win", SH, icons.iconSh()); register("cleanup", SH, icons.iconSh()); register("cleanup.win", SH, icons.iconSh()); register("Makevars", SH, icons.iconSh()); register("Makevars.win", SH, icons.iconSh()); register("TUTORIAL", DCF, icons.iconText()); register("NAMESPACE", NAMESPACE, icons.iconText()); register("*.rhistory", RHISTORY, icons.iconRhistory()); register("*.rproj", RPROJECT, icons.iconRproject()); register("*.rnw", SWEAVE, icons.iconRsweave()); register("*.snw", SWEAVE, icons.iconRsweave()); register("*.nw", SWEAVE, icons.iconRsweave()); register("*.tex", TEX, icons.iconTex()); register("*.latex", TEX, icons.iconTex()); register("*.sty", TEX, icons.iconTex()); register("*.cls", TEX, icons.iconTex()); register("*.bbl", TEX, icons.iconTex()); register("*.dtx", TEX, icons.iconTex()); register("*.ins", TEX, icons.iconTex()); register("*.rhtml", RHTML, icons.iconRhtml()); register("*.htm", HTML, icons.iconHTML()); register("*.html", HTML, icons.iconHTML()); register("*.css", CSS, icons.iconCss()); register("*.js", JS, icons.iconJavascript()); register("*.json", JSON, icons.iconJavascript()); register("*.rmd", RMARKDOWN, icons.iconRmarkdown()); register("*.rmarkdown", RMARKDOWN, icons.iconRmarkdown()); register("*.rpres", RPRESENTATION, icons.iconRpresentation()); register("*.md", MARKDOWN, icons.iconMarkdown()); register("*.mdtxt", MARKDOWN, icons.iconMarkdown()); register("*.markdown*", MARKDOWN, icons.iconMarkdown()); register("*.bib", TEXT, icons.iconText()); register("*.c", C, icons.iconC()); register("*.cpp", CPP, icons.iconCpp()); register("*.cc", CPP, icons.iconCpp()); register("*.h", H, icons.iconH()); register("*.hpp", HPP, icons.iconHpp()); register("*.f", TEXT, icons.iconText()); register("*.Rout.save", TEXT, icons.iconText()); register("*.rd", RD, icons.iconRd()); register("*.rdata", RDATA, icons.iconRdata()); register("*.rda", RDATA, icons.iconRdata()); register("*.Rproj", RPROJECT, icons.iconRproject()); register("*.dcf", DCF, icons.iconText()); register("*.mmd", MERMAID, icons.iconMermaid()); register("*.gv", GRAPHVIZ, icons.iconGraphviz()); register("*.dot", GRAPHVIZ, icons.iconGraphviz()); register("*.py", PYTHON, icons.iconPython()); register("*.sql", SQL, icons.iconSql()); register("*.sh", SH, icons.iconSh()); register("*.yml", YAML, icons.iconYaml()); register("*.yaml", YAML, icons.iconYaml()); register("*.xml", XML, icons.iconXml()); register("*.stan", STAN, icons.iconStan()); register("*.clj", CLOJURE, icons.iconClojure()); register("*.cloj", CLOJURE, icons.iconClojure()); register("*.clojure", CLOJURE, icons.iconClojure()); register("*.coffee", COFFEE, icons.iconCoffee()); register("*.cs", CSHARP, icons.iconCsharp()); register(".gitignore", GITIGNORE, icons.iconGitignore()); register("*.go", GO, icons.iconGo()); register("*.groovy", GROOVY, icons.iconGroovy()); register("*.haskell", HASKELL, icons.iconHaskell()); register("*.haxe", HAXE, icons.iconHaxe()); register("*.java", JAVA, icons.iconJava()); register("*.julia", JULIA, icons.iconJulia()); register("*.lisp", LISP, icons.iconLisp()); register(".emacs", LISP, icons.iconLisp()); register("*.el", LISP, icons.iconLisp()); register("*.lua", LUA, icons.iconLua()); register("*.m", MATLAB, icons.iconMatlab()); register("*.pl", PERL, icons.iconPerl()); register("*.rb", RUBY, icons.iconRuby()); register("*.rs", RUST, icons.iconRust()); register("*.scala", SCALA, icons.iconScala()); register("*.snippets", SNIPPETS, icons.iconSnippets()); registerIcon(".jpg", icons.iconPng()); registerIcon(".jpeg", icons.iconPng()); registerIcon(".gif", icons.iconPng()); registerIcon(".bmp", icons.iconPng()); registerIcon(".tiff", icons.iconPng()); registerIcon(".tif", icons.iconPng()); registerIcon(".png", icons.iconPng()); registerIcon(".pdf", icons.iconPdf()); registerIcon(".csv", icons.iconCsv()); registerIcon(".docx", icons.iconWord()); for (FileType fileType : FileType.ALL_FILE_TYPES) { assert !fileTypesByTypeName_.containsKey(fileType.getTypeId()); fileTypesByTypeName_.put(fileType.getTypeId(), fileType); } }