diff --git a/plugins/org.eclipse.dd.gdb.ui/icons/full/obj16/exec_obj.gif b/plugins/org.eclipse.dd.gdb.ui/icons/full/obj16/exec_obj.gif new file mode 100644 index 00000000000..7b3a92e0906 Binary files /dev/null and b/plugins/org.eclipse.dd.gdb.ui/icons/full/obj16/exec_obj.gif differ diff --git a/plugins/org.eclipse.dd.gdb.ui/plugin.xml b/plugins/org.eclipse.dd.gdb.ui/plugin.xml index af2e6b79226..533e465cec1 100644 --- a/plugins/org.eclipse.dd.gdb.ui/plugin.xml +++ b/plugins/org.eclipse.dd.gdb.ui/plugin.xml @@ -36,5 +36,14 @@ + + + + diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchImages.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchImages.java index bd7fe3a3154..2eca2e3f837 100644 --- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchImages.java +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchImages.java @@ -34,6 +34,7 @@ public class LaunchImages { } private static final String T_TABS = "full/view16/"; //$NON-NLS-1$ + private static final String T_OBJS = "full/obj16/"; //$NON-NLS-1$ public static String IMG_VIEW_MAIN_TAB = NAME_PREFIX + "main_tab.gif"; //$NON-NLS-1$ public static String IMG_VIEW_DEBUGGER_TAB = NAME_PREFIX + "debugger_tab.gif"; //$NON-NLS-1$ @@ -41,6 +42,9 @@ public class LaunchImages { public static final ImageDescriptor DESC_TAB_MAIN= createManaged(T_TABS, IMG_VIEW_MAIN_TAB); public static final ImageDescriptor DESC_TAB_DEBUGGER = createManaged(T_TABS, IMG_VIEW_DEBUGGER_TAB); + public static String IMG_OBJS_EXEC= NAME_PREFIX + "exec_obj.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_OBJS_EXEC = createManaged(T_OBJS, IMG_OBJS_EXEC); + public static void initialize() { } diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/ProcessPrompter.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/ProcessPrompter.java new file mode 100644 index 00000000000..14c0eca231c --- /dev/null +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/ProcessPrompter.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2008 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX Software Systems - initial API and implementation + * Ericsson - Modified for DSF + *******************************************************************************/ +package org.eclipse.dd.gdb.internal.ui.launching; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.IProcessInfo; +import org.eclipse.cdt.core.IProcessList; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages; +import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin; +import org.eclipse.debug.core.IStatusHandler; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.TwoPaneElementSelector; + +public class ProcessPrompter implements IStatusHandler { + + /* + * (non-Javadoc) + * + * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, + * java.lang.Object) + */ + public Object handleStatus(IStatus status, Object source) throws CoreException { + Shell shell = GdbUIPlugin.getShell(); + if (shell == null) { + IStatus error = new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(), + ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR, + LaunchMessages.getString("CoreFileLaunchDelegate.No_Shell_available_in_Launch"), null); //$NON-NLS-1$ + throw new CoreException(error); + } + + ILabelProvider provider = new LabelProvider() { + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + IProcessInfo info = (IProcessInfo)element; + IPath path = new Path(info.getName()); + return path.lastSegment() + " - " + info.getPid(); //$NON-NLS-1$ + } + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC); + } + }; + ILabelProvider qprovider = new LabelProvider() { + + public String getText(Object element) { + IProcessInfo info = (IProcessInfo)element; + return info.getName(); + } + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC); + } + }; + TwoPaneElementSelector dialog = new TwoPaneElementSelector(shell, provider, qprovider); + dialog.setTitle(LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process")); //$NON-NLS-1$ + dialog.setMessage(LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$ + IProcessList plist = null; + try { + plist = CCorePlugin.getDefault().getProcessList(); + } catch (CoreException e) { + GdbUIPlugin.errorDialog(LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), e.getStatus()); //$NON-NLS-1$ + } + if (plist == null) { + MessageDialog.openError( + shell, + LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), LaunchMessages.getString("LocalAttachLaunchDelegate.Platform_cannot_list_processes")); //$NON-NLS-1$ //$NON-NLS-2$ + return null; + } + dialog.setElements(plist.getProcessList()); + if (dialog.open() == Window.OK) { + IProcessInfo info = (IProcessInfo)dialog.getFirstResult(); + if (info != null) { + return new Integer(info.getPid()); + } + } + return null; + } + +} diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java index e0d22abd5b2..19e62f5d6ef 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java @@ -186,7 +186,7 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate protected int promptForProcessID(ILaunchConfiguration config) throws CoreException { IStatus fPromptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$ - IStatus processPrompt = new Status(IStatus.INFO, "org.eclipse.cdt.launch", 100, "", null); //$NON-NLS-1$//$NON-NLS-2$ + IStatus processPrompt = new Status(IStatus.INFO, "org.eclipse.dd.gdb.ui", 100, "", null); //$NON-NLS-1$//$NON-NLS-2$ // consult a status handler IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(fPromptStatus); if (prompter != null) {