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 *******************************************************************************/ 11 package org.eclipse.test.performance.ui; 12 13 import org.eclipse.core.runtime.Plugin; 14 import org.eclipse.core.runtime.preferences.InstanceScope; 15 import org.eclipse.jface.preference.IPreferenceStore; 16 import org.eclipse.ui.preferences.ScopedPreferenceStore; 17 import org.osgi.framework.BundleContext; 18 19 /** 20 * The main plugin class to be used in the desktop. 21 */ 22 public class UiPlugin extends Plugin { 23 //The shared instance. 24 private static UiPlugin plugin; 25 private IPreferenceStore preferenceStore; 26 27 /** 28 * The constructor. 29 */ UiPlugin()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 */ start(BundleContext context)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 */ stop(BundleContext context)47 public void stop(BundleContext context) throws Exception { 48 super.stop(context); 49 plugin = null; 50 } 51 52 /** 53 * Returns the shared instance. 54 */ getDefault()55 public static UiPlugin getDefault() { 56 return plugin; 57 } 58 getPreferenceStore()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