1 /******************************************************************************* 2 * Copyright (c) 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.runtime.preferences; 12 13 import java.util.Map; 14 15 /** 16 * Preference filters are used to describe the relationship between the 17 * preference tree and a data set when importing/exporting preferences. 18 * <p> 19 * For instance, a client is able to create a preference filter describing 20 * which preference nodes/keys should be used when exporting the 21 * "Key Bindings" preferences. When the export happens, the tree is 22 * trimmed and only the applicable preferences will be exported. 23 * </p> 24 * <p> 25 * Clients may implement this interface. 26 * </p> 27 * 28 * @since 3.1 29 */ 30 public interface IPreferenceFilter { 31 32 /** 33 * Return an array of scopes that this preference filter is applicable for. The list 34 * of scopes must not be <code>null</code>. 35 * <p> 36 * For example: 37 * <code>new String[] {InstanceScope.SCOPE, ConfigurationScope.SCOPE};</code> 38 * </p> 39 * 40 * @return the array of scopes 41 */ 42 public String[] getScopes(); 43 44 /** 45 * Return a mapping which defines the nodes and keys that this filter 46 * applies to. 47 * <p> 48 * If the map is <code>null</code> then this filter is applicable for all 49 * nodes within the scope. The map can also be <code>null</code> if 50 * the given scope is not known to this filter. 51 * </p> 52 * <p> 53 * The keys in the table are Strings and describe the node path. The values are 54 * an optional array of {@link PreferenceFilterEntry} objects describing the list of 55 * applicable keys in that node. If the value is null then the whole node is 56 * considered applicable. 57 * </p> 58 * <p> 59 * key: <code>String</code> (node)<br> 60 * value: <code>PreferenceFilterEntry[]</code> or <code>null</code> (preference keys)<br> 61 * </p> 62 * <p> 63 * For example: 64 * <pre> 65 * "org.eclipse.core.resources" -> null 66 * "org.eclipse.ui" -> new PreferenceFilterEntry[] { 67 * new PreferenceFilterEntry("DEFAULT_PERSPECTIVE_LOCATION"), 68 * new PreferenceFilterEntry("SHOW_INTRO_ON_STARTUP")} 69 * </pre> 70 * </p> 71 * 72 * @return the mapping table 73 * @see PreferenceFilterEntry 74 */ 75 public Map getMapping(String scope); 76 77 } 78