1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

add new method erroDialog().

This commit is contained in:
Alain Magloire 2002-11-23 04:19:12 +00:00
parent 0a4fdc5cd3
commit 679f9913d5

View file

@ -11,6 +11,7 @@ import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener; import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
@ -112,6 +113,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
public static void log(Throwable e) { public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$
} }
/** /**
* Returns the active workbench window * Returns the active workbench window
* *
@ -128,8 +130,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
} }
return null; return null;
} }
/** /**
* Returns the active workbench shell or <code>null</code> if none * Returns the active workbench shell or <code>null</code> if none
* *
@ -141,6 +142,23 @@ public class LaunchUIPlugin extends AbstractUIPlugin
return window.getShell(); return window.getShell();
} }
return null; 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(), 1, t.getMessage(), null); //$NON-NLS-1$
ErrorDialog.openError(shell, "Error", message, status);
}
} }
/** /**
* @see org.eclipse.core.runtime.Plugin#shutdown() * @see org.eclipse.core.runtime.Plugin#shutdown()