Skip to content

Commit

Permalink
Fix for issue JabRef#4808 - Fixed preview not showing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
harinda05 committed Mar 27, 2019
1 parent 0457ccb commit 2202313
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas
setupMainPanel();

setupActions();
setPreviewOn(true);

this.getDatabase().registerListener(new SearchListener());
this.getDatabase().registerListener(new EntryRemovedListener());
Expand Down Expand Up @@ -685,6 +686,7 @@ private void createMainTable() {
.ifPresent(entry -> {
preview.setEntry(entry);
entryEditor.setEntry(entry);
setPreviewAction();
}));

// TODO: Register these actions globally
Expand Down Expand Up @@ -1414,4 +1416,24 @@ public void action() {
preview.print();
}
}

private void setPreviewAction() {
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences();
boolean enabled = previewPreferences.isPreviewPanelEnabled();
PreviewPreferences newPreviewPreferences = previewPreferences.getBuilder()
.withPreviewPanelEnabled(enabled)
.build();
Globals.prefs.storePreviewPreferences(newPreviewPreferences);
setPreviewActive(enabled);
}

private void setPreviewOn(Boolean previewOn) {
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences();
PreviewPreferences newPreviewPreferences = previewPreferences.getBuilder()
.withPreviewPanelEnabled(previewOn)
.build();
Globals.prefs.storePreviewPreferences(newPreviewPreferences);

}

}

0 comments on commit 2202313

Please sign in to comment.