@Nullable private LibraryInfo[] getRequiredLibraries() { final DownloadableFileSetDescription version = getSelectedVersion(); if (version == null) { return null; } return Struts2LibraryType.getLibraryInfo(version); }
private void setupVersionComboBox() { versionComboBox.setRenderer( new ListCellRendererWrapper<DownloadableFileSetDescription>(versionComboBox) { @Override public void customize( final JList list, final DownloadableFileSetDescription value, final int index, final boolean selected, final boolean hasFocus) { setText(value.getVersionString()); } }); versionComboBox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { final DownloadableFileSetDescription version = getSelectedVersion(); assert version != null; validator.setRequiredLibraries(getRequiredLibraries()); validator.setDescription( new StrutsFacetLibrariesValidatorDescription(version.getVersionString())); } }); final DownloadableFileSetVersions<DownloadableFileSetDescription> fileSetVersions = Struts2LibraryType.getVersions(); fileSetVersions.fetchVersions( new DownloadableFileSetVersions.FileSetVersionsCallback<DownloadableFileSetDescription>() { @Override public void onSuccess( @NotNull final List<? extends DownloadableFileSetDescription> versions) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { versionComboBox.setModel( new DefaultComboBoxModel(ArrayUtil.toObjectArray(versions))); versionComboBox.setSelectedIndex(0); validator.setRequiredLibraries(getRequiredLibraries()); validator.setDescription( new StrutsFacetLibrariesValidatorDescription( versions.get(0).getVersionString())); } }); } }); }