Copyright (c) 2005, 2015 IBM Corporation and others. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 Contributors: IBM Corporation - initial API and implementation
/******************************************************************************* * Copyright (c) 2005, 2015 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/
package org.eclipse.core.runtime.preferences;
This class provides a hook into the preference service before particular operations on the global preference tree. Preference modify listeners are registered with the preference service via XML and the org.eclipse.equinox.preferences.preferences or the org.eclipse.core.runtime.preferences extension point.

Clients may subclass this type.

Since:3.1
/** * This class provides a hook into the preference service before particular operations * on the global preference tree. Preference modify listeners are registered with * the preference service via XML and the <code>org.eclipse.equinox.preferences.preferences</code> * or the <code>org.eclipse.core.runtime.preferences</code> extension point. * <p> * Clients may subclass this type. * </p> * * @since 3.1 */
public abstract class PreferenceModifyListener {
Clients are given the opportunity to modify the given tree before it is applied to the global preference tree. Clients should return the tree which should be applied globally. The tree passed in will not be null and clients must not return a null tree.

This method is called by the preference service from within calls to IPreferencesService.applyPreferences(IExportedPreferences) or IPreferencesService.applyPreferences(IEclipsePreferences, IPreferenceFilter[]).

A typical action for clients to perform would be to intercept the incoming preference tree, migrate old preference values to new ones, and then return the new tree.

Params:
  • node – the tree to modify
Returns:the tree to apply to the global preferences
/** * Clients are given the opportunity to modify the given tree before it is applied * to the global preference tree. Clients should return the tree which should be * applied globally. The tree passed in will not be <code>null</code> and clients * <em>must not</em> return a <code>null</code> tree. * <p> * This method is called by the preference service from within calls to * {@link IPreferencesService#applyPreferences(IExportedPreferences)} or * {@link IPreferencesService#applyPreferences(IEclipsePreferences, IPreferenceFilter[])}. * </p> * <p> * A typical action for clients to perform would be to intercept the incoming preference tree, * migrate old preference values to new ones, and then return the new tree. * </p> * * @param node the tree to modify * @return the tree to apply to the global preferences */
public IEclipsePreferences preApply(IEclipsePreferences node) { // default implementation makes no modifications return node; } }