X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Finstantlauncher%2Fmenu%2FMultiLevelMenu.java;h=347766eb7f6951a45d0306f29003745f62a54020;hb=155895d0ed0f436753bf862287341830653a9c9f;hp=3297259f8c3f2c9a6e89b7a439e37b60b85f02b7;hpb=6f3b6383805ab24b835adaa7845e9306880ff7a3;p=instantlauncher.git diff --git a/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java b/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java index 3297259..347766e 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java @@ -1,3 +1,11 @@ +/* + * 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.menu; import eu.svjatoslav.instantlauncher.InstantLauncher; @@ -9,6 +17,8 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import static eu.svjatoslav.instantlauncher.Utils.executeCommand; + public class MultiLevelMenu implements MenuListener { private static final int VERTICAL_MENUS_COUNT = 7; @@ -105,7 +115,8 @@ public class MultiLevelMenu implements MenuListener { public void menuItemSelected(final File chosenFile) { if (chosenFile.isFile()) { if (chosenFile.canExecute()) { - instantLauncher.executeCommand(chosenFile.getAbsolutePath()); + executeCommand(chosenFile.getAbsolutePath()); + InstantLauncher.exitProgram(); } else { boolean fileOpened; try { @@ -122,6 +133,7 @@ public class MultiLevelMenu implements MenuListener { if (chosenFile.isDirectory()) { try { instantLauncher.openDirectory(chosenFile.getCanonicalFile()); + InstantLauncher.exitProgram(); } catch (IOException e) { e.printStackTrace(); } @@ -133,12 +145,8 @@ public class MultiLevelMenu implements MenuListener { if (chosenFile.isFile()) chosenFile.setExecutable(!chosenFile.canExecute()); else { - try { - instantLauncher.executeCommand("gnome-terminal", "--working-directory=" - + chosenFile.getCanonicalFile().getAbsolutePath()); - } catch (IOException e) { - e.printStackTrace(); - } + instantLauncher.openDirectoryInTerminal(chosenFile); + InstantLauncher.exitProgram(); } } @@ -156,13 +164,7 @@ public class MultiLevelMenu implements MenuListener { @Override public void menuItemSelectedAlternative2(File chosenFile) { - if (chosenFile.isFile()) { - try { - instantLauncher.executeCommand("emacs", chosenFile.getCanonicalFile().getAbsolutePath()); - } catch (IOException e) { - e.printStackTrace(); - } - } + // TODO: define some middle mouse click functions }