private void typeDeletion(String name) { BibtexEntryType type = BibtexEntryType.getType(name); if (type instanceof CustomEntryType) { if (BibtexEntryType.getStandardType(name) == null) { int reply = JOptionPane.showConfirmDialog( frame, Globals.lang( "All entries of this " + "type will be declared " + "typeless. Continue?"), Globals.lang("Delete custom format") + " '" + StringUtil.nCase(name) + '\'', JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (reply != JOptionPane.YES_OPTION) { return; } } BibtexEntryType.removeType(name); updateTypesForEntries(StringUtil.nCase(name)); changed.remove(name); reqLists.remove(name); optLists.remove(name); if (biblatexMode) { opt2Lists.remove(name); } } // messageLabel.setText("'"+type.getName()+"' "+ // Globals.lang("is a standard type.")); }
@Override public void actionPerformed(ActionEvent e) { if (lastSelected == null) { return; } defaulted.add(lastSelected); BibtexEntryType type = BibtexEntryType.getStandardType(lastSelected); if (type != null) { String[] rf = type.getRequiredFieldsForCustomization(), of = type.getOptionalFields(); List<String> req, opt1, opt2; if (rf != null) { req = java.util.Arrays.asList(rf); } else { req = new ArrayList<String>(); } opt1 = new ArrayList<String>(); opt2 = new ArrayList<String>(); if (biblatexMode) { if (of != null) { String[] priOptArray = type.getPrimaryOptionalFields(); String[] secOptArray = Util.getRemainder(of, priOptArray); if (priOptArray != null) { opt1 = java.util.Arrays.asList(priOptArray); } if (secOptArray != null) { opt2 = java.util.Arrays.asList(secOptArray); } } } else { if (of != null) { opt1 = java.util.Arrays.asList(of); } } reqComp.setFields(req); reqComp.setEnabled(true); optComp.setFields(opt1); if (biblatexMode) { optComp2.setFields(opt2); } } }