Пример #1
0
 @Override
 public void apply(final ITool process) {
   process
       .getQueue()
       .add(
           new AbstractRToolRunnable(
               "r/renv/rpkg.apply", //$NON-NLS-1$
               "Perform Package Manager Operations") {
             @Override
             protected void run(final IRToolService r, final IProgressMonitor monitor)
                 throws CoreException {
               runApply(r, monitor);
             }
           });
 }
Пример #2
0
 @Override
 public void loadPkgs(
     final ITool rTool,
     final List<? extends IRPkgInfoAndData> pkgs,
     final boolean expliciteLocation) {
   final RPkgOperator op = new RPkgOperator(this);
   rTool
       .getQueue()
       .add(
           new AbstractStatetRRunnable(
               "r/renv/pkgs.load", //$NON-NLS-1$
               "Load R Packages") {
             @Override
             protected void run(final IRConsoleService r, final IProgressMonitor monitor)
                 throws CoreException {
               checkNewCommand(r, monitor);
               op.loadPkgs(pkgs, expliciteLocation, r, monitor);
             }
           });
 }
Пример #3
0
  @Override
  public void perform(final ITool rTool, final List<? extends RPkgAction> actions) {
    if (actions.isEmpty()) {
      return;
    }
    final String label =
        (actions.get(0).getAction() == RPkgAction.UNINSTALL)
            ? "Uninstall R Packages"
            : "Install/Update R Packages";
    final RPkgOperator op = new RPkgOperator(this);
    rTool
        .getQueue()
        .add(
            new AbstractStatetRRunnable("r/renv/pkgs.inst", label) { // $NON-NLS-1$
              @Override
              protected void run(final IRConsoleService r, final IProgressMonitor monitor)
                  throws CoreException {
                beginRTask(r, monitor);
                try {
                  checkNewCommand(r, monitor);
                  op.runActions(actions, r, monitor);
                } catch (final UnexpectedRDataException | CoreException e) {
                  throw new CoreException(
                      new Status(
                          IStatus.ERROR,
                          RCore.PLUGIN_ID,
                          0,
                          "An error occurred when installing and updating R packages.",
                          e));
                } finally {
                  endRTask();

                  r.briefAboutChange(0x10); // packages
                }
              }
            });
  }