use of org.jabref.gui.importer.EntryFromFileCreator in project jabref by JabRef.
the class FindUnlinkedFilesDialog method createFileTypesCombobox.
/**
* Initialises the combobox that contains the available file types which
* bibtex entries can be created of.
*/
private void createFileTypesCombobox() {
List<FileFilter> fileFilterList = creatorManager.getFileFilterList();
Vector<FileFilter> vector = new Vector<>();
for (FileFilter fileFilter : fileFilterList) {
vector.add(fileFilter);
}
comboBoxFileTypeSelection = new JComboBox<>(vector);
comboBoxFileTypeSelection.setRenderer(new DefaultListCellRenderer() {
/* (non-Javadoc)
* @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
*/
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof EntryFromFileCreator) {
EntryFromFileCreator creator = (EntryFromFileCreator) value;
if (creator.getExternalFileType() != null) {
label.setIcon(creator.getExternalFileType().getIcon());
}
}
return label;
}
});
}
Aggregations