Skip to content

Commit

Permalink
Fix JabRef#4763 and add added required changes in CHANGELOG.md and Ja…
Browse files Browse the repository at this point in the history
…bRef_en.properties
  • Loading branch information
deepakkumar96 committed Mar 21, 2019
1 parent e4c9109 commit 75ec9ce
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ Johannes Manner <[email protected]>
Dominik Traczyk <[email protected]>
Cerrianne Santos <[email protected]>
Stefan Scheffel <[email protected]>
Stefan Gerzmann <[email protected]>
Stefan Gerzmann <[email protected]>
Deepak Kumar <[email protected]>
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We changed the title of Group Dialog to "Add subgroup" from "Edit group" when we select Add subgroup option.
- We enable import button only if entries are selected. [#4755](https://github.com/JabRef/jabref/issues/4755)
- We made modifications to improve contrast of UI elements. [#4583](https://github.com/JabRef/jabref/issues/4583)
- We add an option in preference settings to set what action to be taken by JabRef when right clicking on any entry in any database and selecting "Open folder". [#4763](https://github.com/JabRef/jabref/issues/4763)

### Fixed
- We fixed an issue where corresponding groups are sometimes not highlighted when clicking on entries [#3112](https://github.com/JabRef/jabref/issues/3112)
Expand Down Expand Up @@ -99,7 +100,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where only one PDF file could be imported [#4422](https://github.com/JabRef/jabref/issues/4422)
- We fixed an issue where "Move to group" would always move the first entry in the library and not the selected [#4414](https://github.com/JabRef/jabref/issues/4414)
- We fixed an issue where an older dialog appears when downloading full texts from the quality menu. [#4489](https://github.com/JabRef/jabref/issues/4489)

- We fixed and issue where right clicking on any entry in any database and selecting "Open folder" results in the NullPointer exception. [#4763](https://github.com/JabRef/jabref/issues/4763)



Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/gui/desktop/JabRefDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public static void openFolderAndSelectFile(Path fileLink) throws IOException {
if (Objects.isNull(fileLink)) {
return;
}

boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION);

if(usingDefault) {
Expand All @@ -182,8 +181,8 @@ public static void openFolderAndSelectFile(Path fileLink) throws IOException {
String command = Globals.prefs.get(JabRefPreferences.FILE_BROWSER_COMMAND);
if (!command.isEmpty()) {
command = command.replaceAll("\\s+", " "); // normalize white spaces
// replace the placeholder if used

// replace the placeholder if used
command = command.replace("%DIR", absolutePath);
String[] subcommands = command.split(" ");

Expand All @@ -199,7 +198,6 @@ public static void openFolderAndSelectFile(Path fileLink) throws IOException {
Localization.lang("Error occured while executing the command \"%0\".", command),
Localization.lang("Open File Browser") + " - " + Localization.lang("Error"),
JOptionPane.ERROR_MESSAGE);
JabRefGUI.getMainFrame().output(null);
}
}
}
Expand Down
25 changes: 9 additions & 16 deletions src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,18 @@ public void openFileWithApplication(String filePath, String application) throws

@Override
public void openFolderAndSelectFile(Path filePath) throws IOException {
if(Objects.isNull(System.getenv("DESKTOP_SESSION"))){
LOGGER.error("Unable to open folder, DESKTOP_SESSION not set.");
JabRefGUI.getMainFrame().output(Localization.lang("Unable to open folder, DESKTOP_SESSION not set."));
return;
}

String desktopSession = System.getenv("DESKTOP_SESSION").toLowerCase(Locale.ROOT);
String desktopSession = System.getenv("DESKTOP_SESSION");

String cmd;
String cmd = "xdg-open " + filePath.toAbsolutePath().getParent().toString(); //default command

if (desktopSession.contains("gnome")) {
cmd = "nautilus" + filePath.toString().replace(" ", "\\ ");
} else if (desktopSession.contains("kde")) {
cmd = "dolphin --select " + filePath.toString().replace(" ", "\\ ");
} else {
cmd = "xdg-open " + filePath.toAbsolutePath().getParent().toString();
if(Objects.nonNull(desktopSession)){
desktopSession = desktopSession.toLowerCase(Locale.ROOT);
if (desktopSession.contains("gnome")) {
cmd = "nautilus" + filePath.toString().replace(" ", "\\ ");
} else if (desktopSession.contains("kde")) {
cmd = "dolphin --select " + filePath.toString().replace(" ", "\\ ");
}
}

Runtime.getRuntime().exec(cmd);
}

Expand All @@ -83,7 +77,6 @@ public void openConsole(String absolutePath) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

String emulatorName = reader.readLine();

if (emulatorName != null) {
emulatorName = emulatorName.substring(emulatorName.lastIndexOf(File.separator) + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ private JabRefPreferences() {
defaults.put(ADOBE_ACROBAT_COMMAND, "C:\\Program Files (x86)\\Adobe\\Acrobat Reader DC\\Reader");
defaults.put(SUMATRA_PDF_COMMAND, "C:\\Program Files\\SumatraPDF");
defaults.put(USE_PDF_READER, ADOBE_ACROBAT_COMMAND);
defaults.put(FILE_BROWSER_COMMAND, "explorer.exe /select, \"%DIR\"");
} else {
defaults.put(CONSOLE_COMMAND, "");
defaults.put(ADOBE_ACROBAT_COMMAND, "");
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2129,3 +2129,8 @@ Use\ selected\ document=Use selected document
Accept\ changes=Accept changes
Dismiss\ changes=Dismiss changes
The\ library\ has\ been\ modified\ by\ another\ program.=The library has been modified by another program.
Browser=Browser
Execute\ Command=Execute Command
Open\ File\ Browser=Open File Browser
Use\ default\ file\ browser=Use default file browser

0 comments on commit 75ec9ce

Please sign in to comment.