Example #1
0
 void downloadSelectedRow() {
   int idx = lstInstallers.getSelectedRow();
   if (versions == null || idx < 0 || idx >= versions.size()) {
     MessageBox.Show(C.i18n("install.not_refreshed"));
     return;
   }
   gsp.getProfile()
       .service()
       .install()
       .download(gsp.getProfile().getSelectedVersion(), getVersion(idx), id)
       .after(new TaskRunnable(this::refreshVersions))
       .run();
 }
Example #2
0
 void refreshVersions() {
   if (TaskWindow.getInstance()
       .addTask(
           new TaskRunnableArg1<>(C.i18n("install." + id.id + ".get_list"), list)
               .registerPreviousResult(
                   new DefaultPreviousResult<>(new String[] {gsp.getMinecraftVersionFormatted()})))
       .start()) loadVersions();
 }
Example #3
0
 public void loadVersions() {
   SwingUtilities.invokeLater(
       () -> {
         synchronized (InstallerPanel.this) {
           DefaultTableModel model = (DefaultTableModel) lstInstallers.getModel();
           String mcver = StrUtils.formatVersion(gsp.getMinecraftVersionFormatted());
           versions = list.getVersions(mcver);
           SwingUtils.clearDefaultTable(lstInstallers);
           if (versions != null)
             for (InstallerVersionList.InstallerVersion v : versions)
               if (v != null)
                 model.addRow(
                     new Object[] {
                       v.selfVersion == null ? "null" : v.selfVersion,
                       v.mcVersion == null ? "null" : v.mcVersion
                     });
         }
       });
 }