Skip to content

Commit

Permalink
Do not show fields that are displayed in general fields etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Feb 23, 2016
1 parent d123928 commit a3a36c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
18 changes: 18 additions & 0 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,24 @@ private JabRefPreferences() {
}
}

public List<String> getCustomTabFieldNames() {
List<String> customFields = new ArrayList<>();

int defNumber = 0;
while(true) {
// saved as CUSTOMTABNAME_def{number} and ; separated
String fields = (String) defaults.get(CUSTOM_TAB_FIELDS + "_def" + defNumber);

if(fields == null || fields.isEmpty()) {
break;
}

customFields.addAll(Arrays.asList(fields.split(";")));
defNumber++;
}
return customFields;
}

public void setLanguageDependentDefaultValues() {
// Entry editor tab 0:
defaults.put(CUSTOM_TAB_NAME + "_def0", Localization.lang("General"));
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ void okActionPerformed() {
Globals.prefs.purgeSeries(JabRefPreferences.CUSTOM_TAB_NAME, i);
Globals.prefs.purgeSeries(JabRefPreferences.CUSTOM_TAB_FIELDS, i);
Globals.prefs.updateEntryEditorTabList();
/*
String delimStr = fieldsArea.getText().replaceAll("\\s+","")
.replaceAll("\\n+","").trim();
parent.prefs.putStringArray(JabRefPreferences.GENERAL_FIELDS, Util.split(delimStr, ";"));
*/

parentFrame.removeCachedEntryEditors();
dispose();
Expand Down Expand Up @@ -219,8 +214,8 @@ class GenFieldsCustomizerRevertActionAdapter implements ActionListener {
private final GenFieldsCustomizer adaptee;


GenFieldsCustomizerRevertActionAdapter(GenFieldsCustomizer adaptee) {
this.adaptee = adaptee;
GenFieldsCustomizerRevertActionAdapter(GenFieldsCustomizer adapter) {
this.adaptee = adapter;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ private void setupFieldPanels() {
List<String> displayedFields = Stream.concat(requiredFields.stream(), displayedOptionalFields.stream()).map(String::toLowerCase).collect(Collectors.toList());
List<String> otherFields = this.entry.getFieldNames().stream().map(String::toLowerCase).filter(f -> !displayedFields.contains(f)).collect(Collectors.toList());
otherFields.remove("bibtexkey");
otherFields.removeAll(prefs.getCustomTabFieldNames());

if(!otherFields.isEmpty()) {
EntryEditorTab otherPanel = new EntryEditorTab(frame, panel, otherFields, this,
Expand Down

0 comments on commit a3a36c9

Please sign in to comment.