1 /******************************************************************************* 2 * Copyright (c) 2004, 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 org.eclipse.core.runtime.IPath; 14 15 /** 16 * Clients implement this interface to provide context to a 17 * particular scope. Instances of implementations of this interface are 18 * passed to the {@link IPreferencesService} for use in 19 * preference searching. 20 * <p> 21 * Clients may implement this interface. 22 * </p> 23 * 24 * @see IPreferencesService 25 * @since 3.0 26 */ 27 public interface IScopeContext { 28 29 /** 30 * Return the name of the scope that this context is associated with. 31 * Must not be <code>null</code>. 32 * 33 * @return the name of the scope 34 */ 35 public String getName(); 36 37 /** 38 * Return the preferences node that contains the preferences for the 39 * given qualifier or <code>null</code> if the node cannot be determined. 40 * The given qualifier must not be <code>null</code> but may be a path 41 * to a sub-node within the scope. 42 * <p> 43 * An example of a qualifier in Eclipse 2.1 would be the plug-in identifier that 44 * the preference is associated with (e.g. the "org.eclipse.core.resources" 45 * plug-in defines the "description.autobuild" preference). 46 * </p><p> 47 * This method can be used to determine the appropriate preferences node 48 * to aid in setting key/value pairs. For instance: 49 * <code>new InstanceScope().getNode("org.eclipse.core.resources");</code> 50 * returns the preference node in the instance scope where the preferences 51 * for "org.eclipse.core.resources" are stored. 52 * </p> 53 * @param qualifier a qualifier for the preference name 54 * @return the node containing the plug-in preferences or <code>null</code> 55 * @see IPreferencesService 56 */ 57 public IEclipsePreferences getNode(String qualifier); 58 59 /** 60 * Return a path to a location in the file-system where clients are able 61 * to write files that will have the same sharing/scope properties as 62 * preferences defined in this scope. 63 * <p> 64 * Implementors may return <code>null</code> if the location is not known, 65 * is unavailable, or is not applicable to this scope. 66 * </p> 67 * @return a writable location in the file system or <code>null</code> 68 */ 69 public IPath getLocation(); 70 } 71