Skip to content

Commit

Permalink
Fix #43
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGrosjean committed Sep 6, 2020
1 parent d0121ee commit 4ae69de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gui/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,11 @@ public void actionPerformed(ActionEvent e) {
contextMenu.add(checkLineItem);

JMenuItem openSourceFileItem = new JMenuItem("Open source file in the default software");
openSourceFileItem.addActionListener(new OpenFile(ws.getSourceLanguage()));
openSourceFileItem.addActionListener(new OpenFile(ws.getSourceLanguage(), true));
contextMenu.add(openSourceFileItem);

JMenuItem openDestFileItem = new JMenuItem("Open destination file in the default software");
openDestFileItem.addActionListener(new OpenFile(ws.getSourceLanguage()));
openDestFileItem.addActionListener(new OpenFile(ws.getDestinationLanguage(), false));
contextMenu.add(openDestFileItem);

// Select a line by right clicking
Expand Down Expand Up @@ -647,9 +647,11 @@ public void actionPerformed(ActionEvent arg0) {

class OpenFile implements ActionListener {
private Language language;
private boolean source;

OpenFile(Language language) {
OpenFile(Language language, boolean source) {
this.language = language;
this.source = source;
}

@Override
Expand All @@ -665,7 +667,7 @@ public void actionPerformed(ActionEvent e) {
if (file instanceof CK2ParsedFile) {
filePath = directory + f.getName();
} else if (table.getValueAt(row, FILE_COLUMN) instanceof HoI4ParsedFile) {
filePath = ((HoI4ParsedFile) table.getValueAt(row, FILE_COLUMN)).getFilePath(language, true);
filePath = ((HoI4ParsedFile) table.getValueAt(row, FILE_COLUMN)).getFilePath(language, source);
}
try {
Desktop.getDesktop().open(new File(filePath));
Expand Down

0 comments on commit 4ae69de

Please # to comment.