Package org.rssowl.core.persist.pref

Examples of org.rssowl.core.persist.pref.IPreferenceScope


      };
      DynamicDAO.addEntityListener(IBookMark.class, bookmarkListener);

      IMark mark = folder.getMarks().get(0);

      IPreferenceScope bookmarkScope = Owl.getPreferenceService().getEntityScope(mark);
      bookmarkScope.putString("key10", "value1");
      bookmarkScope.flush();

      assertEquals(1, eventsCounter[0]);

      bookmarkScope.putString("key20", "value2");
      bookmarkScope.flush();

      assertEquals(2, eventsCounter[0]);
    } finally {
      if (bookmarkListener != null)
        DynamicDAO.removeEntityListener(IBookMark.class, bookmarkListener);
View Full Code Here


    /* Global / Eclipse Preferences */
    fillPreferences();
  }

  private void fillPreferences() {
    IPreferenceScope globalPreferences = Owl.getPreferenceService().getGlobalScope();
    IPreferenceScope eclipsePreferences = Owl.getPreferenceService().getGlobalScope();

    globalPreferences.putBoolean(Preference.MARK_READ_ON_TAB_CLOSE.id(), true);
    globalPreferences.putInteger(Preference.MARK_READ_IN_MILLIS.id(), 5);
    globalPreferences.putIntegers(Preference.BM_NEWS_COLUMNS.id(), new int[] { -1, 0, 1, 2, 3 });
    globalPreferences.putLong(Preference.BM_UPDATE_INTERVAL.id(), 8);
    globalPreferences.putLong(Preference.NM_SELECTED_NEWS.id(), 100);
    globalPreferences.putString(Preference.CUSTOM_BROWSER_PATH.id(), "hello world");
    globalPreferences.putStrings(Preference.DISABLE_JAVASCRIPT_EXCEPTIONS.id(), new String[] { "hello", "world", "foo", "bar" });

    eclipsePreferences.putBoolean(Preference.ECLIPSE_SINGLE_CLICK_OPEN.id(), true);
    eclipsePreferences.putInteger(Preference.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD.id(), 5);
    eclipsePreferences.putString(Preference.ECLIPSE_PROXY_HOST_HTTP.id(), "");
  }
View Full Code Here

    eclipsePreferences.putInteger(Preference.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD.id(), 5);
    eclipsePreferences.putString(Preference.ECLIPSE_PROXY_HOST_HTTP.id(), "");
  }

  private void assertPreferences() {
    IPreferenceScope globalPreferences = new GlobalScope(Owl.getPreferenceService().getDefaultScope());
    IPreferenceScope eclipsePreferences = Owl.getPreferenceService().getGlobalScope();

    assertEquals(true, globalPreferences.getBoolean(Preference.MARK_READ_ON_TAB_CLOSE.id()));
    assertEquals(5, globalPreferences.getInteger(Preference.MARK_READ_IN_MILLIS.id()));
    assertTrue(Arrays.equals(new int[] { -1, 0, 1, 2, 3 }, globalPreferences.getIntegers(Preference.BM_NEWS_COLUMNS.id())));
    assertEquals(8, globalPreferences.getLong(Preference.BM_UPDATE_INTERVAL.id()));
    assertTrue(globalPreferences.getLong(Preference.NM_SELECTED_NEWS.id()) != 100);
    assertEquals("hello world", globalPreferences.getString(Preference.CUSTOM_BROWSER_PATH.id()));
    assertTrue(Arrays.equals(new String[] { "hello", "world", "foo", "bar" }, globalPreferences.getStrings(Preference.DISABLE_JAVASCRIPT_EXCEPTIONS.id())));

    assertEquals(true, eclipsePreferences.getBoolean(Preference.ECLIPSE_SINGLE_CLICK_OPEN.id()));
    assertEquals(5, eclipsePreferences.getInteger(Preference.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD.id()));
    assertEquals("", eclipsePreferences.getString(Preference.ECLIPSE_PROXY_HOST_HTTP.id()));
  }
View Full Code Here

    }

    /* SearchCondition: News is Labeld */
    {
      ISearchMark mark = factory.createSearchMark(null, root, Messages.ImportWizard_LABELED_NEWS);
      IPreferenceScope preferences = Owl.getPreferenceService().getEntityScope(mark);
      preferences.putInteger(DefaultPreferences.BM_NEWS_GROUPING, NewsGrouping.Type.GROUP_BY_LABEL.ordinal());

      ISearchField field = factory.createSearchField(INews.LABEL, newsEntityName);
      factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, "*"); //$NON-NLS-1$
    }

View Full Code Here

    /* Load initial Settings */
    loadInitialSettings();
  }

  private void loadInitialSettings() {
    IPreferenceScope globalScope = Owl.getPreferenceService().getGlobalScope();
    IPreferenceScope defaultScope = Owl.getPreferenceService().getDefaultScope();

    /* Take the first scope as initial values */
    IPreferenceScope firstScope = fEntityPreferences.get(0);
    fPrefSelectedFilter = ModelUtils.loadIntegerValueWithFallback(firstScope, DefaultPreferences.BM_NEWS_FILTERING, globalScope, DefaultPreferences.FV_FILTER_TYPE);
    fPrefSelectedGroup = ModelUtils.loadIntegerValueWithFallback(firstScope, DefaultPreferences.BM_NEWS_GROUPING, globalScope, DefaultPreferences.FV_GROUP_TYPE);
    fPrefOpenSiteForNews = firstScope.getBoolean(DefaultPreferences.BM_OPEN_SITE_FOR_NEWS);
    fPrefLoadImagesForNews = firstScope.getBoolean(DefaultPreferences.BM_LOAD_IMAGES);

    /* For any other scope not sharing the initial values, use the default */
    for (int i = 1; i < fEntityPreferences.size(); i++) {
      IPreferenceScope otherScope = fEntityPreferences.get(i);

      if (ModelUtils.loadIntegerValueWithFallback(otherScope, DefaultPreferences.BM_NEWS_FILTERING, globalScope, DefaultPreferences.FV_FILTER_TYPE) != fPrefSelectedFilter)
        fPrefSelectedFilter = ModelUtils.loadIntegerValueWithFallback(defaultScope, DefaultPreferences.BM_NEWS_FILTERING, defaultScope, DefaultPreferences.FV_FILTER_TYPE);

      if (ModelUtils.loadIntegerValueWithFallback(otherScope, DefaultPreferences.BM_NEWS_GROUPING, globalScope, DefaultPreferences.FV_GROUP_TYPE) != fPrefSelectedGroup)
        fPrefSelectedGroup = ModelUtils.loadIntegerValueWithFallback(defaultScope, DefaultPreferences.BM_NEWS_GROUPING, defaultScope, DefaultPreferences.FV_GROUP_TYPE);

      if (otherScope.getBoolean(DefaultPreferences.BM_OPEN_SITE_FOR_NEWS) != fPrefOpenSiteForNews)
        fPrefOpenSiteForNews = defaultScope.getBoolean(DefaultPreferences.BM_OPEN_SITE_FOR_NEWS);

      if (otherScope.getBoolean(DefaultPreferences.BM_LOAD_IMAGES) != fPrefLoadImagesForNews)
        fPrefLoadImagesForNews = defaultScope.getBoolean(DefaultPreferences.BM_LOAD_IMAGES);
    }
  }
View Full Code Here

  private void updateChildPreferences(IFolder folder) {

    /* Update changes to Child-Marks */
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      IPreferenceScope scope = Owl.getPreferenceService().getEntityScope(mark);
      updatePreferences(scope);
    }

    /* Update changes to Child-Folders */
    List<IFolder> folders = folder.getFolders();
    for (IFolder childFolder : folders) {
      IPreferenceScope scope = Owl.getPreferenceService().getEntityScope(childFolder);
      updatePreferences(scope);

      /* Recursively Proceed */
      updateChildPreferences(childFolder);
    }
View Full Code Here

  }

  private void loadInitialSettings() {

    /* Take the first scope as initial values */
    IPreferenceScope firstScope = fEntityPreferences.get(0);
    fPrefUpdateIntervalState = firstScope.getBoolean(DefaultPreferences.BM_UPDATE_INTERVAL_STATE);
    fPrefUpdateInterval = firstScope.getLong(DefaultPreferences.BM_UPDATE_INTERVAL);
    fPrefOpenOnStartup = firstScope.getBoolean(DefaultPreferences.BM_OPEN_ON_STARTUP);

    /* For any other scope not sharing the initial values, use the default */
    IPreferenceScope defaultScope = Owl.getPreferenceService().getDefaultScope();
    for (int i = 1; i < fEntityPreferences.size(); i++) {
      IPreferenceScope otherScope = fEntityPreferences.get(i);

      if (otherScope.getBoolean(DefaultPreferences.BM_UPDATE_INTERVAL_STATE) != fPrefUpdateIntervalState)
        fPrefUpdateIntervalState = defaultScope.getBoolean(DefaultPreferences.BM_UPDATE_INTERVAL_STATE);

      if (otherScope.getLong(DefaultPreferences.BM_UPDATE_INTERVAL) != fPrefUpdateInterval)
        fPrefUpdateInterval = defaultScope.getLong(DefaultPreferences.BM_UPDATE_INTERVAL);

      if (otherScope.getBoolean(DefaultPreferences.BM_OPEN_ON_STARTUP) != fPrefOpenOnStartup)
        fPrefOpenOnStartup = defaultScope.getBoolean(DefaultPreferences.BM_OPEN_ON_STARTUP);
    }

    fUpdateIntervalScope = getUpdateIntervalScope();
  }
View Full Code Here

    /* Update changes to Child-BookMarks */
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      if (mark instanceof IBookMark) {
        IPreferenceScope scope = Owl.getPreferenceService().getEntityScope(mark);
        updatePreferences(scope);
      }
    }

    /* Update changes to Child-Folders */
    List<IFolder> folders = folder.getFolders();
    for (IFolder childFolder : folders) {
      IPreferenceScope scope = Owl.getPreferenceService().getEntityScope(childFolder);
      updatePreferences(scope);

      /* Recursively Proceed */
      updateChildPreferences(childFolder);
    }
View Full Code Here

      Activator.getDefault().logError(e.getMessage(), e);
      ((DialogPage) getContainer().getCurrentPage()).setMessage(Messages.CreateBookmarkWizard_ENTER_VALID_LINK, IMessageProvider.ERROR);
    }

    /* Remember Settings */
    IPreferenceScope globalPrefs = Owl.getPreferenceService().getGlobalScope();
    globalPrefs.putBoolean(DefaultPreferences.BM_LOAD_TITLE_FROM_FEED, fFeedDefinitionPage.loadTitleFromFeed());
    if (fFeedDefinitionPage.isKeywordSubscription())
      globalPrefs.putString(DefaultPreferences.LAST_KEYWORD_FEED, fKeywordPage.getSelectedEngine().getId());

    return res;
  }
View Full Code Here

    composite.setFont(parent.getFont());
    return composite;
  }

  private void onRestoreDefaults() {
    IPreferenceScope defaultScope = Owl.getPreferenceService().getDefaultScope();
    int[] defaultItemsState = defaultScope.getIntegers(DefaultPreferences.TOOLBAR_ITEMS);
    int defaultMode = defaultScope.getInteger(DefaultPreferences.TOOLBAR_MODE);

    fPreferences.putIntegers(DefaultPreferences.TOOLBAR_ITEMS, defaultItemsState);
    fPreferences.putInteger(DefaultPreferences.TOOLBAR_MODE, defaultMode);
    fItemViewer.refresh();
    fModeViewer.setSelection(new StructuredSelection(CoolBarMode.values()[defaultMode]));
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.pref.IPreferenceScope

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.