1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Use a two pane select dialog when attaching

This commit is contained in:
Alain Magloire 2004-02-18 03:51:31 +00:00
parent 45d013d253
commit 75e82f6762
2 changed files with 24 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2004-02-17 Alain Magloire
Use a TwoPanel dialog when we attach more user friendly.
* src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java
2004-02-17 Thomas Fletcher 2004-02-17 Thomas Fletcher
Fix to address PR 52085. We allow the user to import a text file formatted Fix to address PR 52085. We allow the user to import a text file formatted

View file

@ -27,9 +27,11 @@ import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
@ -38,10 +40,12 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStatusHandler; import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
/** /**
* Insert the type's description here. * Insert the type's description here.
@ -151,12 +155,23 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
Display display = shell.getDisplay(); Display display = shell.getDisplay();
display.syncExec(new Runnable() { display.syncExec(new Runnable() {
public void run() { public void run() {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider() { 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();
}
};
ILabelProvider qprovider = new LabelProvider() {
public String getText(Object element) { public String getText(Object element) {
IProcessInfo info = (IProcessInfo) element; IProcessInfo info = (IProcessInfo) element;
return info.getPid() + " " + info.getName(); return info.getName();
} }
}); };
TwoPaneElementSelector dialog = new TwoPaneElementSelector(shell, provider, qprovider);
dialog.setTitle("Select Process"); dialog.setTitle("Select Process");
dialog.setMessage("Select a Process to attach debugger to:"); dialog.setMessage("Select a Process to attach debugger to:");
IProcessList plist = CCorePlugin.getDefault().getProcessList(); IProcessList plist = CCorePlugin.getDefault().getProcessList();