From 5a852bcd96768c75394b4575fe65f0532447e762 Mon Sep 17 00:00:00 2001
From: cperkonig <cperkonig>
Date: Sun, 29 Feb 2004 18:36:27 +0000
Subject: [PATCH 1/1] changes for new Action

---
 .../phpdt/internal/debug/ui/PHPDebugUiPlugin.java  |   51 ++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
index 63b7b6e..340563e 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
@@ -9,6 +9,8 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.jface.dialogs.ErrorDialog;
 
 public class PHPDebugUiPlugin extends AbstractUIPlugin {
 	public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.ui"; //$NON-NLS-1$
@@ -34,6 +36,55 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin {
 	public static IWorkspace getWorkspace() {
 		return PHPeclipsePlugin.getWorkspace();
 	}
+	
+	/**
+	 * Convenience method which returns the unique identifier of this plugin.
+	 */
+	public static String getUniqueIdentifier()
+	{
+		if ( getDefault() == null )
+		{
+			// If the default instance is not yet initialized,
+			// return a static identifier. This identifier must
+			// match the plugin id defined in plugin.xml
+			return PLUGIN_ID;
+		}
+		return getDefault().getDescriptor().getUniqueIdentifier();
+	}	
+	
+	/**
+	 * Returns the active workbench shell or <code>null</code> if none
+	 * 
+	 * @return the active workbench shell or <code>null</code> if none
+	 */
+	public static Shell getActiveWorkbenchShell() {
+		IWorkbenchWindow window = getActiveWorkbenchWindow();
+		if (window != null) {
+			return window.getShell();
+		}
+		return null;
+	}
+	
+	public static void errorDialog( String message, IStatus status )
+		{
+			log( status );
+			Shell shell = getActiveWorkbenchShell();
+			if ( shell != null )
+			{
+				ErrorDialog.openError( shell, "Error", message, status );
+			}
+		}
+
+		public static void errorDialog( String message, Throwable t )
+		{
+			log( t );
+			Shell shell = getActiveWorkbenchShell();
+			if ( shell != null )
+			{
+				IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), /*ICDebugUIConstants.INTERNAL_ERROR*/ 150, t.getMessage(), null ); //$NON-NLS-1$	
+				ErrorDialog.openError( shell, "Error", message, status );
+			}
+		}			
 
 	public static void log(IStatus status) {
 		getDefault().getLog().log(status);
-- 
1.7.1