From 042dd1a2abe121507daf4afd64193c65c8a9dd7d Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Fri, 3 May 2013 11:53:43 +0300 Subject: [PATCH] support more file types --- .../FileAssociationManager.java | 66 +++++++++++-------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java b/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java index 68f8a91..df40676 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java @@ -10,38 +10,13 @@ public class FileAssociationManager { private static final String TEXT_EDITOR = "scribes"; - private static final String FILE_INDICATOR = ""; - - public static HashMap extensionToApplication = new HashMap(); + private static final String DOCUMENT_EDITOR = "lowriter"; - public FileAssociationManager() { + private static final String SPREADSHEET_EDITOR = "localc"; - extensionToApplication.put("txt", new String[] { TEXT_EDITOR, FILE_INDICATOR }); - extensionToApplication.put("xml", new String[] { TEXT_EDITOR, FILE_INDICATOR }); - extensionToApplication.put("properties", new String[] { TEXT_EDITOR, FILE_INDICATOR }); - extensionToApplication.put("ini", new String[] { TEXT_EDITOR, FILE_INDICATOR }); - extensionToApplication.put("", new String[] { TEXT_EDITOR, FILE_INDICATOR }); - - extensionToApplication.put("jpg", new String[] { "eog", FILE_INDICATOR }); - extensionToApplication.put("jpeg", new String[] { "eog", FILE_INDICATOR }); - extensionToApplication.put("png", new String[] { "eog", FILE_INDICATOR }); - - extensionToApplication.put("pdf", new String[] { "evince", FILE_INDICATOR }); - - extensionToApplication.put("mp3", new String[] { "banshee", FILE_INDICATOR }); - extensionToApplication.put("ogg", new String[] { "banshee", FILE_INDICATOR }); - - extensionToApplication.put("avi", new String[] { "vlc", FILE_INDICATOR }); - extensionToApplication.put("mkv", new String[] { "vlc", FILE_INDICATOR }); - extensionToApplication.put("ogv", new String[] { "vlc", FILE_INDICATOR }); - extensionToApplication.put("mp4", new String[] { "vlc", FILE_INDICATOR }); - extensionToApplication.put("flv", new String[] { "vlc", FILE_INDICATOR }); - extensionToApplication.put("wmv", new String[] { "vlc", FILE_INDICATOR }); - - extensionToApplication.put("ods", new String[] { "localc", FILE_INDICATOR }); - extensionToApplication.put("docx", new String[] { "lowriter", FILE_INDICATOR }); + private static final String FILE_INDICATOR = ""; - } + public static HashMap extensionToApplication = new HashMap(); public static boolean openFile(final File file) { @@ -77,4 +52,37 @@ public class FileAssociationManager { } + public FileAssociationManager() { + + extensionToApplication.put("txt", new String[] { TEXT_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("xml", new String[] { TEXT_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("properties", new String[] { TEXT_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("ini", new String[] { TEXT_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("", new String[] { TEXT_EDITOR, FILE_INDICATOR }); + + extensionToApplication.put("jpg", new String[] { "eog", FILE_INDICATOR }); + extensionToApplication.put("jpeg", new String[] { "eog", FILE_INDICATOR }); + extensionToApplication.put("png", new String[] { "eog", FILE_INDICATOR }); + + extensionToApplication.put("pdf", new String[] { "evince", FILE_INDICATOR }); + + extensionToApplication.put("mp3", new String[] { "banshee", FILE_INDICATOR }); + extensionToApplication.put("ogg", new String[] { "banshee", FILE_INDICATOR }); + + extensionToApplication.put("avi", new String[] { "vlc", FILE_INDICATOR }); + extensionToApplication.put("mkv", new String[] { "vlc", FILE_INDICATOR }); + extensionToApplication.put("ogv", new String[] { "vlc", FILE_INDICATOR }); + extensionToApplication.put("mp4", new String[] { "vlc", FILE_INDICATOR }); + extensionToApplication.put("flv", new String[] { "vlc", FILE_INDICATOR }); + extensionToApplication.put("wmv", new String[] { "vlc", FILE_INDICATOR }); + + extensionToApplication.put("ods", new String[] { SPREADSHEET_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("xls", new String[] { SPREADSHEET_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("xlsx", new String[] { SPREADSHEET_EDITOR, FILE_INDICATOR }); + + extensionToApplication.put("docx", new String[] { DOCUMENT_EDITOR, FILE_INDICATOR }); + extensionToApplication.put("doc", new String[] { DOCUMENT_EDITOR, FILE_INDICATOR }); + + } + } -- 2.20.1