Search in sources :

Example 1 with ChangeTypeAction

use of org.jabref.gui.actions.ChangeTypeAction in project jabref by JabRef.

the class ChangeEntryTypeMenu method createEntryTypeSection.

private void createEntryTypeSection(BasePanel panel, JMenu menu, String title, List<? extends EntryType> types) {
    // bibtex
    JMenuItem header = new JMenuItem(title);
    Font font = new Font(menu.getFont().getName(), Font.ITALIC, menu.getFont().getSize());
    header.setFont(font);
    header.setEnabled(false);
    if (!types.isEmpty()) {
        menu.add(header);
    }
    for (EntryType type : types) {
        menu.add(new ChangeTypeAction(type, panel));
    }
}
Also used : EntryType(org.jabref.model.entry.EntryType) ChangeTypeAction(org.jabref.gui.actions.ChangeTypeAction) JMenuItem(javax.swing.JMenuItem) Font(java.awt.Font)

Example 2 with ChangeTypeAction

use of org.jabref.gui.actions.ChangeTypeAction in project jabref by JabRef.

the class ChangeEntryTypeMenu method populateChangeEntryTypeMenu.

/**
     * Remove all types from the menu. Then cycle through all available
     * types, and add them.
     */
private void populateChangeEntryTypeMenu(JMenu menu, BasePanel panel) {
    menu.removeAll();
    // biblatex?
    if (panel.getBibDatabaseContext().isBiblatexMode()) {
        for (EntryType type : EntryTypes.getAllValues(BibDatabaseMode.BIBLATEX)) {
            menu.add(new ChangeTypeAction(type, panel));
        }
        List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBLATEX);
        if (!customTypes.isEmpty()) {
            menu.addSeparator();
            // custom types
            createEntryTypeSection(panel, menu, "Custom Entries", customTypes);
        }
    } else {
        // Bibtex
        createEntryTypeSection(panel, menu, "BibTeX Entries", BibtexEntryTypes.ALL);
        menu.addSeparator();
        // ieeetran
        createEntryTypeSection(panel, menu, "IEEETran Entries", IEEETranEntryTypes.ALL);
        List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX);
        if (!customTypes.isEmpty()) {
            menu.addSeparator();
            // custom types
            createEntryTypeSection(panel, menu, "Custom Entries", customTypes);
        }
    }
}
Also used : EntryType(org.jabref.model.entry.EntryType) ChangeTypeAction(org.jabref.gui.actions.ChangeTypeAction)

Aggregations

ChangeTypeAction (org.jabref.gui.actions.ChangeTypeAction)2 EntryType (org.jabref.model.entry.EntryType)2 Font (java.awt.Font)1 JMenuItem (javax.swing.JMenuItem)1