Skip to content

Commit

Permalink
code refactor for ExportCommand export method and update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
LingZhang22 committed Mar 19, 2022
1 parent f11321f commit 540d0b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
### Added

- We added an extra option when right-clicking an entry in the Entry List to copy either the DOI or the DOI url.
- We added an extra option to ask the user whether they want to open the folder where they saved the file with the file selected [#8195] (https://github.com/JabRef/jabref/issues/8195)
- We added an extra option to ask the user whether they want to open to reveal the folder holding the saved file with the file selected. [#8195]([https://github.com/JabRef/jabref/issues/8195][#8195])

### Changed

Expand Down Expand Up @@ -774,3 +774,5 @@ The changelog of JabRef 2.11 and all previous versions is available as [text fil
[5.0-alpha]: https://github.com/JabRef/jabref/compare/v4.3...v5.0-alpha

<!-- markdownlint-disable-file MD012 MD024 MD033 -->

[#8195]: https://github.com/JabRef/jabref/issues/8195
18 changes: 5 additions & 13 deletions src/main/java/org/jabref/gui/exporter/ExportCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.jabref.gui.theme.Theme.Type.CUSTOM;
import static org.jabref.gui.theme.Theme.Type.DEFAULT;
import static org.jabref.gui.theme.Theme.Type.EMBEDDED;

/**
* Performs an export action
*/
Expand Down Expand Up @@ -137,19 +133,15 @@ private void export(Path file, FileChooser.ExtensionFilter selectedExtensionFilt
return null; // can not use BackgroundTask.wrap(Runnable) because Runnable.run() can't throw Exceptions
})
.onSuccess(
x -> {
save -> {
NotificationPane notificationPane = jabRefFrame.getNotificationPane();
Theme.Type themeType = preferences.getAppearancePreferences().getTheme().getType();
if (themeType == EMBEDDED) {
notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK);
}
if (themeType == DEFAULT) {
notificationPane.getStyleClass().removeAll(NotificationPane.STYLE_CLASS_DARK,
switch (themeType) {
case EMBEDDED -> notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK);
case CUSTOM -> notificationPane.getStyleClass().add(notificationPane.getUserAgentStylesheet());
case DEFAULT -> notificationPane.getStyleClass().removeAll(NotificationPane.STYLE_CLASS_DARK,
notificationPane.getUserAgentStylesheet());
}
if (themeType == CUSTOM) {
notificationPane.getStyleClass().add(notificationPane.getUserAgentStylesheet());
}
jabRefFrame.showNotificationPane(
Localization.lang("Press \"Open\" to reveal the folder holding the saved file."),
Localization.lang("Open"),
Expand Down

0 comments on commit 540d0b5

Please sign in to comment.