2 * Copyright (c) 2003 IBM Corporation and others.
3 * All rights reserved. � This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM - Initial API and implementation
11 package net.sourceforge.phpeclipse.webbrowser.internal;
13 import java.text.MessageFormat;
15 import org.eclipse.core.runtime.Platform;
16 import org.eclipse.ui.plugin.AbstractUIPlugin;
17 import org.osgi.framework.BundleContext;
20 * The main web browser plugin class.
22 public class WebBrowserUIPlugin extends AbstractUIPlugin {
23 // Web browser plugin id
24 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.webbrowser";
26 // singleton instance of this class
27 private static WebBrowserUIPlugin singleton;
30 * Create the WebBrowserUIPlugin
32 public WebBrowserUIPlugin() {
38 * Returns the singleton instance of this plugin.
40 * @return net.sourceforge.phpeclipse.webbrowser.WebBrowserPlugin
42 public static WebBrowserUIPlugin getInstance() {
47 * Returns the translated String found with the given key.
51 * @return java.lang.String
53 public static String getResource(String key) {
55 return Platform.getResourceString(getInstance().getBundle(), key);
56 } catch (Exception e) {
62 * Returns the translated String found with the given key, and formatted
63 * with the given arguments using java.text.MessageFormat.
69 * @return java.lang.String
71 public static String getResource(String key, String arg) {
73 String text = getResource(key);
74 return MessageFormat.format(text, new String[] { arg });
75 } catch (Exception e) {
80 public void start(BundleContext context) throws Exception {
82 WebBrowserPreference.initializeDefaultPreferences();
86 * Shuts down this plug-in and saves all plug-in state.
88 * @exception Exception
90 public void stop(BundleContext context) throws Exception {
92 BrowserManager.getInstance().dispose();