From: Svjatoslav Agejenko Date: Fri, 26 Apr 2013 11:19:38 +0000 (+0300) Subject: scribes is broken, using workaround X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=9a575510e22502a2ac47345aac40457d4e295956;p=instantlauncher.git scribes is broken, using workaround --- diff --git a/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java b/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java index e9ffd0f..f6741b5 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/FileAssociationManager.java @@ -8,41 +8,12 @@ import eu.svjatoslav.commons.gui.dialog.ExceptionDialog; public class FileAssociationManager { - private static final String TEXT_EDITOR = "scribes"; + private static final String TEXT_EDITOR = "gd"; private static final String FILE_INDICATOR = ""; public static HashMap extensionToApplication = new HashMap(); - 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[] { "localc", FILE_INDICATOR }); - extensionToApplication.put("docx", new String[] { "lowriter", FILE_INDICATOR }); - - } - public static boolean openFile(final File file) { final String fileExtension = Utils.getFileExtension(file); @@ -57,14 +28,11 @@ public class FileAssociationManager { final String[] c = new String[commands.length]; - for (int i = 0; i < commands.length; i++) { - - if (commands[i].equals(FILE_INDICATOR)) { + for (int i = 0; i < commands.length; i++) + if (commands[i].equals(FILE_INDICATOR)) c[i] = file.getAbsolutePath(); - } else { + else c[i] = commands[i]; - } - } try { Runtime.getRuntime().exec(c); @@ -75,9 +43,37 @@ public class FileAssociationManager { } return true; - } else { + } else return false; - } + + } + + 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[] { "localc", FILE_INDICATOR }); + extensionToApplication.put("docx", new String[] { "lowriter", FILE_INDICATOR }); }