blob: 2ca699cae6e1896f4d0a96308b00e1460d23c29c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*******************************************************************************
* Copyright (c) 2012, 2014 Mentor Graphics 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:
* Mentor Graphics - Initial API and implementation
* Red Hat Inc. - modified for use in Standalone Debugger
*******************************************************************************/
package org.eclipse.cdt.internal.debug.application;
import org.eclipse.cdt.debug.application.CoreFileDialog;
import org.eclipse.cdt.debug.application.CoreFileInfo;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class DebugCoreFileHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
CoreFileDialog dialog = new CoreFileDialog(new Shell());
if (dialog.open() == IDialogConstants.OK_ID) {
CoreFileInfo info = dialog.getCoreFileInfo();
try {
final ILaunchConfiguration config = DebugCoreFile.createLaunchConfig(new NullProgressMonitor(), null, info.getHostPath(), info.getCoreFilePath());
if (config != null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
return null;
}
}
|