Class AbstractPreference

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractPreference​(java.lang.String name, org.eclipse.jface.preference.IPreferenceStore store)
      Creates a new preference with the given name and the given store.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(IPreferenceListener listener)
      Adds the given listener for value change events to this preference.
      java.lang.String getName()
      Returns the name of this preference.
      org.eclipse.jface.preference.IPreferenceStore getStore()
      Returns the store for this preference.
      boolean isDefault()
      Returns whether the current value of this preference has the default value.
      void removeListener​(IPreferenceListener listener)
      Removes the given value change listener from this preference.
      void setToDefault()
      Sets the current value of this preference back to its default value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractPreference

        public AbstractPreference​(java.lang.String name,
                                  org.eclipse.jface.preference.IPreferenceStore store)
        Creates a new preference with the given name and the given store.
        Parameters:
        name - the preference name (not null)
        store - the preference store (not null)
    • Method Detail

      • getName

        public final java.lang.String getName()
        Returns the name of this preference.
        Returns:
        the preference name (never null)
      • getStore

        public final org.eclipse.jface.preference.IPreferenceStore getStore()
        Returns the store for this preference.
        Returns:
        the preference store (never null)
      • setToDefault

        public final void setToDefault()
        Sets the current value of this preference back to its default value.

        Note that the preferred way of re-initializing a preference to the appropriate default value is to call setToDefault. This is implemented by removing the preference value from the store, thereby exposing the default value.

      • isDefault

        public final boolean isDefault()
        Returns whether the current value of this preference has the default value.
        Returns:
        true if the preference has a known default value and its current value is the same, and false otherwise
      • addListener

        public final void addListener​(IPreferenceListener listener)
        Description copied from interface: IPreference
        Adds the given listener for value change events to this preference. Has no effect if the listener is already registered.

        Make sure to remove the listener on the same preference instance.

        Specified by:
        addListener in interface IPreference
        Parameters:
        listener - not null
      • removeListener

        public final void removeListener​(IPreferenceListener listener)
        Description copied from interface: IPreference
        Removes the given value change listener from this preference. Has no effect if the listener was not already registered.
        Specified by:
        removeListener in interface IPreference
        Parameters:
        listener - not null