X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Finstantlauncher%2FInstantLauncher.java;h=8c844bac3eae9ff30f2a36a881f6cea63af4e8ae;hb=155895d0ed0f436753bf862287341830653a9c9f;hp=b21b2b3cb6616f64198641d8290a4ab6f566a4d4;hpb=ea9f229a2b0d0be0e765bdd508948b28cd2d490e;p=instantlauncher.git
diff --git a/src/main/java/eu/svjatoslav/instantlauncher/InstantLauncher.java b/src/main/java/eu/svjatoslav/instantlauncher/InstantLauncher.java
index b21b2b3..8c844ba 100755
--- a/src/main/java/eu/svjatoslav/instantlauncher/InstantLauncher.java
+++ b/src/main/java/eu/svjatoslav/instantlauncher/InstantLauncher.java
@@ -1,8 +1,15 @@
+/*
+ * Instantlauncher. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ */
+
package eu.svjatoslav.instantlauncher;
import eu.svjatoslav.instantlauncher.configuration.ConfigurationManager;
import eu.svjatoslav.instantlauncher.configuration.FileAssociation;
-import org.apache.log4j.Logger;
import java.io.File;
import java.io.IOException;
@@ -11,15 +18,18 @@ import static eu.svjatoslav.instantlauncher.Utils.runOpeningApplication;
public class InstantLauncher {
- private static final Logger LOGGER = Logger.getLogger(InstantLauncher.class);
+ private final MainFrame mainFrame;
public ConfigurationManager configurationManager;
- final MainFrame mainFrame;
public InstantLauncher() throws IOException {
configurationManager = new ConfigurationManager();
mainFrame = new MainFrame(this);
}
+ public static void exitProgram() {
+ System.exit(0);
+ }
+
/**
* @return true
if file was opened. false
if
* unknown file type.
@@ -28,19 +38,20 @@ public class InstantLauncher {
FileAssociation fileAssociation = configurationManager.getConfiguration().findFileAssociation(file);
if (fileAssociation == null) return false;
- final String[] commands = fileAssociation.getCommands();
- runOpeningApplication(file, commands);
+ runOpeningApplication(fileAssociation.command, file);
+ return true;
+ }
- return false;
+ public void run() {
+ mainFrame.show();
}
- public static void exitProgram() {
- LOGGER.info("Closing InstantLauncher");
- System.exit(0);
+ public void openDirectory(File chosenFile) {
+ runOpeningApplication(configurationManager.getConfiguration().directoryOpenCommand, chosenFile);
}
- public void run() throws IOException {
- mainFrame.show();
+ public void openDirectoryInTerminal(File chosenFile) {
+ runOpeningApplication(configurationManager.getConfiguration().directoryTerminalOpenCommand, chosenFile);
}
}