1 package net.sourceforge.phpdt.internal.debug.core;
3 import java.util.MissingResourceException;
4 import java.util.ResourceBundle;
6 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
8 import org.eclipse.core.resources.IWorkspace;
9 import org.eclipse.core.runtime.IStatus;
10 import org.eclipse.core.runtime.Status;
11 import org.eclipse.swt.widgets.Shell;
12 import org.eclipse.ui.IWorkbenchPage;
13 import org.eclipse.ui.IWorkbenchWindow;
14 import org.eclipse.ui.plugin.AbstractUIPlugin;
15 import org.osgi.framework.BundleContext;
18 * The main plugin class to be used in the desktop.
20 public class PHPDebugCorePlugin extends AbstractUIPlugin {
21 // The shared instance.
22 protected static PHPDebugCorePlugin plugin;
23 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$
25 public static IWorkbenchPage getActivePage() {
26 return getDefault().internalGetActivePage();
28 public static Shell getActiveWorkbenchShell() {
29 return getActiveWorkbenchWindow().getShell();
31 public static IWorkbenchWindow getActiveWorkbenchWindow() {
32 return getDefault().getWorkbench().getActiveWorkbenchWindow();
36 * Returns the shared instance.
38 public static PHPDebugCorePlugin getDefault() {
42 public static String getFormattedMessage(String key, String arg) {
43 String text = getResourceString(key);
44 return java.text.MessageFormat.format(text, new Object[] { arg });
46 public static String getResourceString(String key) {
47 ResourceBundle bundle = plugin.getResourceBundle();
50 String bundleString = bundle.getString(key);
51 //return "$"+bundleString;
53 } catch (MissingResourceException e) {
54 // default actions is to return key, which is OK
61 * Convenience method which returns the unique identifier of this plugin.
63 public static String getUniqueIdentifier() {
68 * Returns the workspace instance.
70 public static IWorkspace getWorkspace() {
71 return PHPeclipsePlugin.getWorkspace();
74 public static void log(int severity, String message) {
75 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
76 PHPDebugCorePlugin.log(status) ;
79 public static void log(IStatus status) {
80 getDefault().getLog().log(status);
83 public static void log(Throwable e) {
84 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
86 private ResourceBundle resourceBundle;
90 public PHPDebugCorePlugin() {
95 ResourceBundle.getBundle(
96 "net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$
97 } catch (MissingResourceException x) {
98 resourceBundle = null;
102 public java.util.ResourceBundle getResourceBundle() {
103 return resourceBundle;
106 private IWorkbenchPage internalGetActivePage() {
107 return getWorkbench().getActiveWorkbenchWindow().getActivePage();
111 * @see Plugin#shutdown()
113 /* public void shutdown() throws CoreException {
119 * This method is called upon plug-in activation
121 public void start(BundleContext context) throws Exception {
122 super.start(context);
126 * This method is called when the plug-in is stopped
128 public void stop(BundleContext context) throws Exception {