KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > registry > RegistryProviderFactory


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.core.internal.registry;
13
14 import org.eclipse.core.runtime.*;
15 import org.eclipse.core.runtime.spi.IRegistryProvider;
16
17 /**
18  * @since org.eclipse.equinox.registry 3.2
19  */

20 public final class RegistryProviderFactory {
21
22     private static IRegistryProvider defaultRegistryProvider;
23
24     public static IRegistryProvider getDefault() {
25         return defaultRegistryProvider;
26     }
27
28     public static void setDefault(IRegistryProvider provider) throws CoreException {
29         if (defaultRegistryProvider != null) {
30             Status status = new Status(IStatus.ERROR, RegistryMessages.OWNER_NAME, IRegistryConstants.PLUGIN_ERROR, RegistryMessages.registry_default_exists, null);
31             throw new CoreException(status);
32         }
33         defaultRegistryProvider = provider;
34     }
35
36     public static void releaseDefault() {
37         defaultRegistryProvider = null;
38     }
39 }
40
Popular Tags