Skip to content

Commit

Permalink
Merge pull request #69 from technology16/bug_fix
Browse files Browse the repository at this point in the history
fixed bug with awt
  • Loading branch information
baslo2 authored Jul 26, 2024
2 parents dfa0252 + 6fdbd27 commit b7e33bb
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});

Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit b7e33bb

Please sign in to comment.