1/*******************************************************************************
2 * Copyright (c) 2000, 2009 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 *******************************************************************************/
11package org.eclipse.test.performance.ui;
12
13import org.eclipse.core.runtime.Plugin;
14import org.eclipse.core.runtime.preferences.InstanceScope;
15import org.eclipse.jface.preference.IPreferenceStore;
16import org.eclipse.ui.preferences.ScopedPreferenceStore;
17import org.osgi.framework.BundleContext;
18
19/**
20 * The main plugin class to be used in the desktop.
21 */
22public class UiPlugin extends Plugin {
23	//The shared instance.
24	private static UiPlugin plugin;
25	private IPreferenceStore preferenceStore;
26
27	/**
28	 * The constructor.
29	 */
30	public UiPlugin() {
31		super();
32		if (plugin == null) {
33			plugin = this;
34		}
35	}
36
37	/**
38	 * This method is called upon plug-in activation
39	 */
40	public void start(BundleContext context) throws Exception {
41		super.start(context);
42	}
43
44	/**
45	 * This method is called when the plug-in is stopped
46	 */
47	public void stop(BundleContext context) throws Exception {
48		super.stop(context);
49		plugin = null;
50	}
51
52	/**
53	 * Returns the shared instance.
54	 */
55	public static UiPlugin getDefault() {
56		return plugin;
57	}
58
59	public IPreferenceStore getPreferenceStore() {
60		if (this.preferenceStore == null) {
61			this.preferenceStore = new ScopedPreferenceStore(new InstanceScope(), getBundle().getSymbolicName());
62
63		}
64		return this.preferenceStore;
65	}
66
67}
68