summaryrefslogtreecommitdiffstats
path: root/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java
blob: 823dbde3789083d11b49e02c2372e9318623fc70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.examples.browser.demos;

import org.eclipse.ui.plugin.*;
import org.osgi.framework.BundleContext;
import java.util.*;
import org.eclipse.core.runtime.*;

public class BrowserDemoPlugin extends AbstractUIPlugin {

	public static BrowserDemoPlugin plugin;
	ResourceBundle resourceBundle;
	public static String PLUGIN_PATH = null;
	
	public BrowserDemoPlugin() {
		super();
		plugin = this;
		try {
			resourceBundle = ResourceBundle.getBundle("org.eclipse.swt.examples.browser.demos.BrowserDemoPluginResources");
		} catch (MissingResourceException x) {
			resourceBundle = null;
		}
	}

	public void start(BundleContext context) throws Exception {
		super.start(context);
		PLUGIN_PATH = Platform.resolve(plugin.getBundle().getEntry(".")).toString();
	}

	public void stop(BundleContext context) throws Exception {
		super.stop(context);
	}

	public static BrowserDemoPlugin getDefault() {
		return plugin;
	}

	public static String getResourceString(String key) {
		ResourceBundle bundle = BrowserDemoPlugin.getDefault().getResourceBundle();
		try {
			return (bundle != null) ? bundle.getString(key) : key;
		} catch (MissingResourceException e) {
			return key;
		}
	}

	public ResourceBundle getResourceBundle() {
		return resourceBundle;
	}	
}