+ /**
+ * @return <code>true</code> if file was opened. <code>false</code> if unknown file type.
+ */
+ public static boolean openFile(final File file) {
+
+ if (isLogFile(file.getName())){
+ runOpeningApplication(file, new String[] { "glogg", FILE_INDICATOR });
+ return true;
+ }
+
+ final String fileExtension = Utils.getFileExtension(file);
+
+ if (extensionToApplication.containsKey(fileExtension)) {
+ final String[] commands = extensionToApplication.get(fileExtension);
+ runOpeningApplication(file, commands);
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ private static void runOpeningApplication(final File file, final String[] commands) {
+ for (int i = 0; i < commands.length; i++) {
+ if (commands[i].equals(FILE_INDICATOR)) {
+ commands[i] = file.getAbsolutePath();
+ }
+ }
+
+ try {
+ Runtime.getRuntime().exec(commands);
+ InstantLauncher.exitProgram();
+
+ } catch (final IOException e) {
+ new ExceptionDialog(e);
+ }
+ }
+
+ private static boolean isLogFile(String fileName) {
+ if (fileName.endsWith(".out")) {
+ return true;
+ }
+ if (fileName.endsWith(".log")) {
+ return true;
+ }
+ if (fileName.contains(".log.")) {
+ return true;
+ }
+
+ return false;
+ }
+