Exemplo n.º 1
0
  public RPkgManager(final IREnvConfiguration rConfig) {
    fREnv = rConfig.getReference();
    fREnvDirectory = EFS.getLocalFileSystem().getStore(REnvConfiguration.getStateLocation(fREnv));
    final String qualifier = ((AbstractPreferencesModelObject) rConfig).getNodeQualifiers()[0];
    fSelectedReposPref = new RRepoListPref(qualifier, "RPkg.Repos.repos"); // $NON-NLS-1$
    fSelectedCRANPref = new RRepoPref(qualifier, "RPkg.CRANMirror.repo"); // $NON-NLS-1$
    fBioCVersionPref = new StringPref2(qualifier, "RPkg.BioCVersion.ver"); // $NON-NLS-1$
    fSelectedBioCPref = new RRepoPref(qualifier, "RPkg.BioCMirror.repo"); // $NON-NLS-1$

    final IPreferenceAccess prefs = PreferencesUtil.getInstancePrefs();
    fAddRepos = new ArrayList<>();
    if (rConfig.getType() == IREnvConfiguration.USER_LOCAL_TYPE) {
      final String rjVersion =
          "" + ServerUtil.RJ_VERSION[0] + '.' + ServerUtil.RJ_VERSION[1]; // $NON-NLS-1$
      fAddRepos.add(
          new RRepo(
              RRepo.SPECIAL_PREFIX + "rj",
              "RJ",
              "http://download.walware.de/rj-" + rjVersion,
              null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
    fSelectedRepos =
        new SelectedRepos(
            prefs.getPreferenceValue(fSelectedReposPref),
            prefs.getPreferenceValue(fSelectedCRANPref),
            prefs.getPreferenceValue(fBioCVersionPref),
            prefs.getPreferenceValue(fSelectedBioCPref));

    fDB = DB.create(fREnv, fREnvDirectory);
    fCache = new Cache(fREnvDirectory);
    resetPkgs(rConfig);

    fFirstTime = true;
    fMirrorsStamp = fPkgsStamp = System.currentTimeMillis();
    fRequireLoad |= (REQUIRE_CRAN | REQUIRE_BIOC | REQUIRE_REPOS);
    fRequireLoad |= (REQUIRE_REPO_PKGS | REQUIRE_INST_PKGS);

    PreferencesUtil.getSettingsChangeNotifier().addManageListener(this);

    getWriteLock().lock();
    try {
      loadPrefs(true);
    } finally {
      getWriteLock().unlock();
    }
  }
Exemplo n.º 2
0
 public void dispose() {
   PreferencesUtil.getSettingsChangeNotifier().removeManageListener(this);
 }