Skip to content

Commit

Permalink
Rename the Review Tab into Comments Tab (#3658)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusDietz authored Feb 17, 2018
1 parent bb2b078 commit 8108845
Show file tree
Hide file tree
Showing 20 changed files with 265 additions and 67 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Changed
- Abbreviate journal names functionality is now running parallel, increasing performance significantly. [#2831] (https://github.com/JabRef/jabref/issues/2831)
- Changed order of items in context menu [#298] (https://github.com/koppor/jabref/issues/298)
- Changed ID-based entry generator to store the last used fetcher. [#2796] (https://github.com/JabRef/jabref/issues/2796)
- Reorganised annotation information on the right side of the "File annotations" tab. [#3109](https://github.com/JabRef/jabref/issues/3109)
- We now show a small notification icon in the entry editor when we detect data inconsistency or other problems. [#3145](https://github.com/JabRef/jabref/issues/3145)
Expand All @@ -25,6 +26,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We improved the export of the `address` and `location` field to the MS-Office XML fields. If the address field does not contain a comma, it is treated as single value and exported to the field `city`. [#1750, comment](https://github.com/JabRef/jabref/issues/1750#issuecomment-357539167)
For more details refer to the [field mapping help page](http://help.jabref.org/en/MsOfficeBibFieldMapping)
- We added Facebook and Twitter icons in the toolbar to link to our [Facebook](https://www.facebook.com/JabRef/) and [Twitter](https://twitter.com/jabref_org) pages.
- Renamed the _Review_ Tab into _Comments_ Tab
- We no longer print empty lines when exporting an entry in RIS format [#3634](https://github.com/JabRef/jabref/issues/3634)
- We improved file saving so that hard links are now preserved when a save is performed [#2633](https://github.com/JabRef/jabref/issues/2633)
- We changed the default dialog option when removing a [file link](http://help.jabref.org/en/FileLinks#adding-external-links-to-an-entry) from an entry.
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.jabref.gui.BasePanel;
import org.jabref.gui.GUIGlobals;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.autosaveandbackup.BackupUIManager;
import org.jabref.gui.dialogs.BackupUIManager;
import org.jabref.gui.importer.ParserResultWarningDialog;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.shared.SharedDatabaseUIManager;
Expand Down Expand Up @@ -301,5 +301,4 @@ public static JabRefFrame getMainFrame() {
public static void setMainFrame(JabRefFrame mainFrame) {
JabRefGUI.mainFrame = mainFrame;
}

}
49 changes: 24 additions & 25 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
import org.jabref.gui.actions.OpenBrowserAction;
import org.jabref.gui.actions.SearchForUpdateAction;
import org.jabref.gui.actions.SortTabsAction;
import org.jabref.gui.autosaveandbackup.AutosaveUIManager;
import org.jabref.gui.bibtexkeypattern.BibtexKeyPatternDialog;
import org.jabref.gui.copyfiles.CopyFilesAction;
import org.jabref.gui.customentrytypes.EntryCustomizationDialog;
import org.jabref.gui.dbproperties.DatabasePropertiesDialog;
import org.jabref.gui.dialogs.AutosaveUIManager;
import org.jabref.gui.documentviewer.ShowDocumentViewerAction;
import org.jabref.gui.exporter.ExportAction;
import org.jabref.gui.exporter.ExportCustomizationDialog;
Expand Down Expand Up @@ -657,7 +657,6 @@ public void windowClosing(WindowEvent e) {
}

initShowTrackingNotification();

}

private void initShowTrackingNotification() {
Expand Down Expand Up @@ -715,7 +714,7 @@ public void setWindowTitle() {
String changeFlag = panel.isModified() && !isAutosaveEnabled ? "*" : "";
String databaseFile = panel.getBibDatabaseContext().getDatabaseFile().map(File::getPath)
.orElse(GUIGlobals.UNTITLED_TITLE);
setTitle(FRAME_TITLE + " - " + databaseFile + changeFlag + modeInfo);
setTitle(FRAME_TITLE + " - " + databaseFile + changeFlag + modeInfo);
} else if (panel.getBibDatabaseContext().getLocation() == DatabaseLocation.SHARED) {
setTitle(FRAME_TITLE + " - " + panel.getBibDatabaseContext().getDBMSSynchronizer().getDBName() + " ["
+ Localization.lang("shared") + "]" + modeInfo);
Expand Down Expand Up @@ -800,7 +799,6 @@ private void tearDownJabRef(List<String> filenames) {
File focusedDatabase = getCurrentBasePanel().getBibDatabaseContext().getDatabaseFile().orElse(null);
new LastFocusedTabPreferences(prefs).setLastFocusedTab(focusedDatabase);
}

}

fileHistory.storeHistory();
Expand Down Expand Up @@ -963,7 +961,6 @@ public BasePanel getBasePanelAt(int i) {

/**
* Returns a list of BasePanel.
*
*/
public List<BasePanel> getBasePanelList() {
List<BasePanel> returnList = new ArrayList<>();
Expand Down Expand Up @@ -1282,26 +1279,32 @@ private void fillMenu() {
createDisabledIconsForMenuEntries(mb);
}

public void addParserResult(ParserResult pr, boolean focusPanel) {
if (pr.toOpenTab()) {
public void addParserResult(ParserResult parserResult, boolean focusPanel) {
if (parserResult.toOpenTab()) {
// Add the entries to the open tab.
BasePanel panel = getCurrentBasePanel();
if (panel == null) {
// There is no open tab to add to, so we create a new tab:
addTab(pr.getDatabaseContext(), focusPanel);
panel = addTab(parserResult.getDatabaseContext(), focusPanel);
if (parserResult.wasChangedOnMigration()) {
panel.markBaseChanged();
}
} else {
List<BibEntry> entries = new ArrayList<>(pr.getDatabase().getEntries());
List<BibEntry> entries = new ArrayList<>(parserResult.getDatabase().getEntries());
addImportedEntries(panel, entries, false);
}
} else {
// only add tab if DB is not already open
Optional<BasePanel> panel = getBasePanelList().stream()
.filter(p -> p.getBibDatabaseContext().getDatabaseFile().equals(pr.getFile())).findFirst();
.filter(p -> p.getBibDatabaseContext().getDatabaseFile().equals(parserResult.getFile())).findFirst();

if (panel.isPresent()) {
tabbedPane.setSelectedComponent(panel.get());
} else {
addTab(pr.getDatabaseContext(), focusPanel);
BasePanel basePanel = addTab(parserResult.getDatabaseContext(), focusPanel);
if (parserResult.wasChangedOnMigration()) {
basePanel.markBaseChanged();
}
}
}
}
Expand Down Expand Up @@ -1447,7 +1450,6 @@ dupliCheck, autoSetFile, newEntryAction, newSpec, customizeAction, plainTextImpo
atLeastOneEntryActions.addAll(Arrays.asList(downloadFullText, lookupIdentifiers, exportLinkedFiles));

tabbedPane.addChangeListener(event -> updateEnabledState());

}

/**
Expand Down Expand Up @@ -1510,7 +1512,6 @@ public void setupAllTables() {
// Update tables:
if (bf.getDatabase() != null) {
bf.setupMainPanel();

}
}
}
Expand Down Expand Up @@ -1561,7 +1562,7 @@ public void updateAllTabTitles() {
}
}

public void addTab(BasePanel basePanel, boolean raisePanel) {
public BasePanel addTab(BasePanel basePanel, boolean raisePanel) {
// add tab
tabbedPane.add(basePanel.getTabTitle(), basePanel);

Expand All @@ -1586,22 +1587,23 @@ public void addTab(BasePanel basePanel, boolean raisePanel) {

// Track opening
trackOpenNewDatabase(basePanel);
return basePanel;
}

private void trackOpenNewDatabase(BasePanel basePanel) {

Map<String, String> properties = new HashMap<>();
Map<String, Double> measurements = new HashMap<>();
measurements.put("NumberOfEntries", (double)basePanel.getDatabaseContext().getDatabase().getEntryCount());
measurements.put("NumberOfEntries", (double) basePanel.getDatabaseContext().getDatabase().getEntryCount());

Globals.getTelemetryClient().ifPresent(client -> client.trackEvent("OpenNewDatabase", properties, measurements));
}

public BasePanel addTab(BibDatabaseContext databaseContext, boolean raisePanel) {
Objects.requireNonNull(databaseContext);
BasePanel bp = new BasePanel(JabRefFrame.this, databaseContext);
addTab(bp, raisePanel);
return bp;
BasePanel basePanel = new BasePanel(JabRefFrame.this, databaseContext);
addTab(basePanel, raisePanel);
return basePanel;
}

private boolean readyForAutosave(BibDatabaseContext context) {
Expand Down Expand Up @@ -1727,7 +1729,6 @@ public void setProgressBarValue(final int value) {
} else {
SwingUtilities.invokeLater(() -> progressBar.setValue(value));
}

}

/**
Expand All @@ -1742,7 +1743,6 @@ public void setProgressBarIndeterminate(final boolean value) {
} else {
SwingUtilities.invokeLater(() -> progressBar.setIndeterminate(value));
}

}

/**
Expand All @@ -1759,11 +1759,11 @@ public void setProgressBarMaximum(final int value) {
} else {
SwingUtilities.invokeLater(() -> progressBar.setMaximum(value));
}

}

/**
* Return a boolean, if the selected entry have file
*
* @param selectEntryList A selected entries list of the current base pane
* @return true, if the selected entry contains file.
* false, if multiple entries are selected or the selected entry doesn't contains file
Expand All @@ -1778,6 +1778,7 @@ private boolean isExistFile(List<BibEntry> selectEntryList) {

/**
* Return a boolean, if the selected entry have url or doi
*
* @param selectEntryList A selected entries list of the current base pane
* @return true, if the selected entry contains url or doi.
* false, if multiple entries are selected or the selected entry doesn't contains url or doi
Expand Down Expand Up @@ -2135,7 +2136,8 @@ public EditAction(String command, String menuTitle, String description, KeyStrok
putValue(Action.SHORT_DESCRIPTION, description);
}

@Override public void actionPerformed(ActionEvent e) {
@Override
public void actionPerformed(ActionEvent e) {

LOGGER.debug(Globals.getFocusListener().getFocused().toString());
JComponent source = Globals.getFocusListener().getFocused();
Expand Down Expand Up @@ -2197,7 +2199,6 @@ public void actionPerformed(ActionEvent e) {
GenFieldsCustomizer gf = new GenFieldsCustomizer(JabRefFrame.this);
gf.setLocationRelativeTo(JabRefFrame.this);
gf.setVisible(true);

}
}

Expand Down Expand Up @@ -2232,7 +2233,6 @@ public void actionPerformed(ActionEvent e) {
propertiesDialog.setLocationRelativeTo(JabRefFrame.this);
propertiesDialog.setVisible(true);
}

}

private class BibtexKeyPatternAction extends MnemonicAwareAction {
Expand All @@ -2256,7 +2256,6 @@ public void actionPerformed(ActionEvent e) {
bibtexKeyPatternDialog.setLocationRelativeTo(JabRefFrame.this);
bibtexKeyPatternDialog.setVisible(true);
}

}

private class DefaultTableFontSizeAction extends MnemonicAwareAction {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ private ContextMenu createPopupMenu() {
menu.getItems().add(copyPreview);
menu.getItems().add(printEntryPreview);
menu.getItems().add(new SeparatorMenuItem());
menu.getItems().add(previousPreviewLayout);
menu.getItems().add(nextPreviewLayout);
menu.getItems().add(previousPreviewLayout);
return menu;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.autosaveandbackup;
package org.jabref.gui.dialogs;

import org.jabref.gui.BasePanel;
import org.jabref.gui.exporter.SaveDatabaseAction;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.autosaveandbackup;
package org.jabref.gui.dialogs;

import java.nio.file.Path;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jabref.gui.dialogs;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.swing.JOptionPane;

import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.BibEntry;

public class MergeReviewIntoCommentUIManager {

public boolean askUserForMerge(List<BibEntry> conflicts) {
List<String> bibKeys = conflicts.stream()
.map(BibEntry::getCiteKeyOptional)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());

int answer = JOptionPane.showConfirmDialog(
null,
String.join(",\n", bibKeys) + " " +
Localization.lang("has/have both a 'Comment' and a 'Review' field.") + "\n" +
Localization.lang("Since the 'Review' field was deprecated in JabRef 4.2, these two fields are about to be merged into the 'Comment' field.") + "\n" +
Localization.lang("The conflicting fields of these entries will be merged into the 'Comment' field."),
Localization.lang("Review Field Migration"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);

return 0 == answer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.FXDialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.autosaveandbackup.AutosaveUIManager;
import org.jabref.gui.collab.ChangeScanner;
import org.jabref.gui.collab.FileUpdatePanel;
import org.jabref.gui.dialogs.AutosaveUIManager;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.gui.worker.AbstractWorker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.jabref.gui.IconTheme;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.actions.MnemonicAwareAction;
import org.jabref.gui.autosaveandbackup.BackupUIManager;
import org.jabref.gui.dialogs.BackupUIManager;
import org.jabref.gui.importer.ParserResultWarningDialog;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.shared.SharedDatabaseUIManager;
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/org/jabref/logic/importer/OpenDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import java.util.List;

import org.jabref.logic.importer.fileformat.BibtexImporter;
import org.jabref.logic.importer.util.ConvertLegacyExplicitGroups;
import org.jabref.logic.importer.util.PostOpenAction;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.specialfields.SpecialFieldsUtils;
import org.jabref.logic.util.io.FileBasedLock;
import org.jabref.migrations.ConvertLegacyExplicitGroups;
import org.jabref.migrations.MergeReviewIntoComment;
import org.jabref.migrations.PostOpenMigration;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.util.FileUpdateMonitor;

Expand Down Expand Up @@ -81,16 +82,17 @@ public static ParserResult loadDatabase(File fileToOpen, ImportFormatPreferences
LOGGER.debug("Synchronized special fields based on keywords");
}

applyPostActions(result);
performLoadDatabaseMigrations(result);

return result;
}

private static void applyPostActions(ParserResult parserResult) {
List<PostOpenAction> actions = Arrays.asList(new ConvertLegacyExplicitGroups());
private static void performLoadDatabaseMigrations(ParserResult parserResult) {

for (PostOpenAction action : actions) {
action.performAction(parserResult);
List<PostOpenMigration> postOpenMigrations = Arrays.asList(new ConvertLegacyExplicitGroups(), new MergeReviewIntoComment());

for (PostOpenMigration migration : postOpenMigrations) {
migration.performMigration(parserResult);
}
}
}
10 changes: 9 additions & 1 deletion src/main/java/org/jabref/logic/importer/ParserResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.jabref.model.metadata.MetaData;

public class ParserResult {

private final Map<String, EntryType> entryTypes;
private final List<String> warnings = new ArrayList<>();
private final List<String> duplicateKeys = new ArrayList<>();
Expand All @@ -28,6 +27,7 @@ public class ParserResult {
private File file;
private boolean invalid;
private boolean toOpenTab;
private boolean changedOnMigration = false;

public ParserResult() {
this(Collections.emptyList());
Expand Down Expand Up @@ -180,4 +180,12 @@ public void setDatabaseContext(BibDatabaseContext bibDatabaseContext) {
public boolean isEmpty() {
return this == new ParserResult();
}

public boolean wasChangedOnMigration() {
return changedOnMigration;
}

public void setChangedOnMigration(boolean wasChangedOnMigration) {
this.changedOnMigration = wasChangedOnMigration;
}
}

This file was deleted.

Loading

0 comments on commit 8108845

Please sign in to comment.