Package at.bestsolution.efxclipse.jface.preferences

Examples of at.bestsolution.efxclipse.jface.preferences.IPreferenceStore


  /*
   * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
   */
  public long getLong(String name) {
    IPreferenceStore visibleStore= getVisibleStore(name);
    if (visibleStore != null)
      return visibleStore.getLong(name);
    return LONG_DEFAULT_DEFAULT;
  }
View Full Code Here


  /*
   * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
   */
  public String getString(String name) {
    IPreferenceStore visibleStore= getVisibleStore(name);
    if (visibleStore != null)
      return visibleStore.getString(name);
    return STRING_DEFAULT_DEFAULT;
  }
View Full Code Here

  /*
   * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
   */
  public boolean isDefault(String name) {
    IPreferenceStore visibleStore= getVisibleStore(name);
    if (visibleStore != null)
      return visibleStore.isDefault(name);
    return false;
  }
View Full Code Here

  private void handlePropertyChangeEvent(IPreferenceStore childPreferenceStore, PropertyChangeEvent event) {
    String property= event.getProperty();
    Object oldValue= event.getOldValue();
    Object newValue= event.getNewValue();

    IPreferenceStore visibleStore= getVisibleStore(property);

    /*
     * Assume that the property is there but has no default value (its owner relies on the default-default value)
     * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
     */
    if (visibleStore == null && newValue != null)
      visibleStore= childPreferenceStore;

    if (visibleStore == null) {
      // no visible store
      if (oldValue != null)
        // removal in child, last in chain -> removal in this chained preference store
        firePropertyChangeEvent(event);
    } else if (visibleStore == childPreferenceStore) {
      // event from visible store
      if (oldValue != null) {
        // change in child, visible store -> change in this chained preference store
        firePropertyChangeEvent(event);
      } else {
        // insertion in child
        IPreferenceStore oldVisibleStore= null;
        int i= 0;
        int length= fPreferenceStores.length;
        while (i < length && fPreferenceStores[i++] != visibleStore) {
          // do nothing
        }
        while (oldVisibleStore == null && i < length) {
          if (fPreferenceStores[i].contains(property))
            oldVisibleStore= fPreferenceStores[i];
          i++;
        }

        if (oldVisibleStore == null) {
          // insertion in child, first in chain -> insertion in this chained preference store
          firePropertyChangeEvent(event);
        } else {
          // insertion in child, not first in chain
          oldValue= getOtherValue(property, oldVisibleStore, newValue);
          if (!oldValue.equals(newValue))
            // insertion in child, different old value -> change in this chained preference store
            firePropertyChangeEvent(property, oldValue, newValue);
          // else: insertion in child, same old value -> no change in this chained preference store
        }
      }
    } else {
      // event from other than the visible store
      boolean eventBeforeVisibleStore= false;
      for (int i= 0, length= fPreferenceStores.length; i < length; i++) {
        IPreferenceStore store= fPreferenceStores[i];
        if (store == visibleStore)
          break;
        if (store == childPreferenceStore) {
          eventBeforeVisibleStore= true;
          break;
View Full Code Here

   * @param property the name of the property
   * @return the preference store from which the property's value is visible,
   *   <code>null</code> if the property is unknown
   */
  private IPreferenceStore getVisibleStore(String property) {
    IPreferenceStore visibleStore= null;

    for (int i= 0, length= fPreferenceStores.length; i < length && visibleStore == null; i++) {
      IPreferenceStore store= fPreferenceStores[i];
      if (store.contains(property))
        visibleStore= store;
    }
    return visibleStore;
  }
View Full Code Here

    /*
     * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
     */
    public void propertyChange(PropertyChangeEvent event) {
      IPreferenceStore childPreferenceStore= getPreferenceStore();
      handlePropertyChangeEvent(childPreferenceStore, event);
    }
View Full Code Here

TOP

Related Classes of at.bestsolution.efxclipse.jface.preferences.IPreferenceStore

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.