Skip to content

Commit

Permalink
Fix 5555 status popups (JabRef#5560)
Browse files Browse the repository at this point in the history
* Remove obsolete notifications (partial fix for JabRef#5555)

* Remove notifications for autosave (partial fix for JabRef#5555)

* Update changelog of changes in JabRef#5555

* Change parameter type for save action

* Log connection loss of shared database as warning

* Remove unused imports
  • Loading branch information
Ka0o0 authored and Siedlerchr committed Nov 6, 2019
1 parent 0bf56a4 commit 67780cc
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 42 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463)
- We fixed an issue where the merge dialog showed the wrong text colour in "Dark" mode [#5516](https://github.com/JabRef/jabref/issues/5516)
- We fixed an issue where the author field was not correctly parsed during bibtex key-generation. [#5551](https://github.com/JabRef/jabref/issues/5551)
- We fixed an issue where notifications where shown during autosave. [#5555](https://github.com/JabRef/jabref/issues/5555)

### Removed

- We removed some obsolete notifications. [#5555](https://github.com/JabRef/jabref/issues/5555)



Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ public void insertEntry(final BibEntry bibEntry) {

// Create an UndoableInsertEntry object.
getUndoManager().addEdit(new UndoableInsertEntry(bibDatabaseContext.getDatabase(), bibEntry));
output(Localization.lang("Added new '%0' entry.", bibEntry.getType().getDisplayName()));

markBaseChanged(); // The database just changed.
if (Globals.prefs.getBoolean(JabRefPreferences.AUTO_OPEN_FORM)) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,6 @@ private void removeTab(BasePanel panel) {
panel.cleanUp();
tabbedPane.getTabs().remove(getTab(panel));
setWindowTitle();
dialogService.notify(Localization.lang("Closed library") + '.');
// update tab titles
updateAllTabTitles();
});
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/auximport/FromAuxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public FromAuxDialog(JabRefFrame frame) {
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
BasePanel bp = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), new BibDatabaseContext(auxParserResult.getGeneratedBibDatabase(), defaults), ExternalFileTypes.getInstance());
frame.addTab(bp, true);
dialogService.notify(Localization.lang("New library created."));
}
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AutosaveUIManager(BasePanel panel) {
@Subscribe
public void listen(@SuppressWarnings("unused") AutosaveEvent event) {
try {
new SaveDatabaseAction(panel, Globals.prefs, Globals.entryTypesManager).save();
new SaveDatabaseAction(panel, Globals.prefs, Globals.entryTypesManager).save(SaveDatabaseAction.SaveDatabaseMode.SILENT);
} catch (Throwable e) {
LOGGER.error("Problem occured while saving.", e);
}
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
* operation was canceled, or whether it was successful.
*/
public class SaveDatabaseAction {

public enum SaveDatabaseMode {
SILENT, NORMAL
}

private static final Logger LOGGER = LoggerFactory.getLogger(SaveDatabaseAction.class);

private final BasePanel panel;
Expand Down Expand Up @@ -120,6 +125,7 @@ private void saveWithDifferentEncoding(Path file, boolean selectedOnly, Charset
}

private boolean doSave() {
panel.setSaving(true);
Path targetPath = panel.getBibDatabaseContext().getDatabasePath().get();
try {
// Save the database
Expand All @@ -143,8 +149,6 @@ private boolean doSave() {
// Reset title of tab
frame.setTabTitle(panel, panel.getTabTitle(),
panel.getBibDatabaseContext().getDatabaseFile().get().getAbsolutePath());
frame.getDialogService().notify(Localization.lang("Saved library") + " '"
+ panel.getBibDatabaseContext().getDatabaseFile().get().getPath() + "'.");
frame.setWindowTitle();
frame.updateAllTabTitles();
}
Expand All @@ -160,9 +164,14 @@ private boolean doSave() {
}

public boolean save() {
return save(SaveDatabaseMode.NORMAL);
}

public boolean save(SaveDatabaseMode mode) {
if (panel.getBibDatabaseContext().getDatabasePath().isPresent()) {
panel.frame().getDialogService().notify(Localization.lang("Saving library") + "...");
panel.setSaving(true);
if (mode == SaveDatabaseMode.NORMAL) {
panel.frame().getDialogService().notify(Localization.lang("Saving library") + "...");
}
return doSave();
} else {
Optional<Path> savePath = getSavePath();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/importer/NewDatabaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.jabref.gui.JabRefFrame;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.Defaults;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.BibDatabaseMode;
Expand All @@ -25,6 +24,5 @@ public void execute() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new Defaults(BibDatabaseMode.BIBTEX));
bibDatabaseContext.setMode(mode);
jabRefFrame.addTab(bibDatabaseContext, true);
jabRefFrame.getDialogService().notify(Localization.lang("New %0 library created.", mode.getFormattedName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,8 @@ public void openFiles(List<Path> filesToOpen, boolean raisePanel) {
// If no files are remaining to open, this could mean that a file was
// already open. If so, we may have to raise the correct tab:
else if (toRaise != null) {
dialogService.notify(Localization.lang("File '%0' is already open.",
toRaise.getBibDatabaseContext().getDatabasePath().get().getFileName().toString()));
frame.showBasePanel(toRaise);
}

dialogService.notify(Localization.lang("Files opened") + ": " + (filesToOpen.size()));
}

/**
Expand Down Expand Up @@ -239,13 +235,6 @@ private BasePanel addNewDatabase(ParserResult result, final Path file, boolean r
ParserResultWarningDialog.showParserResultWarningDialog(result, frame);
}

if (Objects.nonNull(file)) {
dialogService.notify(Localization.lang("Opened library") + " '" + file.toString() + "' "
+ Localization.lang("with")
+ " "
+ database.getEntryCount() + " " + Localization.lang("entries") + ".");
}

BasePanel basePanel = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), result.getDatabaseContext(), ExternalFileTypes.getInstance());
frame.addTab(basePanel, raisePanel);
return basePanel;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ public void paste() {
ce.end();
undoManager.addEdit(ce);

panel.output(panel.formatOutputMessage(Localization.lang("Pasted"), entriesToAdd.size()));

// Show editor if user want us to do this
BibEntry firstNewEntry = entriesToAdd.get(0);
if (Globals.prefs.getBoolean(JabRefPreferences.AUTO_OPEN_FORM)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public SharedDatabaseUIManager(JabRefFrame jabRefFrame) {
@Subscribe
public void listen(ConnectionLostEvent connectionLostEvent) {

jabRefFrame.getDialogService().notify(Localization.lang("Connection lost."));

ButtonType reconnect = new ButtonType(Localization.lang("Reconnect"), ButtonData.YES);
ButtonType workOffline = new ButtonType(Localization.lang("Work offline"), ButtonData.NO);
ButtonType closeLibrary = new ButtonType(Localization.lang("Close library"), ButtonData.CANCEL_CLOSE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ public boolean checkCurrentConnection() {
try {
boolean isValid = currentConnection.isValid(0);
if (!isValid) {
LOGGER.warn("Lost SQL connection.");
eventBus.post(new ConnectionLostEvent(bibDatabaseContext));
}
return isValid;
Expand Down
17 changes: 0 additions & 17 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ Close\ the\ current\ library=Close the current library

Close\ window=Close window

Closed\ library=Closed library

Comments=Comments

Contained\ in=Contained in
Expand Down Expand Up @@ -361,15 +359,12 @@ Field\ to\ group\ by=Field to group by
File=File

file=file
File\ '%0'\ is\ already\ open.=File '%0' is already open.
File\ directory\ is\ not\ set\ or\ does\ not\ exist\!=File directory is not set or does not exist!

File\ exists=File exists

File\ not\ found=File not found

Files\ opened=Files opened

Filter=Filter

Finished\ automatically\ setting\ external\ links.=Finished automatically setting external links.
Expand Down Expand Up @@ -562,7 +557,6 @@ Natbib\ style=Natbib style
nested\ AUX\ files=nested AUX files

New\ BibTeX\ sublibrary=New BibTeX sublibrary
New\ library\ created.=New library created.

New\ group=New group

Expand Down Expand Up @@ -614,8 +608,6 @@ Open\ terminal\ here=Open terminal here

Open\ URL\ or\ DOI=Open URL or DOI

Opened\ library=Opened library

Opening=Opening

Operation\ canceled.=Operation canceled.
Expand All @@ -641,8 +633,6 @@ paste\ entries=paste entries

paste\ entry=paste entry

Pasted=Pasted

Path\ to\ %0\ not\ defined=Path to %0 not defined

Path\ to\ LyX\ pipe=Path to LyX pipe
Expand Down Expand Up @@ -796,8 +786,6 @@ Save\ library\ as...=Save library as...

Save\ entries\ in\ their\ original\ order=Save entries in their original order

Saved\ library=Saved library

Saved\ selected\ to\ '%0'.=Saved selected to '%0'.

Saving=Saving
Expand Down Expand Up @@ -975,8 +963,6 @@ Whatever\ option\ you\ choose,\ Mr.\ DLib\ may\ share\ its\ data\ with\ research

Will\ write\ XMP-metadata\ to\ the\ PDFs\ linked\ from\ selected\ entries.=Will write XMP-metadata to the PDFs linked from selected entries.

with=with

Write\ BibTeXEntry\ as\ XMP-metadata\ to\ PDF.=Write BibTeXEntry as XMP-metadata to PDF.

Write\ XMP=Write XMP
Expand Down Expand Up @@ -1362,7 +1348,6 @@ Return\ to\ JabRef=Return to JabRef
Could\ not\ connect\ to\ %0=Could not connect to %0
Warning\:\ %0\ out\ of\ %1\ entries\ have\ undefined\ title.=Warning: %0 out of %1 entries have undefined title.
Warning\:\ %0\ out\ of\ %1\ entries\ have\ undefined\ BibTeX\ key.=Warning: %0 out of %1 entries have undefined BibTeX key.
Added\ new\ '%0'\ entry.=Added new '%0' entry.
Really\ delete\ the\ selected\ entry?=Really delete the selected entry?
Really\ delete\ the\ %0\ selected\ entries?=Really delete the %0 selected entries?
Keep\ merged\ entry\ only=Keep merged entry only
Expand Down Expand Up @@ -1435,7 +1420,6 @@ Regenerating\ BibTeX\ keys\ according\ to\ metadata=Regenerating BibTeX keys acc
Regenerate\ all\ keys\ for\ the\ entries\ in\ a\ BibTeX\ file=Regenerate all keys for the entries in a BibTeX file
Show\ debug\ level\ messages=Show debug level messages
Default\ bibliography\ mode=Default bibliography mode
New\ %0\ library\ created.=New %0 library created.
Show\ only\ preferences\ deviating\ from\ their\ default\ value=Show only preferences deviating from their default value
default=default
key=key
Expand Down Expand Up @@ -1712,7 +1696,6 @@ Connection\ to\ %0\ server\ established.=Connection to %0 server established.
Required\ field\ "%0"\ is\ empty.=Required field "%0" is empty.
%0\ driver\ not\ available.=%0 driver not available.
The\ connection\ to\ the\ server\ has\ been\ terminated.=The connection to the server has been terminated.
Connection\ lost.=Connection lost.
Reconnect=Reconnect
Work\ offline=Work offline
Working\ offline.=Working offline.
Expand Down

0 comments on commit 67780cc

Please sign in to comment.