X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Finstantlauncher%2Fmenu%2FMultiLevelMenu.java;h=3297259f8c3f2c9a6e89b7a439e37b60b85f02b7;hb=6f3b6383805ab24b835adaa7845e9306880ff7a3;hp=bc370466dfd9a8dc3d55b22af57854764f7a917e;hpb=ea9f229a2b0d0be0e765bdd508948b28cd2d490e;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 bc37046..3297259 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java @@ -1,6 +1,5 @@ package eu.svjatoslav.instantlauncher.menu; -import eu.svjatoslav.commons.gui.dialog.ExceptionDialog; import eu.svjatoslav.instantlauncher.InstantLauncher; import eu.svjatoslav.instantlauncher.Utils; @@ -68,7 +67,7 @@ public class MultiLevelMenu implements MenuListener { contentPane.add(panel); } - final File directory = instantLauncher.configurationManager.getNavigationRootDirectory(); + final File directory = instantLauncher.configurationManager.getConfiguration().getNavigationRootDirectory(); addMenu(directory); return contentPane; @@ -103,17 +102,17 @@ public class MultiLevelMenu implements MenuListener { } @Override - public void menuItemSelected(final Menu menu, final File chosenFile) { + public void menuItemSelected(final File chosenFile) { if (chosenFile.isFile()) { if (chosenFile.canExecute()) { - executeCommand(chosenFile.getAbsolutePath()); + instantLauncher.executeCommand(chosenFile.getAbsolutePath()); } else { boolean fileOpened; try { fileOpened = instantLauncher.openFile(chosenFile.getCanonicalFile()); - if (fileOpened) { + if (fileOpened) InstantLauncher.exitProgram(); - } + } catch (IOException e) { e.printStackTrace(); } @@ -122,30 +121,20 @@ public class MultiLevelMenu implements MenuListener { if (chosenFile.isDirectory()) { try { - executeCommand("nautilus", "-w", chosenFile.getCanonicalFile().getAbsolutePath()); + instantLauncher.openDirectory(chosenFile.getCanonicalFile()); } catch (IOException e) { e.printStackTrace(); } } } - private void executeCommand(String... c) { - try { - Runtime.getRuntime().exec(c); - InstantLauncher.exitProgram(); - - } catch (final IOException e) { - new ExceptionDialog(e); - } - } - @Override - public void menuItemSelectedAlternative(final Menu menu, final File chosenFile) { - if (chosenFile.isFile()) { + public void menuItemSelectedAlternative(final File chosenFile) { + if (chosenFile.isFile()) chosenFile.setExecutable(!chosenFile.canExecute()); - } else { + else { try { - executeCommand("gnome-terminal", "--working-directory=" + instantLauncher.executeCommand("gnome-terminal", "--working-directory=" + chosenFile.getCanonicalFile().getAbsolutePath()); } catch (IOException e) { e.printStackTrace(); @@ -166,10 +155,10 @@ public class MultiLevelMenu implements MenuListener { } @Override - public void menuItemSelectedAlternative2(Menu menu, File chosenFile) { + public void menuItemSelectedAlternative2(File chosenFile) { if (chosenFile.isFile()) { try { - executeCommand("emacs", chosenFile.getCanonicalFile().getAbsolutePath()); + instantLauncher.executeCommand("emacs", chosenFile.getCanonicalFile().getAbsolutePath()); } catch (IOException e) { e.printStackTrace(); }