Search in sources :

Example 1 with DatabaseImporterBuilder

use of org.gephi.io.importer.spi.DatabaseImporterBuilder in project gephi by gephi.

the class ImportDB method getMenuPresenter.

@Override
public JMenuItem getMenuPresenter() {
    JMenu menu = new JMenu(NbBundle.getMessage(ImportDB.class, "CTL_ImportDB"));
    final ImportControllerUI importController = Lookup.getDefault().lookup(ImportControllerUI.class);
    if (importController != null) {
        for (final DatabaseImporterBuilder dbb : Lookup.getDefault().lookupAll(DatabaseImporterBuilder.class)) {
            ImporterUI ui = importController.getImportController().getUI(dbb.buildImporter());
            String menuName = dbb.getName();
            if (ui != null) {
                menuName = ui.getDisplayName();
            }
            JMenuItem menuItem = new JMenuItem(new AbstractAction(menuName) {

                @Override
                public void actionPerformed(ActionEvent e) {
                    importController.importDatabase(dbb.buildImporter());
                }
            });
            menu.add(menuItem);
        }
    }
    return menu;
}
Also used : ImporterUI(org.gephi.io.importer.spi.ImporterUI) ImportControllerUI(org.gephi.desktop.importer.api.ImportControllerUI) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) AbstractAction(javax.swing.AbstractAction) JMenu(javax.swing.JMenu) DatabaseImporterBuilder(org.gephi.io.importer.spi.DatabaseImporterBuilder)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 AbstractAction (javax.swing.AbstractAction)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 ImportControllerUI (org.gephi.desktop.importer.api.ImportControllerUI)1 DatabaseImporterBuilder (org.gephi.io.importer.spi.DatabaseImporterBuilder)1 ImporterUI (org.gephi.io.importer.spi.ImporterUI)1