KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > launchConfigurations > LaunchDelegateNotAvailableHandler


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.launchConfigurations;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.eclipse.debug.core.ILaunchConfiguration;
17 import org.eclipse.debug.core.IStatusHandler;
18 import org.eclipse.debug.internal.ui.DebugUIPlugin;
19 import org.eclipse.debug.ui.DebugUITools;
20 import org.eclipse.swt.widgets.Shell;
21
22 /**
23  * This class provides a mechanism to prompt users in the UI thread from debug.core in the case where
24  * a launch delegate has gone missing and a new choice needs to be made in the launch dialog.
25  *
26  * @since 3.3
27  */

28 public class LaunchDelegateNotAvailableHandler implements IStatusHandler {
29
30     /**
31      * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
32      */

33     public Object JavaDoc handleStatus(IStatus status, Object JavaDoc source) throws CoreException {
34         if(source instanceof Object JavaDoc[]) {
35             Object JavaDoc[] infos = (Object JavaDoc[]) source;
36             if(infos.length == 2) {
37                 final ILaunchConfiguration config = (ILaunchConfiguration) infos[0];
38                 final String JavaDoc mode = (String JavaDoc) infos[1];
39                 final Shell shell = DebugUIPlugin.getShell();
40                 Runnable JavaDoc runnable = new Runnable JavaDoc() {
41                     public void run() {
42                         DebugUITools.openLaunchConfigurationDialog(shell, config, DebugUITools.getLaunchGroup(config, mode).getIdentifier(), null);
43                     }
44                 };
45                 DebugUIPlugin.getStandardDisplay().asyncExec(runnable);
46             }
47         }
48         return Status.OK_STATUS;
49     }
50 }
51
Popular Tags