diff --git a/src/main/java/ru/taximaxim/pgsqlblocks/modules/blocksjournal/view/BlocksJournalView.java b/src/main/java/ru/taximaxim/pgsqlblocks/modules/blocksjournal/view/BlocksJournalView.java index 6b38098..f346623 100644 --- a/src/main/java/ru/taximaxim/pgsqlblocks/modules/blocksjournal/view/BlocksJournalView.java +++ b/src/main/java/ru/taximaxim/pgsqlblocks/modules/blocksjournal/view/BlocksJournalView.java @@ -102,13 +102,12 @@ protected Control createContents(Composite parent) { openDirToolItem.setImage(ImageUtils.getImage(Images.FOLDER)); openDirToolItem.setToolTipText(resourceBundle.getString("open_dir")); openDirToolItem.addListener(SWT.Selection, event -> { - File file = new File(Settings.getInstance().getBlocksJournalPath()); try { - Desktop.getDesktop().open(file); - } catch (Exception ex) { - MessageBox m = new MessageBox(getShell(), SWT.ICON_ERROR); - m.setMessage(ex.getLocalizedMessage()); - m.open(); + openJournalFolder(); + } catch (IOException ex) { + MessageBox m = new MessageBox(getShell(), SWT.ICON_ERROR); + m.setMessage(ex.getMessage()); + m.open(); } }); @@ -154,6 +153,21 @@ protected Control createContents(Composite parent) { return super.createContents(parent); } + private void openJournalFolder() throws IOException { + File file = new File(Settings.getInstance().getBlocksJournalPath()); + + if (Desktop.isDesktopSupported()) { + Desktop.getDesktop().open(file); + } else { + Runtime runtime = Runtime.getRuntime(); + if (System.getenv("OS") != null && System.getenv("OS").contains("Windows")) { + runtime.exec("rundll32 url.dll,FileProtocolHandler " + file); + } else { + runtime.exec("xdg-open " + file); + } + } + } + private void openProcessDialogInfo(Object dbProcess){ new DBProcessInfoDialog(resourceBundle, this.getShell(), dbProcess, true).open(); }