Translated IconManager to Scala from Java.
@@ -1,75 +0,0 @@ | ||
1 | -package jp.sf.amateras.rdiffbackup.util; | |
2 | - | |
3 | -import java.io.File; | |
4 | - | |
5 | -/** | |
6 | - * ファイルの種類に応じたアイコンを取得するためのユーティリティです。 | |
7 | - * | |
8 | - * @author Naoki Takezoe | |
9 | - */ | |
10 | -public class IconManager { | |
11 | - | |
12 | - /** | |
13 | - * ファイルの種類に応じたアイコンのパスを返却します。 | |
14 | - * | |
15 | - * @param file ファイル | |
16 | - * @return アイコンのパス | |
17 | - */ | |
18 | - public static String getIcon(File file){ | |
19 | - if(file.isDirectory()){ | |
20 | - return getIconPath("folder.png"); | |
21 | - } | |
22 | - | |
23 | - String name = file.getName(); | |
24 | - | |
25 | - if(name.endsWith(".xls") || name.endsWith(".xlsx")){ | |
26 | - return getIconPath("page_white_excel.png"); | |
27 | - } | |
28 | - if(name.endsWith(".doc") || name.endsWith(".docx")){ | |
29 | - return getIconPath("page_white_word.png"); | |
30 | - } | |
31 | - if(name.endsWith(".ppt") || name.endsWith(".pptx")){ | |
32 | - return getIconPath("page_white_powerpoint.png"); | |
33 | - } | |
34 | - if(name.endsWith(".java")){ | |
35 | - return getIconPath("page_white_cup.png"); | |
36 | - } | |
37 | - if(name.endsWith(".c")){ | |
38 | - return getIconPath("page_white_c.png"); | |
39 | - } | |
40 | - if(name.endsWith(".cpp")){ | |
41 | - return getIconPath("page_white_cplusplus.png"); | |
42 | - } | |
43 | - if(name.endsWith(".h")){ | |
44 | - return getIconPath("page_white_h.png"); | |
45 | - } | |
46 | - if(name.endsWith(".php")){ | |
47 | - return getIconPath("page_white_php.png"); | |
48 | - } | |
49 | - if(name.endsWith(".exe") || name.endsWith(".bat") || name.endsWith(".sh")){ | |
50 | - return getIconPath("page_white_gear.png"); | |
51 | - } | |
52 | - if(name.endsWith(".cs")){ | |
53 | - return getIconPath("page_white_csharp.png"); | |
54 | - } | |
55 | - if(name.endsWith(".html")){ | |
56 | - return getIconPath("page_white_world.png"); | |
57 | - } | |
58 | -// if(name.endsWith(".css")){ | |
59 | -// return getIconPath("page_white_code.png"); | |
60 | -// } | |
61 | - if(name.endsWith(".zip") || name.endsWith(".lzh") || name.endsWith(".gz") || name.endsWith(".tar")){ | |
62 | - return getIconPath("package.png"); | |
63 | - } | |
64 | - if(name.endsWith(".pdf")){ | |
65 | - return getIconPath("page_white_acrobat.png"); | |
66 | - } | |
67 | - | |
68 | - return getIconPath("page_white.png"); | |
69 | - } | |
70 | - | |
71 | - private static String getIconPath(String icon){ | |
72 | - return "/images/" + icon; | |
73 | - } | |
74 | - | |
75 | -} |