Skip to main content
summaryrefslogtreecommitdiffstats
blob: 649e61c92be873fe483e9108d90c61ba8a816cf8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
 * 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;

import java.util.Map;

/**
 * Preference filters are used to describe the relationship between the
 * preference tree and a data set when importing/exporting preferences.
 * <p>
 * For instance, a client is able to create a preference filter describing
 * which preference nodes/keys should be used when exporting the
 * "Key Bindings" preferences. When the export happens, the tree is
 * trimmed and only the applicable preferences will be exported.
 * </p>
 * <p>
 * Clients may implement this interface.
 * </p>
 *
 * @since 3.1
 */
public interface IPreferenceFilter {

	/**
	 * Return an array of scopes that this preference filter is applicable for. The list
	 * of scopes must not be <code>null</code>.
	 * <p>
	 * For example:
	 * <code>new String[] {InstanceScope.SCOPE, ConfigurationScope.SCOPE};</code>
	 * </p>
	 *
	 * @return the array of scopes
	 */
	public String[] getScopes();

	/**
	 * Return a mapping which defines the nodes and keys that this filter
	 * applies to.
	 * <p>
	 * If the map is <code>null</code> then this filter is applicable for all
	 * nodes within the scope. The map can also be <code>null</code> if
	 * the given scope is not known to this filter.
	 * </p>
	 * <p>
	 * The keys in the table are Strings and describe the node path. The values are
	 * an optional array of {@link PreferenceFilterEntry} objects describing the list of
	 * applicable keys in that node. If the value is null then the whole node is
	 * considered applicable.
	 * </p>
	 * <p>
	 * key: <code>String</code> (node)<br>
	 * value: <code>PreferenceFilterEntry[]</code> or <code>null</code> (preference keys)<br>
	 * </p>
	 * <p>
	 * For example:
	 * </p>
	 * <pre>
	 * "org.eclipse.core.resources" -&gt; null
	 * "org.eclipse.ui" -&gt; new PreferenceFilterEntry[] {
	 * 		new PreferenceFilterEntry("DEFAULT_PERSPECTIVE_LOCATION"),
	 * 		new PreferenceFilterEntry("SHOW_INTRO_ON_STARTUP")}
	 * </pre>
	 *
	 * @return the mapping table
	 * @see PreferenceFilterEntry
	 */
	public Map<String, PreferenceFilterEntry[]> getMapping(String scope);

}

Back to the top