1 /******************************************************************************* 2 * Copyright (c) 2014 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.core.internal.content; 15 16 import org.eclipse.core.runtime.preferences.IEclipsePreferences; 17 import org.eclipse.core.runtime.preferences.InstanceScope; 18 import org.osgi.service.prefs.BackingStoreException; 19 import org.osgi.service.prefs.Preferences; 20 21 public class PreferenceModifyListener extends org.eclipse.core.runtime.preferences.PreferenceModifyListener { 22 @Override preApply(IEclipsePreferences node)23 public IEclipsePreferences preApply(IEclipsePreferences node) { 24 Preferences root = node.node("/"); //$NON-NLS-1$ 25 try { 26 if (root.nodeExists(InstanceScope.SCOPE)) { 27 Preferences instance = root.node(InstanceScope.SCOPE); 28 if (instance.nodeExists(ContentTypeManager.CONTENT_TYPE_PREF_NODE)) 29 ContentTypeManager.getInstance().invalidate(); 30 } 31 } catch (BackingStoreException e) { 32 // do nothing 33 } 34 return node; 35 } 36 } 37