blob: 35ab0ff106f6cdf46abb09cbd991d9eeacb55e91 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*******************************************************************************
* Copyright (c) 2010, 2015 Mentor Graphics Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Anna Dushistova (Mentor Graphics) - initial API and implementation
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.tabs
* Red Hat Inc. - modified to use in CDT Docker Launcher
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CDebuggerTab;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
public class RemoteDebuggerTab extends CDebuggerTab {
private final static String DEFAULTS_SET = "org.eclipse.cdt.docker.launcher.RemoteDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
public RemoteDebuggerTab() {
super(SessionType.REMOTE, false);
}
/*
* When the launch configuration is created for Run mode, this Debugger tab
* is not created because it is not used for Run mode but only for Debug
* mode. When we then open the same configuration in Debug mode, the launch
* configuration already exists and initializeFrom() is called instead of
* setDefaults(). We therefore call setDefaults() ourselves and update the
* configuration. If we don't then the user will be required to press Apply
* to get the default settings saved. Bug 281970
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(DEFAULTS_SET, true);
super.setDefaults(config);
}
@Override
public void initializeFrom(ILaunchConfiguration config) {
try {
if (config.hasAttribute(DEFAULTS_SET) == false) {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
}
} catch (CoreException e) {
}
super.initializeFrom(config);
}
@Override
protected void loadDynamicDebugArea() {
Composite dynamicTabHolder = getDynamicTabHolder();
// Dispose of any current child widgets in the tab holder area
Control[] children = dynamicTabHolder.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].dispose();
}
setDynamicTab(new RemoteDebuggerPage());
ICDebuggerPage debuggerPage = getDynamicTab();
if (debuggerPage == null) {
return;
}
// Ask the dynamic UI to create its Control
debuggerPage.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
debuggerPage.createControl(dynamicTabHolder);
debuggerPage.getControl().setVisible(true);
dynamicTabHolder.layout(true);
contentsChanged();
}
@Override
public String getId() {
return "org.eclipse.cdt.docker.launch.debug.RemoteCDSFDebuggerTab"; //$NON-NLS-1$
}
}
|