Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up for #1323 Batch Fulltext downloader #2344

Merged
merged 7 commits into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/main/java/net/sf/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ public void actionPerformed(ActionEvent e) {
private final AbstractAction downloadFullText = new GeneralAction(Actions.DOWNLOAD_FULL_TEXT,
Localization.menuTitle("Look up full text documents"),
Localization.lang("Look up full text documents"));

private final AbstractAction increaseFontSize = new IncreaseTableFontSizeAction();
private final AbstractAction decreseFontSize = new DecreaseTableFontSizeAction();
private final AbstractAction resolveDuplicateKeys = new GeneralAction(Actions.RESOLVE_DUPLICATE_KEYS,
Expand Down Expand Up @@ -494,7 +495,7 @@ public void actionPerformed(ActionEvent e) {
private final List<Object> oneEntryWithFileOnlyActions = new LinkedList<>();
private final List<Object> oneEntryWithURLorDOIOnlyActions = new LinkedList<>();
private final List<Object> twoEntriesOnlyActions = new LinkedList<>();

private final List<Object> oneOrMoreEntriesActions = new LinkedList<>();

private class EditModeAction extends AbstractAction {

Expand Down Expand Up @@ -536,7 +537,6 @@ public void actionPerformed(ActionEvent evt) {
public JabRefFrame() {
init();
updateEnabledState();

}

private List<NewEntryAction> getNewEntryActions() {
Expand Down Expand Up @@ -1528,6 +1528,9 @@ dupliCheck, autoSetFile, newEntryAction, newSpec, customizeAction, plainTextImpo
twoEntriesOnlyActions.clear();
twoEntriesOnlyActions.addAll(Arrays.asList(mergeEntries));

oneOrMoreEntriesActions.clear();
oneOrMoreEntriesActions.addAll(Arrays.asList(downloadFullText));

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

}
Expand Down Expand Up @@ -1572,12 +1575,12 @@ public void updateEnabledState() {
getForwardAction().setEnabled(false);
setEnabled(openAndSavedDatabasesOnlyActions, false);
setEnabled(sharedDatabaseOnlyActions, false);
setEnabled(oneEntryOnlyActions, false);
}


if (tabCount > 0) {
BasePanel current = getCurrentBasePanel();
boolean saved = current.getBibDatabaseContext().getDatabaseFile().isPresent();
boolean saved = current.getBibDatabaseContext().getDatabasePath().isPresent();
setEnabled(openAndSavedDatabasesOnlyActions, saved);

boolean isShared = current.getBibDatabaseContext().getLocation() == DatabaseLocation.SHARED;
Expand All @@ -1591,6 +1594,9 @@ public void updateEnabledState() {

boolean twoEntriesSelected = current.getSelectedEntries().size() == 2;
setEnabled(twoEntriesOnlyActions, twoEntriesSelected);

boolean oneOrMoreEntriesSelected = current.getSelectedEntries().size() >= 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not checking for !isEmpy()?

setEnabled(oneOrMoreEntriesActions, oneOrMoreEntriesSelected);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,14 @@ public FindFullTextAction(BasePanel basePanel) {

@Override
public void init() throws Exception {
if (basePanel.getSelectedEntries().size() == 0) {
JOptionPane.showMessageDialog(
basePanel,
Localization.lang("Select at least one entry to perform this operation"),
Localization.lang("No entry selected"),
JOptionPane.ERROR_MESSAGE);
return;
if (basePanel.getSelectedEntries().size() > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!isEmpty(), maybe add a logger.DEBUG statement?

basePanel.output(Localization.lang("Looking for full text document..."));
}
basePanel.output(Localization.lang("Looking for full text document..."));
}

@Override
public void run() {
int numberOfSelectedEntries = basePanel.getSelectedEntries().size();

if (numberOfSelectedEntries == 0) {
return;
}

if (numberOfSelectedEntries >= warningLimit) {
if (basePanel.getSelectedEntries().size() >= warningLimit) {
String[] options = new String[]{Localization.lang("Look up full text documents"), Localization.lang("Cancel")};
int answer = JOptionPane.showOptionDialog(basePanel.frame(),
Localization.lang(
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,3 @@ Update_with_bibliographic_information_from_the_web=
Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
3 changes: 0 additions & 3 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,3 @@ Update_with_bibliographic_information_from_the_web=
Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=Could_not_find_any_bibliographic_i
BibTeX_key_%0_deviates_from_generated_key_%1=BibTeX_key_%0_deviates_from_generated_key_%1
DOI_%0_is_invalid=DOI_%0_is_invalid

Select_at_least_one_entry_to_perform_this_operation=Select_at_least_one_entry_to_perform_this_operation
No_entry_selected=No_entry_selected
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=Non_ho_trovato_informazioni_biblio
BibTeX_key_%0_deviates_from_generated_key_%1=Chiave_BibTeX_%0_diversa_dalla_chiave_generata_%1
DOI_%0_is_invalid=DOI_%0_non_valido

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2309,5 +2309,3 @@ Could_not_find_any_bibliographic_information.=
BibTeX_key_%0_deviates_from_generated_key_%1=
DOI_%0_is_invalid=

Select_at_least_one_entry_to_perform_this_operation=
No_entry_selected=