Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java208
1 files changed, 0 insertions, 208 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
deleted file mode 100644
index 7a433f3bca3..00000000000
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.cdt.launch.internal.ui;
-
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-public class LaunchUIPlugin extends AbstractUIPlugin
- implements IDebugEventSetListener {
- public static final String PLUGIN_ID = "org.eclipse.cdt.launch";
-
- /**
- * Launch UI plug-in instance
- */
- private static LaunchUIPlugin fgPlugin;
- private static Shell debugDialogShell;
-
- /**
- * Constructor for LaunchUIPlugin.
- * @param descriptor
- */
- public LaunchUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- setDefault(this);
- }
-/**
- * Sets the Java Debug UI plug-in instance
- *
- * @param plugin the plugin instance
- */
- private static void setDefault(LaunchUIPlugin plugin) {
- fgPlugin = plugin;
- }
-
- /**
- * Returns the Java Debug UI plug-in instance
- *
- * @return the Java Debug UI plug-in instance
- */
- public static LaunchUIPlugin getDefault() {
- return fgPlugin;
- }
-
- public static Shell getShell() {
- if (getActiveWorkbenchShell() != null) {
- return getActiveWorkbenchShell();
- } else {
- if ( debugDialogShell != null ) {
- if (!debugDialogShell.isDisposed() )
- return debugDialogShell;
- debugDialogShell = null;
- }
- IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
- return windows[0].getShell();
- }
- }
-
- public static void setDialogShell(Shell shell) {
- debugDialogShell = shell;
- }
-
- /**
- * 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 "org.eclipse.cdt.launch"; //$NON-NLS-1$
- }
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status to log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
- /**
- * Logs an internal error with the specified message.
- *
- * @param message the error message to log
- */
- public static void logErrorMessage(String message) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
- }
-
- /**
- * Logs an internal error with the specified throwable
- *
- * @param e the exception to be logged
- */
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$
- }
-
- /**
- * Returns the active workbench window
- *
- * @return the active workbench window
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow w = getActiveWorkbenchWindow();
- if (w != null) {
- return w.getActivePage();
- }
- return null;
- }
-
- /**
- * 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(), 1, t.getMessage(), null); //$NON-NLS-1$
- ErrorDialog.openError(shell, "Error", message, status);
- }
- }
- /**
- * @see org.eclipse.core.runtime.Plugin#shutdown()
- */
- public void shutdown() throws CoreException {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- super.shutdown();
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugin#startup()
- */
- public void startup() throws CoreException {
- super.startup();
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /**
- * Notifies this listener of the given debug events.
- * All of the events in the given event collection occurred
- * at the same location the program be run or debugged.
- *
- * @param events the debug events
- */
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- if (events[i].getKind() == DebugEvent.TERMINATE) {
- Object o = events[i].getSource();
- if (o instanceof IProcess) {
- IProcess proc = (IProcess)o;
- ICProject cproject = null;
- try {
- cproject = AbstractCLaunchDelegate.getCProject(proc.getLaunch().getLaunchConfiguration());
- } catch (CoreException e) {
- }
- if (cproject != null) {
- try {
- cproject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException e) {
- }
- }
- }
- }
- }
- }
-
-}

Back to the top