use of org.gephi.io.importer.spi.WizardImporter in project gephi by gephi.
the class ImportWizard method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
WizardIterator wizardIterator = new WizardIterator();
WizardDescriptor wizardDescriptor = new WizardDescriptor(wizardIterator);
wizardDescriptor.setTitleFormat(new MessageFormat("{0} ({1})"));
wizardDescriptor.setTitle(NbBundle.getMessage(getClass(), "ImportWizard.wizard.title"));
Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
dialog.setVisible(true);
dialog.toFront();
boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
if (!cancelled) {
ImporterWizardUI wizardUI = wizardIterator.getCurrentWizardUI();
// Get Importer
WizardImporter importer = null;
for (WizardImporterBuilder wizardBuilder : Lookup.getDefault().lookupAll(WizardImporterBuilder.class)) {
WizardImporter im = wizardBuilder.buildImporter();
if (wizardUI.isUIForImporter(im)) {
importer = im;
}
}
if (importer == null) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(NbBundle.getMessage(getClass(), "ImportWizard.error_no_matching_importer"), NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(msg);
return;
}
// Unsetup
wizardIterator.unsetupPanels(importer);
ImportControllerUI importControllerUI = Lookup.getDefault().lookup(ImportControllerUI.class);
importControllerUI.importWizard(importer);
}
}
Aggregations