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;
24 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$
26 public static IWorkbenchPage getActivePage() {
27 return getDefault().internalGetActivePage();
30 // public static Shell getActiveWorkbenchShell() {
31 // return getActiveWorkbenchWindow().getShell();
34 public static IWorkbenchWindow getActiveWorkbenchWindow() {
35 return getDefault().getWorkbench().getActiveWorkbenchWindow();
39 * Returns the shared instance.
41 public static PHPDebugCorePlugin getDefault() {
45 // public static String getFormattedMessage(String key, String arg) {
46 // String text = getResourceString(key);
47 // return java.text.MessageFormat.format(text, new Object[] { arg });
50 public static String getResourceString(String key) {
51 ResourceBundle bundle = plugin.getResourceBundle();
54 String bundleString = bundle.getString(key);
55 // return "$"+bundleString;
57 } catch (MissingResourceException e) {
58 // default actions is to return key, which is OK
65 * Convenience method which returns the unique identifier of this plugin.
67 public static String getUniqueIdentifier() {
72 * Returns the workspace instance.
74 public static IWorkspace getWorkspace() {
75 return PHPeclipsePlugin.getWorkspace();
78 public static void log(int severity, String message) {
79 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
81 PHPDebugCorePlugin.log(status);
84 public static void log(IStatus status) {
85 getDefault().getLog().log(status);
88 public static void log(Throwable e) {
89 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
90 "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
93 private ResourceBundle resourceBundle;
98 // public PHPDebugCorePlugin() {
102 // resourceBundle = ResourceBundle
103 // .getBundle("net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$
104 // } catch (MissingResourceException x) {
105 // resourceBundle = null;
109 public java.util.ResourceBundle getResourceBundle() {
110 return resourceBundle;
113 private IWorkbenchPage internalGetActivePage() {
114 return getWorkbench().getActiveWorkbenchWindow().getActivePage();
118 * @see Plugin#shutdown()
121 * public void shutdown() throws CoreException { plugin = null;
122 * super.shutdown(); }
125 * This method is called upon plug-in activation
127 public void start(BundleContext context) throws Exception {
128 super.start(context);
132 * This method is called when the plug-in is stopped
134 public void stop(BundleContext context) throws Exception {