String s = samplePath[i];
String tooltip = sampleTooltip[i];
final InputStream stream = WelcomeTopComponent.class.getResourceAsStream(s);
String fileName = s.substring(s.lastIndexOf('/') + 1, s.length());
final String importer = fileName.substring(fileName.lastIndexOf('.'), fileName.length());
JXHyperlink fileLink = new JXHyperlink(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
try {
stream.reset();
} catch (IOException ex) {
//Exceptions.printStackTrace(ex);
}
ImportControllerUI importController = Lookup.getDefault().lookup(ImportControllerUI.class);
importController.importStream(stream, importer);
closeDialog();
}
});
fileLink.setText(fileName);
fileLink.setToolTipText(tooltip);
fileLink.putClientProperty(LINK_PATH, importer);
samplesPanel.add(fileLink, "wrap");
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}