示例#1
0
  public void onRemovePressed(final ContributedLibrary lib) {
    boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);

    if (!managedByIndex) {
      int chosenOption = JOptionPane.showConfirmDialog(this, _("This library is not listed on Library Manager. You won't be able to resinstall it from here.\nAre you sure you want to delete it?"), _("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
      if (chosenOption != JOptionPane.YES_OPTION) {
        return;
      }
    }

    clearErrorMessage();
    installerThread = new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          setProgressVisible(true, _("Removing..."));
          installer.remove(lib);
          onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
          //getContribModel().updateLibrary(lib);
        } catch (Exception e) {
          throw new RuntimeException(e);
        } finally {
          setProgressVisible(false, "");
        }
      }
    });
    installerThread.setUncaughtExceptionHandler(new InstallerJDialogUncaughtExceptionHandler(this, noConnectionErrorMessage));
    installerThread.start();
  }
示例#2
0
 public void onInstallPressed(final ContributedLibrary lib, final ContributedLibrary replaced) {
   clearErrorMessage();
   installerThread = new Thread(new Runnable() {
     @Override
     public void run() {
       try {
         setProgressVisible(true, _("Installing..."));
         installer.install(lib, replaced);
         onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
         //getContribModel().updateLibrary(lib);
       } catch (Exception e) {
         throw new RuntimeException(e);
       } finally {
         setProgressVisible(false, "");
       }
     }
   });
   installerThread.setUncaughtExceptionHandler(new InstallerJDialogUncaughtExceptionHandler(this, noConnectionErrorMessage));
   installerThread.start();
 }
示例#3
0
 @Override
 protected void onUpdatePressed() {
   super.onUpdatePressed();
   installerThread = new Thread(new Runnable() {
     @Override
     public void run() {
       try {
         setProgressVisible(true, "");
         installer.updateIndex();
         onIndexesUpdated();
       } catch (Exception e) {
         throw new RuntimeException(e);
       } finally {
         setProgressVisible(false, "");
       }
     }
   });
   installerThread.setUncaughtExceptionHandler(new InstallerJDialogUncaughtExceptionHandler(this, noConnectionErrorMessage));
   installerThread.start();
 }