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.*;
16 import org.eclipse.ui.plugin.AbstractUIPlugin;
17 import org.osgi.framework.BundleContext;
19 * The main web browser plugin class.
21 public class WebBrowserUIPlugin extends AbstractUIPlugin {
22 // Web browser plugin id
23 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.webbrowser";
25 // singleton instance of this class
26 private static WebBrowserUIPlugin singleton;
29 * Create the WebBrowserUIPlugin
31 public WebBrowserUIPlugin() {
37 * Returns the singleton instance of this plugin.
39 * @return net.sourceforge.phpeclipse.webbrowser.WebBrowserPlugin
41 public static WebBrowserUIPlugin getInstance() {
46 * Returns the translated String found with the given key.
48 * @param key java.lang.String
49 * @return java.lang.String
51 public static String getResource(String key) {
53 return Platform.getResourceString(getInstance().getBundle(), key);
54 } catch (Exception e) {
60 * Returns the translated String found with the given key,
61 * and formatted with the given arguments using java.text.MessageFormat.
63 * @param key java.lang.String
64 * @param arg java.lang.String
65 * @return java.lang.String
67 public static String getResource(String key, String arg) {
69 String text = getResource(key);
70 return MessageFormat.format(text, new String[] { arg });
71 } catch (Exception e) {
76 public void start(BundleContext context) throws Exception {
78 WebBrowserPreference.initializeDefaultPreferences();
82 * Shuts down this plug-in and saves all plug-in state.
84 * @exception Exception
86 public void stop(BundleContext context) throws Exception {
88 BrowserManager.getInstance().dispose();