KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > preferences > InstanceScope


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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.internal.preferences.AbstractScope;
14 import org.eclipse.core.runtime.IPath;
15 import org.eclipse.osgi.service.datalocation.Location;
16
17 /**
18  * Object representing the instance scope in the Eclipse preferences
19  * hierarchy. Can be used as a context for searching for preference
20  * values (in the IPreferencesService APIs) or for determining the
21  * correct preference node to set values in the store.
22  * <p>
23  * Instance preferences are stored on a per instance basis in the
24  * platform's instance area as specified by the {@link Location} class
25  * and the {@link Location#INSTANCE_FILTER} filter.
26  * </p><p>
27  * The path for preferences defined in the instance scope hierarchy
28  * is as follows: <code>/instance/&lt;qualifier&gt;</code>
29  * </p>
30  * <p>
31  * This class is not intended to be subclassed. This class may be instantiated.
32  * </p>
33  * @see Location#INSTANCE_FILTER
34  * @since 3.0
35  */

36 public final class InstanceScope extends AbstractScope implements IScopeContext {
37
38     /**
39      * String constant (value of <code>"instance"</code>) used for the
40      * scope name for the instance preference scope.
41      */

42     public static final String JavaDoc SCOPE = "instance"; //$NON-NLS-1$
43

44     /**
45      * Create and return a new instance scope instance.
46      */

47     public InstanceScope() {
48         super();
49     }
50
51     /*
52      * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
53      */

54     public IPath getLocation() {
55         // Return null. The instance location usually corresponds to the state
56
// location of the bundle and we don't know what bundle we are dealing with.
57
return null;
58     }
59
60     /*
61      * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
62      */

63     public String JavaDoc getName() {
64         return SCOPE;
65     }
66
67     /* (non-Javadoc)
68      * @see org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String)
69      */

70     public IEclipsePreferences getNode(String JavaDoc qualifier) {
71         return super.getNode(qualifier);
72     }
73 }
74
Popular Tags