1 package net.sourceforge.phpdt.internal.debug.ui;
3 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
5 import org.eclipse.core.resources.IWorkspace;
6 import org.eclipse.core.runtime.IPluginDescriptor;
7 import org.eclipse.core.runtime.IStatus;
8 import org.eclipse.core.runtime.Status;
9 import org.eclipse.ui.IWorkbenchPage;
10 import org.eclipse.ui.IWorkbenchWindow;
11 import org.eclipse.ui.plugin.AbstractUIPlugin;
12 import org.eclipse.swt.widgets.Shell;
13 import org.eclipse.jface.dialogs.ErrorDialog;
15 public class PHPDebugUiPlugin extends AbstractUIPlugin {
16 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.ui"; //$NON-NLS-1$
17 protected static PHPDebugUiPlugin plugin;
19 public PHPDebugUiPlugin(IPluginDescriptor descriptor) {
24 public static IWorkbenchWindow getActiveWorkbenchWindow() {
25 return getDefault().getWorkbench().getActiveWorkbenchWindow();
28 public static IWorkbenchPage getActivePage() {
29 return PHPDebugUiPlugin.getActiveWorkbenchWindow().getActivePage();
32 public static PHPDebugUiPlugin getDefault() {
36 public static IWorkspace getWorkspace() {
37 return PHPeclipsePlugin.getWorkspace();
41 * Convenience method which returns the unique identifier of this plugin.
43 public static String getUniqueIdentifier()
45 if ( getDefault() == null )
47 // If the default instance is not yet initialized,
48 // return a static identifier. This identifier must
49 // match the plugin id defined in plugin.xml
52 return getDefault().getDescriptor().getUniqueIdentifier();
56 * Returns the active workbench shell or <code>null</code> if none
58 * @return the active workbench shell or <code>null</code> if none
60 public static Shell getActiveWorkbenchShell() {
61 IWorkbenchWindow window = getActiveWorkbenchWindow();
63 return window.getShell();
68 public static void errorDialog( String message, IStatus status )
71 Shell shell = getActiveWorkbenchShell();
74 ErrorDialog.openError( shell, "Error", message, status );
78 public static void errorDialog( String message, Throwable t )
81 Shell shell = getActiveWorkbenchShell();
84 IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), /*ICDebugUIConstants.INTERNAL_ERROR*/ 150, t.getMessage(), null ); //$NON-NLS-1$
85 ErrorDialog.openError( shell, "Error", message, status );
89 public static void log(IStatus status) {
90 getDefault().getLog().log(status);
93 public static void log(Throwable e) {
94 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, PHPDebugUiMessages.getString("RdtDebugUiPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
97 // protected void initializeDefaultPreferences(IPreferenceStore store) {
98 // super.initializeDefaultPreferences(store);
100 // store.setDefault(RdtDebugUiConstants.PREFERENCE_KEYWORDS, getDefaultKeywords());
103 // protected String getDefaultKeywords() {
104 // return "class,def,end,if,module,new,puts,require,rescue,throw,while";