1 package net.sourceforge.phpdt.internal.debug.core;
3 import java.util.MissingResourceException;
4 import java.util.ResourceBundle;
6 import net.sourceforge.phpdt.internal.debug.core.logview.LogView;
7 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
9 import org.eclipse.core.resources.IWorkspace;
10 import org.eclipse.core.runtime.CoreException;
11 import org.eclipse.core.runtime.IStatus;
12 import org.eclipse.core.runtime.Status;
13 import org.eclipse.swt.widgets.Shell;
14 import org.eclipse.ui.IViewPart;
15 import org.eclipse.ui.IWorkbenchPage;
16 import org.eclipse.ui.IWorkbenchWindow;
17 import org.eclipse.ui.plugin.AbstractUIPlugin;
18 import org.osgi.framework.BundleContext;
21 * The main plugin class to be used in the desktop.
23 public class PHPDebugCorePlugin extends AbstractUIPlugin {
24 // The shared instance.
25 protected static PHPDebugCorePlugin plugin;
26 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$
28 public static IWorkbenchPage getActivePage() {
29 return getDefault().internalGetActivePage();
31 public static Shell getActiveWorkbenchShell() {
32 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 });
49 public static String getResourceString(String key) {
50 ResourceBundle bundle = plugin.getResourceBundle();
53 String bundleString = bundle.getString(key);
54 //return "$"+bundleString;
56 } catch (MissingResourceException e) {
57 // default actions is to return key, which is OK
64 * Convenience method which returns the unique identifier of this plugin.
66 public static String getUniqueIdentifier() {
71 * Returns the workspace instance.
73 public static IWorkspace getWorkspace() {
74 return PHPeclipsePlugin.getWorkspace();
77 public static void log(int severity, String message) {
78 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
79 PHPDebugCorePlugin.log(status) ;
82 public static void log(IStatus status) {
83 getDefault().getLog().log(status);
86 public static void log(Throwable e) {
87 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
89 private ResourceBundle resourceBundle;
93 public PHPDebugCorePlugin() {
98 ResourceBundle.getBundle(
99 "net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$
100 } catch (MissingResourceException x) {
101 resourceBundle = null;
105 public java.util.ResourceBundle getResourceBundle() {
106 return resourceBundle;
109 private IWorkbenchPage internalGetActivePage() {
110 return getWorkbench().getActiveWorkbenchWindow().getActivePage();
114 * @see Plugin#shutdown()
116 /* public void shutdown() throws CoreException {
122 * This method is called upon plug-in activation
124 public void start(BundleContext context) throws Exception {
125 super.start(context);
129 * This method is called when the plug-in is stopped
131 public void stop(BundleContext context) throws Exception {