Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IPreference


        type = IPreference.Type.STRING;
        break;
      default:
        throw new IllegalArgumentException(oldPref.getType().toString());
    }
    IPreference newPref = new org.rssowl.core.internal.persist.Preference(oldPref.getKey());
    MigrationHelper.setField(newPref, "fValues", values);
    MigrationHelper.setField(newPref, "fType", type);
    return newPref;
  }
View Full Code Here


    /* Update Set Actions */
    fViewSite.getActionBars().getToolBarManager().find(PREVIOUS_SET_ACTION).update(IAction.ENABLED);
    fViewSite.getActionBars().getToolBarManager().find(NEXT_SET_ACTION).update(IAction.ENABLED);

    /* Save the new selected Set in Preferences */
    IPreference pref = fPrefDAO.loadOrCreate(PREF_SELECTED_BOOKMARK_SET);
    pref.putLongs(fSelectedBookMarkSet.getId());
    fPrefDAO.save(pref);
  }
View Full Code Here

      i++;
    }
    /* Add the ID of the current selected Set to make it Unique */
    String key = PREF_EXPANDED_NODES + fSelectedBookMarkSet;

    IPreference pref = fPrefDAO.loadOrCreate(key);
    pref.putLongs(elements);
    fPrefDAO.save(pref);
  }
View Full Code Here

    fSortByName = fGlobalPreferences.getBoolean(DefaultPreferences.BE_SORT_BY_NAME);
    fLinkingEnabled = fGlobalPreferences.getBoolean(DefaultPreferences.BE_ENABLE_LINKING);
    fFilterType = BookMarkFilter.Type.values()[fGlobalPreferences.getInteger(DefaultPreferences.BE_FILTER_TYPE)];
    fGroupingType = BookMarkGrouping.Type.values()[fGlobalPreferences.getInteger(DefaultPreferences.BE_GROUP_TYPE)];

    IPreference pref = fPrefDAO.load(PREF_SELECTED_BOOKMARK_SET);
    Assert.isTrue(fRootFolders.size() > 0, "Could not find any Bookmark Set!"); //$NON-NLS-1$
    if (pref != null)
      fSelectedBookMarkSet = new FolderReference(pref.getLong().longValue()).resolve();
    else {
      fSelectedBookMarkSet = getRootFolderAt(0);

      /* Save this to make sure subsequent calls succeed */
      pref = Owl.getModelFactory().createPreference(PREF_SELECTED_BOOKMARK_SET);
      pref.putLongs(fSelectedBookMarkSet.getId());
      fPrefDAO.save(pref);
    }

    /* Expanded Elements */
    loadExpandedElements();
View Full Code Here

    loadExpandedElements();
  }

  /* Expanded Elements - Use ID of selected Set to make it Unique */
  private void loadExpandedElements() {
    IPreference pref = fPrefDAO.load(PREF_EXPANDED_NODES + fSelectedBookMarkSet);
    if (pref != null) {
      for (long element : pref.getLongs())
        fExpandedNodes.add(element);
    }
  }
View Full Code Here

    else if (entity instanceof ISearchCondition) {
      ISearchCondition searchCond = (ISearchCondition) entity;
      modelEvent = new SearchConditionEvent(searchCond, root);
    }
    else if (entity instanceof IPreference) {
      IPreference pref = (IPreference) entity;
      modelEvent = new PreferenceEvent(pref);
    }
    return modelEvent;
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getBoolean(java.lang.String)
   */
  public boolean getBoolean(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getBoolean() != null)
      return cachedPref.getBoolean();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getBoolean() != null) {
      fCache.put(key, pref);
      return pref.getBoolean();
    }

    /* Ask Parent */
    boolean parentValue = fParent.getBoolean(key);
   
    /* Cache value from parent */
    pref = Owl.getModelFactory().createPreference(key);
    pref.putBooleans(parentValue);
    fCache.put(key, pref);

    return parentValue;
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getInteger(java.lang.String)
   */
  public int getInteger(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getInteger() != null)
      return cachedPref.getInteger();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getInteger() != null) {
      fCache.put(key, pref);
      return pref.getInteger();
    }

    /* Ask Parent */
    int parentValue = fParent.getInteger(key);
   
    /* Cache value from parent */
    pref = Owl.getModelFactory().createPreference(key);
    pref.putIntegers(parentValue);
    fCache.put(key, pref);

    return parentValue;
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getIntegers(java.lang.String)
   */
  public int[] getIntegers(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getIntegers() != null)
      return cachedPref.getIntegers();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getIntegers() != null) {
      fCache.put(key, pref);
      return pref.getIntegers();
    }

    /* Ask Parent */
    int[] parentValue = fParent.getIntegers(key);
   
    /* Cache value from parent */
    if (parentValue != null) {
      pref = Owl.getModelFactory().createPreference(key);
      pref.putIntegers(parentValue);
      fCache.put(key, pref);
    }

    return parentValue;
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getLong(java.lang.String)
   */
  public long getLong(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getLong() != null)
      return cachedPref.getLong();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getLong() != null) {
      fCache.put(key, pref);
      return pref.getLong();
    }

    /* Ask Parent */
    long parentValue = fParent.getLong(key);
   
    /* Cache value from parent */
    pref = Owl.getModelFactory().createPreference(key);
    pref.putLongs(parentValue);
    fCache.put(key, pref);

    return parentValue;
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IPreference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.