Class ProfileManager

  • Direct Known Subclasses:

    public abstract class ProfileManager
    extends java.util.Observable
    The model for the set of profiles which are available in the workbench.
    • Field Detail

      • ID_PREFIX

        public static final java.lang.String ID_PREFIX
        A prefix which is prepended to every ID of a user-defined profile, in order to differentiate it from a built-in profile.
        See Also:
        Constant Field Values

        public static final int SELECTION_CHANGED_EVENT
        The possible events for observers listening to this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProfileManager

        public ProfileManager​(java.util.List<ProfileManager.Profile> profiles,
                              org.eclipse.core.runtime.preferences.IScopeContext context,
                              PreferencesAccess preferencesAccess,
                              ProfileManager.KeySet[] keySets,
                              java.lang.String profileKey)
        Create and initialize a new profile manager.
        profiles - Initial custom profiles (List of type CustomProfile)
    • Method Detail

      • getSelectedProfileId

        protected java.lang.String getSelectedProfileId​(org.eclipse.core.runtime.preferences.IScopeContext instanceScope)
      • hasProjectSpecificSettings

        public static boolean hasProjectSpecificSettings​(org.eclipse.core.runtime.preferences.IScopeContext context,
                                                         ProfileManager.KeySet[] keySets)
      • hasProjectSpecificSettings

        public boolean hasProjectSpecificSettings​(org.eclipse.core.runtime.preferences.IScopeContext context)
      • getSortedProfiles

        public java.util.List<ProfileManager.Profile> getSortedProfiles()
        Get an immutable list as view on all profiles, sorted alphabetically. Unless the set of profiles has been modified between the two calls, the sequence is guaranteed to correspond to the one returned by getSortedNames.
        a list of elements of type Profile
        See Also:
      • getSortedDisplayNames

        public java.lang.String[] getSortedDisplayNames()
        Get the names of all profiles stored in this profile manager, sorted alphabetically. Unless the set of profiles has been modified between the two calls, the sequence is guaranteed to correspond to the one returned by getSortedProfiles.
        All names, sorted alphabetically
        See Also:
      • getProfile

        public ProfileManager.Profile getProfile​(java.lang.String ID)
        Get the profile for this profile id.
        ID - The profile ID
        The profile with the given ID or null
      • commitChanges

        public void commitChanges​(org.eclipse.core.runtime.preferences.IScopeContext scopeContext)
        Activate the selected profile, update all necessary options in preferences and save profiles to disk.
      • clearAllSettings

        public void clearAllSettings​(org.eclipse.core.runtime.preferences.IScopeContext context)
      • getSelected

        public ProfileManager.Profile getSelected()
        Get the currently selected profile.
        The currently selected profile.
      • setSelected

        public void setSelected​(ProfileManager.Profile profile)
        Set the selected profile. The profile must already be contained in this profile manager.
        profile - The profile to select
      • containsName

        public boolean containsName​(java.lang.String name)
        Check whether a user-defined profile in this profile manager already has this name.
        name - The name to test for
        Returns true if a profile with the given name exists
      • addProfile

        public void addProfile​(ProfileManager.CustomProfile profile)
        Add a new custom profile to this profile manager.
        profile - The profile to add
      • deleteSelected

        public boolean deleteSelected()
        Delete the currently selected profile from this profile manager. The next profile in the list is selected.
        true if the profile has been successfully removed, false otherwise.
      • updateProfilesWithName

        protected void updateProfilesWithName​(java.lang.String oldName,
                                              ProfileManager.Profile newProfile,
                                              boolean applySettings)