2 * Instantlauncher. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
9 package eu.svjatoslav.instantlauncher;
11 import eu.svjatoslav.instantlauncher.configuration.ConfigurationManager;
12 import eu.svjatoslav.instantlauncher.configuration.FileAssociation;
15 import java.io.IOException;
17 import static eu.svjatoslav.instantlauncher.Utils.runOpeningApplication;
19 public class InstantLauncher {
21 private final MainFrame mainFrame;
22 public ConfigurationManager configurationManager;
24 public InstantLauncher() throws IOException {
25 configurationManager = new ConfigurationManager();
26 mainFrame = new MainFrame(this);
29 public static void exitProgram() {
34 * @return <code>true</code> if file was opened. <code>false</code> if
37 public boolean openFile(final File file) {
38 FileAssociation fileAssociation = configurationManager.getConfiguration().findFileAssociation(file);
39 if (fileAssociation == null) return false;
41 runOpeningApplication(fileAssociation.command, file);
49 public void openDirectory(File chosenFile) {
50 runOpeningApplication(configurationManager.getConfiguration().directoryOpenCommand, chosenFile);
53 public void openDirectoryInTerminal(File chosenFile) {
54 runOpeningApplication(configurationManager.getConfiguration().directoryTerminalOpenCommand, chosenFile);