예제 #1
0
 private void beginRTask(final IToolService r, final IProgressMonitor monitor)
     throws CoreException {
   synchronized (this) {
     while (fRProcess != null) {
       if (fRTask == 1) {
         monitor.subTask("Waiting for package check...");
         try {
           wait();
         } catch (final InterruptedException e) {
           if (monitor.isCanceled()) {
             throw new CoreException(Status.CANCEL_STATUS);
           }
         }
       } else {
         final Status status =
             new Status(
                 IStatus.ERROR,
                 RCore.PLUGIN_ID,
                 NLS.bind(
                     "Another package manager task for ''{0}'' is already running in ''{0}''",
                     fREnv.getName(), fRProcess.getLabel(ITool.DEFAULT_LABEL)));
         //				r.handleStatus(status, monitor);
         throw new CoreException(status);
       }
     }
     fRProcess = r.getTool();
     fRTask = 2;
   }
 }
예제 #2
0
  private void savePrefs(final SelectedRepos repos) {
    if (fREnv.getConfig() == null) {
      return;
    }
    final IScopeContext prefs = InstanceScope.INSTANCE;

    final IEclipsePreferences node = prefs.getNode(fSelectedReposPref.getQualifier());

    PreferencesUtil.setPrefValue(node, fSelectedReposPref, repos.getRepos());
    PreferencesUtil.setPrefValue(node, fSelectedCRANPref, repos.getCRANMirror());
    PreferencesUtil.setPrefValue(node, fBioCVersionPref, repos.getBioCVersion());
    PreferencesUtil.setPrefValue(node, fSelectedBioCPref, repos.getBioCMirror());

    if (repos.getCRANMirror() != null) {
      PreferencesUtil.setPrefValue(prefs, LAST_CRAN_PREF, repos.getCRANMirror());
    }
    if (repos.getBioCMirror() != null) {
      PreferencesUtil.setPrefValue(prefs, LAST_BIOC_PREF, repos.getBioCMirror());
    }

    try {
      node.flush();
    } catch (final BackingStoreException e) {
      RCorePlugin.log(
          new Status(
              IStatus.ERROR,
              RCore.PLUGIN_ID,
              "An error occurred when saving the R package manager preferences.",
              e));
    }
  }
예제 #3
0
 public REnvLibGroups getRLibGroups() {
   if (fRLibGroups != null) {
     return fRLibGroups;
   }
   final IREnvConfiguration config = fREnv.getConfig();
   if (config != null) {
     return new REnvLibGroups(config);
   }
   return null;
 }
예제 #4
0
  private void checkInit(final int flags, final RService r, final IProgressMonitor monitor)
      throws CoreException {
    if ((flags & INITIAL) == INITIAL || fRPlatform == null) {
      checkRVersion(r.getPlatform());

      final IREnvConfiguration config = fREnv.getConfig();
      if (config != null && config.isRemote()) {
        fRLibGroups = REnvLibGroups.loadFromR(r, monitor);
      }
    }
  }
예제 #5
0
  @Override
  public void clear() {
    getWriteLock().lock();
    try {
      fSelectedRepos = new SelectedRepos(Collections.<RRepo>emptyList(), null, null, null);
      savePrefs(fSelectedRepos);

      fRequireLoad |= (REQUIRE_CRAN | REQUIRE_BIOC);
      fRequireLoad |= (REQUIRE_REPOS);

      final Change change = new Change(fREnv);
      change.fRepos = 1;
      checkRepos(change);

      fRequireLoad |= (REQUIRE_REPO_PKGS | REQUIRE_INST_PKGS);
      resetPkgs(fREnv.getConfig());
      fFirstTime = true;
    } finally {
      getWriteLock().unlock();
    }
  }