mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 16:35:25 +02:00
Bug 281970: No longer use CDIs "debugger" extension point, as it was useless for DSF-GDB and only causing confusion.
This commit is contained in:
parent
8b16325786
commit
4e0258df9a
5 changed files with 340 additions and 533 deletions
|
@ -210,19 +210,6 @@
|
||||||
plugin="org.eclipse.cdt.dsf.gdb.ui">
|
plugin="org.eclipse.cdt.dsf.gdb.ui">
|
||||||
</statusHandler>
|
</statusHandler>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.cdt.debug.ui.CDebuggerPage">
|
|
||||||
<debuggerPage
|
|
||||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbDebuggerPage"
|
|
||||||
debuggerID="org.eclipse.cdt.dsf.gdb.GdbDebugger"
|
|
||||||
id="org.eclipse.cdt.dsf.gdb.ui.GdbDebuggerPage">
|
|
||||||
</debuggerPage>
|
|
||||||
<debuggerPage
|
|
||||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbServerDebuggerPage"
|
|
||||||
debuggerID="org.eclipse.cdt.dsf.gdb.GdbServerDebugger"
|
|
||||||
id="org.eclipse.cdt.dsf.gdb.ui.GdbServerDebuggerPage">
|
|
||||||
</debuggerPage>
|
|
||||||
</extension>
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.popupMenus">
|
point="org.eclipse.ui.popupMenus">
|
||||||
<viewerContribution
|
<viewerContribution
|
||||||
|
|
|
@ -1,368 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2008, 2010 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
|
|
||||||
* IBM Corporation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension;
|
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Group;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
|
|
||||||
public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
|
|
||||||
|
|
||||||
protected ILaunchConfiguration fLaunchConfiguration;
|
|
||||||
protected ILaunchConfigurationWorkingCopy fWorkingCopy;
|
|
||||||
protected ICDebugConfiguration fCurrentDebugConfig;
|
|
||||||
|
|
||||||
// Dynamic Debugger UI widgets
|
|
||||||
protected ICDebuggerPage fDynamicTab;
|
|
||||||
protected Composite fDynamicTabHolder;
|
|
||||||
private boolean fInitDefaults;
|
|
||||||
private Combo fDCombo;
|
|
||||||
private boolean fIsInitializing = false;
|
|
||||||
private boolean fPageUpdated;
|
|
||||||
|
|
||||||
private IContentChangeListener fContentListener = new IContentChangeListener() {
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener#contentChanged()
|
|
||||||
*/
|
|
||||||
public void contentChanged() {
|
|
||||||
contentsChanged();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
protected void setDebugConfig(ICDebugConfiguration config) {
|
|
||||||
fCurrentDebugConfig = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ICDebugConfiguration getDebugConfig() {
|
|
||||||
return fCurrentDebugConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ICDebuggerPage getDynamicTab() {
|
|
||||||
return fDynamicTab;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setDynamicTab(ICDebuggerPage tab) {
|
|
||||||
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
|
||||||
((ICDebuggerPageExtension)fDynamicTab).removeContentChangeListener( fContentListener );
|
|
||||||
fDynamicTab = tab;
|
|
||||||
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
|
||||||
((ICDebuggerPageExtension)fDynamicTab).addContentChangeListener( fContentListener );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Composite getDynamicTabHolder() {
|
|
||||||
return fDynamicTabHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setDynamicTabHolder(Composite tabHolder) {
|
|
||||||
fDynamicTabHolder = tabHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ILaunchConfigurationWorkingCopy getLaunchConfigurationWorkingCopy() {
|
|
||||||
return fWorkingCopy;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
|
|
||||||
fLaunchConfiguration = launchConfiguration;
|
|
||||||
setLaunchConfigurationWorkingCopy(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ILaunchConfiguration getLaunchConfiguration() {
|
|
||||||
return fLaunchConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setLaunchConfigurationWorkingCopy(ILaunchConfigurationWorkingCopy workingCopy) {
|
|
||||||
fWorkingCopy = workingCopy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overridden here so that any error message in the dynamic UI gets
|
|
||||||
* returned.
|
|
||||||
*
|
|
||||||
* @see ILaunchConfigurationTab#getErrorMessage()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getErrorMessage() {
|
|
||||||
ICDebuggerPage tab = getDynamicTab();
|
|
||||||
if ( (super.getErrorMessage() != null) || (tab == null)) {
|
|
||||||
return super.getErrorMessage();
|
|
||||||
}
|
|
||||||
return tab.getErrorMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notification that the user changed the selection of the Debugger.
|
|
||||||
*/
|
|
||||||
protected void handleDebuggerChanged() {
|
|
||||||
loadDynamicDebugArea();
|
|
||||||
|
|
||||||
// always set the newly created area with defaults
|
|
||||||
ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy();
|
|
||||||
if (getDynamicTab() == null) {
|
|
||||||
// remove any debug specfic args from the config
|
|
||||||
if (wc == null) {
|
|
||||||
if (getLaunchConfiguration().isWorkingCopy()) {
|
|
||||||
wc = (ILaunchConfigurationWorkingCopy)getLaunchConfiguration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (wc != null) {
|
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (wc == null) {
|
|
||||||
try {
|
|
||||||
if (getLaunchConfiguration().isWorkingCopy()) {
|
|
||||||
setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy)getLaunchConfiguration());
|
|
||||||
} else {
|
|
||||||
setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy());
|
|
||||||
}
|
|
||||||
wc = getLaunchConfigurationWorkingCopy();
|
|
||||||
|
|
||||||
} catch (CoreException e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (initDefaults()) {
|
|
||||||
getDynamicTab().setDefaults(wc);
|
|
||||||
}
|
|
||||||
setInitializeDefault(false);
|
|
||||||
getDynamicTab().initializeFrom(wc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the contributed piece of UI that was registered for the debugger id
|
|
||||||
* of the currently selected debugger.
|
|
||||||
*/
|
|
||||||
protected void loadDynamicDebugArea() {
|
|
||||||
// Dispose of any current child widgets in the tab holder area
|
|
||||||
Control[] children = getDynamicTabHolder().getChildren();
|
|
||||||
for (int i = 0; i < children.length; i++) {
|
|
||||||
children[i].dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve the dynamic UI for the current Debugger
|
|
||||||
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
|
|
||||||
if (debugConfig == null) {
|
|
||||||
setDynamicTab(null);
|
|
||||||
} else {
|
|
||||||
ICDebuggerPage tab = null;
|
|
||||||
try {
|
|
||||||
tab = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
|
|
||||||
} catch (CoreException e) {
|
|
||||||
GdbUIPlugin.errorDialog(LaunchMessages.getString("AbstractCDebuggerTab.ErrorLoadingDebuggerPage"), e.getStatus()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
setDynamicTab(tab);
|
|
||||||
}
|
|
||||||
setDebugConfig(debugConfig);
|
|
||||||
if (getDynamicTab() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Ask the dynamic UI to create its Control
|
|
||||||
getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog());
|
|
||||||
getDynamicTab().createControl(getDynamicTabHolder());
|
|
||||||
getDynamicTab().getControl().setVisible(true);
|
|
||||||
getDynamicTabHolder().layout(true);
|
|
||||||
contentsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called whenever the controls within the Debugger tab has changed.
|
|
||||||
*/
|
|
||||||
protected void contentsChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract public void createControl(Composite parent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
|
|
||||||
ICDebuggerPage dynamicTab = getDynamicTab();
|
|
||||||
if (dynamicTab != null) {
|
|
||||||
dynamicTab.activated(workingCopy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
|
||||||
setLaunchConfiguration(config);
|
|
||||||
ICDebuggerPage dynamicTab = getDynamicTab();
|
|
||||||
if (dynamicTab != null) {
|
|
||||||
dynamicTab.initializeFrom(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
|
||||||
if (getDebugConfig() != null) {
|
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID());
|
|
||||||
ICDebuggerPage dynamicTab = getDynamicTab();
|
|
||||||
if (dynamicTab == null) {
|
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null);
|
|
||||||
} else {
|
|
||||||
dynamicTab.performApply(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
|
||||||
setLaunchConfigurationWorkingCopy(config);
|
|
||||||
ICDebuggerPage dynamicTab = getDynamicTab();
|
|
||||||
if (dynamicTab != null) {
|
|
||||||
dynamicTab.setDefaults(config);
|
|
||||||
setInitializeDefault(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(ILaunchConfiguration config) {
|
|
||||||
setErrorMessage(null);
|
|
||||||
setMessage(null);
|
|
||||||
if (getDebugConfig() == null) {
|
|
||||||
setErrorMessage(LaunchMessages.getString("AbstractCDebuggerTab.No_debugger_available")); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICDebuggerPage dynamicTab = getDynamicTab();
|
|
||||||
if (dynamicTab != null) {
|
|
||||||
return dynamicTab.isValid(config);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setInitializeDefault(boolean init) {
|
|
||||||
fInitDefaults = init;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean initDefaults() {
|
|
||||||
return fInitDefaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getImage() {
|
|
||||||
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return LaunchMessages.getString("AbstractCDebuggerTab.Debugger"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void createDebuggerCombo(Composite parent, int colspan) {
|
|
||||||
Composite comboComp = new Composite(parent, SWT.NONE);
|
|
||||||
GridLayout layout = new GridLayout(2, false);
|
|
||||||
comboComp.setLayout(layout);
|
|
||||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalSpan = colspan;
|
|
||||||
comboComp.setLayoutData(gd);
|
|
||||||
Label dlabel = new Label(comboComp, SWT.NONE);
|
|
||||||
dlabel.setText(LaunchMessages.getString("Launch.common.DebuggerColon")); //$NON-NLS-1$
|
|
||||||
fDCombo = new Combo(comboComp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
|
||||||
fDCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
||||||
fDCombo.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
if (!isInitializing()) {
|
|
||||||
setInitializeDefault(true);
|
|
||||||
updateComboFromSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void loadDebuggerCombo(ICDebugConfiguration[] debugConfigs, String current) {
|
|
||||||
fDCombo.removeAll();
|
|
||||||
int select = -1;
|
|
||||||
for (int i = 0; i < debugConfigs.length; i++) {
|
|
||||||
fDCombo.add(debugConfigs[i].getName());
|
|
||||||
fDCombo.setData(Integer.toString(i), debugConfigs[i]);
|
|
||||||
if (debugConfigs[i].getID().equalsIgnoreCase(current)) {
|
|
||||||
select = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fPageUpdated = false;
|
|
||||||
if (select != -1) {
|
|
||||||
fDCombo.select(select);
|
|
||||||
} else {
|
|
||||||
fDCombo.select(0);
|
|
||||||
}
|
|
||||||
//The behaviour is undefined for if the callbacks should be triggered
|
|
||||||
// for this,
|
|
||||||
//so force page update if needed.
|
|
||||||
if (!fPageUpdated) {
|
|
||||||
updateComboFromSelection();
|
|
||||||
}
|
|
||||||
fPageUpdated = false;
|
|
||||||
getControl().getParent().layout(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void createDebuggerGroup(Composite parent, int colspan) {
|
|
||||||
Group debuggerGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
|
|
||||||
debuggerGroup.setText(LaunchMessages.getString("CDebuggerTab.Debugger_Options")); //$NON-NLS-1$
|
|
||||||
setDynamicTabHolder(debuggerGroup);
|
|
||||||
GridLayout tabHolderLayout = new GridLayout();
|
|
||||||
tabHolderLayout.marginHeight = 0;
|
|
||||||
tabHolderLayout.marginWidth = 0;
|
|
||||||
tabHolderLayout.numColumns = 1;
|
|
||||||
getDynamicTabHolder().setLayout(tabHolderLayout);
|
|
||||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
|
||||||
gd.horizontalSpan = colspan;
|
|
||||||
getDynamicTabHolder().setLayoutData(gd);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateComboFromSelection() {
|
|
||||||
fPageUpdated = true;
|
|
||||||
handleDebuggerChanged();
|
|
||||||
updateLaunchConfigurationDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isInitializing() {
|
|
||||||
return fIsInitializing;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setInitializing(boolean isInitializing) {
|
|
||||||
fIsInitializing = isInitializing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the class that implements <code>ICDebuggerPage</code>
|
|
||||||
* that is registered against the debugger id of the currently selected
|
|
||||||
* debugger.
|
|
||||||
*/
|
|
||||||
protected ICDebugConfiguration getConfigForCurrentDebugger() {
|
|
||||||
int selectedIndex = fDCombo.getSelectionIndex();
|
|
||||||
return (ICDebugConfiguration)fDCombo.getData(Integer.toString(selectedIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 QNX Software Systems and others.
|
* Copyright (c) 2008, 2010 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,28 +13,25 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Arrays;
|
import java.util.Map;
|
||||||
import java.util.Comparator;
|
import java.util.Set;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener;
|
||||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||||
|
@ -43,17 +40,21 @@ import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.ibm.icu.text.Collator;
|
public class CDebuggerTab extends CLaunchConfigurationTab {
|
||||||
|
|
||||||
public class CDebuggerTab extends AbstractCDebuggerTab {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tab identifier used for ordering of tabs added using the
|
* Tab identifier used for ordering of tabs added using the
|
||||||
|
@ -64,12 +65,23 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
*/
|
*/
|
||||||
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
|
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final static String LOCAL_DEBUGGER_ID = "org.eclipse.cdt.dsf.gdb.GdbDebugger";//$NON-NLS-1$
|
private final static String LOCAL_DEBUGGER_ID = "gdb";//$NON-NLS-1$
|
||||||
private final static String REMOTE_DEBUGGER_ID = "org.eclipse.cdt.dsf.gdb.GdbServerDebugger";//$NON-NLS-1$
|
private final static String REMOTE_DEBUGGER_ID = "gdbserver";//$NON-NLS-1$
|
||||||
|
|
||||||
protected boolean fAttachMode = false;
|
protected ILaunchConfiguration fLaunchConfiguration;
|
||||||
protected boolean fRemoteMode = false;
|
protected ILaunchConfigurationWorkingCopy fWorkingCopy;
|
||||||
protected boolean fCoreMode = false;
|
protected String fDebuggerId;
|
||||||
|
|
||||||
|
// Dynamic Debugger UI widgets
|
||||||
|
protected ICDebuggerPage fDynamicTab;
|
||||||
|
protected Composite fDynamicTabHolder;
|
||||||
|
private boolean fInitDefaults;
|
||||||
|
private Combo fDCombo;
|
||||||
|
private boolean fIsInitializing;
|
||||||
|
|
||||||
|
protected boolean fAttachMode;
|
||||||
|
protected boolean fRemoteMode;
|
||||||
|
protected boolean fCoreMode;
|
||||||
|
|
||||||
protected Button fStopInMain;
|
protected Button fStopInMain;
|
||||||
protected Text fStopInMainSymbol;
|
protected Text fStopInMainSymbol;
|
||||||
|
@ -78,6 +90,12 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
|
|
||||||
private Composite fContents;
|
private Composite fContents;
|
||||||
|
|
||||||
|
private IContentChangeListener fContentListener = new IContentChangeListener() {
|
||||||
|
public void contentChanged() {
|
||||||
|
contentsChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public CDebuggerTab(SessionType sessionType, boolean attach) {
|
public CDebuggerTab(SessionType sessionType, boolean attach) {
|
||||||
if (sessionType == SessionType.REMOTE) {
|
if (sessionType == SessionType.REMOTE) {
|
||||||
fRemoteMode = true;
|
fRemoteMode = true;
|
||||||
|
@ -98,7 +116,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
return TAB_ID;
|
return TAB_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
fContainer = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
|
fContainer = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
fContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
|
fContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
@ -116,69 +133,66 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
GridData gd = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
GridData gd = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
||||||
fContents.setLayoutData(gd);
|
fContents.setLayoutData(gd);
|
||||||
|
|
||||||
createDebuggerCombo(fContents, (fAttachMode) ? 1 : 2);
|
if (fAttachMode) {
|
||||||
|
createDebuggerCombo(fContents);
|
||||||
|
}
|
||||||
|
|
||||||
createOptionsComposite(fContents);
|
createOptionsComposite(fContents);
|
||||||
createDebuggerGroup(fContents, 2);
|
createDebuggerGroup(fContents, 2);
|
||||||
|
|
||||||
fContainer.setContent(fContents);
|
fContainer.setContent(fContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
|
protected void initDebuggerTypes(String selection) {
|
||||||
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
|
if (fAttachMode) {
|
||||||
Arrays.sort(debugConfigs, new Comparator<ICDebugConfiguration>() {
|
// Use a LinkedHashSet to keep ordering
|
||||||
public int compare(ICDebugConfiguration c1, ICDebugConfiguration c2) {
|
Set<String> set = new LinkedHashSet<String>();
|
||||||
return Collator.getInstance().compare(c1.getName(), c2.getName());
|
set.add(LOCAL_DEBUGGER_ID);
|
||||||
|
set.add(REMOTE_DEBUGGER_ID);
|
||||||
|
if (selection.equals("")) { //$NON-NLS-1$
|
||||||
|
selection = LOCAL_DEBUGGER_ID;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
List<ICDebugConfiguration> list = new ArrayList<ICDebugConfiguration>();
|
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
|
||||||
if (selection.equals("")) { //$NON-NLS-1$
|
loadDebuggerCombo(set.toArray(new String[set.size()]), selection);
|
||||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
} else {
|
||||||
if (dc == null) {
|
if (fRemoteMode) {
|
||||||
CDebugCorePlugin.getDefault().saveDefaultDebugConfiguration(LOCAL_DEBUGGER_ID);
|
setDebuggerId(REMOTE_DEBUGGER_ID);
|
||||||
dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
} else {
|
||||||
|
setDebuggerId(LOCAL_DEBUGGER_ID);
|
||||||
}
|
}
|
||||||
if (dc != null)
|
updateComboFromSelection();
|
||||||
selection = dc.getID();
|
|
||||||
}
|
}
|
||||||
String defaultSelection = selection;
|
|
||||||
for (ICDebugConfiguration debugConfig: debugConfigs) {
|
|
||||||
// Note that for an attach session, we don't know yet if the user will want to do a
|
|
||||||
// remote session. So, we must allow for the remote debugger even if fRemote is false,
|
|
||||||
// in the case of attach
|
|
||||||
if (((fRemoteMode || fAttachMode) && debugConfig.getID().equals(REMOTE_DEBUGGER_ID)) ||
|
|
||||||
(!fRemoteMode && debugConfig.getID().equals(LOCAL_DEBUGGER_ID))) {
|
|
||||||
list.add(debugConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if no selection meaning nothing in config the force initdefault on tab
|
|
||||||
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
|
|
||||||
loadDebuggerCombo(list.toArray(new ICDebugConfiguration[list.size()]), defaultSelection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateComboFromSelection() {
|
|
||||||
super.updateComboFromSelection();
|
|
||||||
initializeCommonControls(getLaunchConfiguration());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
||||||
super.setDefaults(config);
|
setLaunchConfigurationWorkingCopy(config);
|
||||||
|
ICDebuggerPage dynamicTab = getDynamicTab();
|
||||||
|
if (dynamicTab != null) {
|
||||||
|
dynamicTab.setDefaults(config);
|
||||||
|
setInitializeDefault(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (fAttachMode && fRemoteMode) {
|
if (fAttachMode && fRemoteMode) {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH);
|
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, REMOTE_DEBUGGER_ID);
|
||||||
} else if (fAttachMode) {
|
} else if (fAttachMode) {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
|
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
|
||||||
} else if (fRemoteMode) {
|
} else if (fRemoteMode) {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, REMOTE_DEBUGGER_ID);
|
||||||
} else if (fCoreMode){
|
} else if (fCoreMode){
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
|
||||||
} else {
|
} else {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fAttachMode && !fCoreMode) {
|
if (!fAttachMode && !fCoreMode) {
|
||||||
|
@ -186,58 +200,36 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
|
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default debugger based on the active toolchain on the project (if possible)
|
|
||||||
String defaultDebugger = null;
|
|
||||||
try {
|
|
||||||
String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");//$NON-NLS-1$
|
|
||||||
if (projectName.length() > 0) {
|
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
|
|
||||||
ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
|
|
||||||
String configId = configDesc.getId();
|
|
||||||
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
|
|
||||||
outer: for (int i = 0; i < debugConfigs.length; ++i) {
|
|
||||||
ICDebugConfiguration debugConfig = debugConfigs[i];
|
|
||||||
String[] patterns = debugConfig.getSupportedBuildConfigPatterns();
|
|
||||||
if (patterns != null) {
|
|
||||||
for (int j = 0; j < patterns.length; ++j) {
|
|
||||||
if (configId.matches(patterns[j])) {
|
|
||||||
defaultDebugger = debugConfig.getID();
|
|
||||||
break outer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultDebugger == null) {
|
|
||||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
|
||||||
if (dc != null) {
|
|
||||||
defaultDebugger = dc.getID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, defaultDebugger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
public void initializeFrom(ILaunchConfiguration config) {
|
||||||
setInitializing(true);
|
setInitializing(true);
|
||||||
super.initializeFrom(config);
|
|
||||||
|
setLaunchConfiguration(config);
|
||||||
|
ICDebuggerPage dynamicTab = getDynamicTab();
|
||||||
|
if (dynamicTab != null) {
|
||||||
|
dynamicTab.initializeFrom(config);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
|
String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
|
||||||
loadDebuggerComboBox(config, id);
|
initDebuggerTypes(id);
|
||||||
initializeCommonControls(config);
|
initializeCommonControls(config);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
setInitializing(false);
|
setInitializing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
||||||
super.performApply(config);
|
if (getDebuggerId() != null) {
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebuggerId());
|
||||||
|
ICDebuggerPage dynamicTab = getDynamicTab();
|
||||||
|
if (dynamicTab == null) {
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null);
|
||||||
|
} else {
|
||||||
|
dynamicTab.performApply(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fAttachMode && fRemoteMode) {
|
if (fAttachMode && fRemoteMode) {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||||
|
@ -276,15 +268,24 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (super.isValid(config) == false) {
|
|
||||||
|
setErrorMessage(null);
|
||||||
|
setMessage(null);
|
||||||
|
if (getDebuggerId() == null) {
|
||||||
|
setErrorMessage(LaunchMessages.getString("AbstractCDebuggerTab.No_debugger_available")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICDebuggerPage dynamicTab = getDynamicTab();
|
||||||
|
if (dynamicTab != null) {
|
||||||
|
return dynamicTab.isValid(config);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean validateDebuggerConfig(ILaunchConfiguration config) {
|
protected boolean validateDebuggerConfig(ILaunchConfiguration config) {
|
||||||
ICDebugConfiguration debugConfig = getDebugConfig();
|
String debuggerType = getDebuggerId();
|
||||||
if (debugConfig == null) {
|
if (debuggerType == null) {
|
||||||
setErrorMessage(LaunchMessages.getString("CDebuggerTab.No_debugger_available")); //$NON-NLS-1$
|
setErrorMessage(LaunchMessages.getString("CDebuggerTab.No_debugger_available")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -368,20 +369,257 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
} else if (fAttachMode) {
|
} else if (fAttachMode) {
|
||||||
// In attach mode, figure out if we are doing a remote connect based on the currently
|
// In attach mode, figure out if we are doing a remote connect based on the currently
|
||||||
// chosen debugger
|
// chosen debugger
|
||||||
if (getDebugConfig().getID().equals(REMOTE_DEBUGGER_ID)) fRemoteMode = true;
|
if (getDebuggerId().equals(REMOTE_DEBUGGER_ID)) fRemoteMode = true;
|
||||||
else fRemoteMode = false;
|
else fRemoteMode = false;
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setInitializeDefault(boolean init) {
|
protected void setInitializeDefault(boolean init) {
|
||||||
super.setInitializeDefault(init);
|
fInitDefaults = init;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void contentsChanged() {
|
protected void contentsChanged() {
|
||||||
fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void loadDynamicDebugArea() {
|
||||||
|
// Dispose of any current child widgets in the tab holder area
|
||||||
|
Control[] children = getDynamicTabHolder().getChildren();
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
children[i].dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
String debuggerId = getIdForCurrentDebugger();
|
||||||
|
if (debuggerId == null) {
|
||||||
|
setDynamicTab(null);
|
||||||
|
} else {
|
||||||
|
if (debuggerId.equals(LOCAL_DEBUGGER_ID)) {
|
||||||
|
if (fCoreMode) {
|
||||||
|
setDynamicTab(new GdbCoreDebuggerPage());
|
||||||
|
} else {
|
||||||
|
setDynamicTab(new GdbDebuggerPage());
|
||||||
|
}
|
||||||
|
} else if (debuggerId.equals(REMOTE_DEBUGGER_ID)) {
|
||||||
|
setDynamicTab(new GdbServerDebuggerPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setDebuggerId(debuggerId);
|
||||||
|
|
||||||
|
if (getDynamicTab() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ask the dynamic UI to create its Control
|
||||||
|
getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog());
|
||||||
|
getDynamicTab().createControl(getDynamicTabHolder());
|
||||||
|
getDynamicTab().getControl().setVisible(true);
|
||||||
|
getDynamicTabHolder().layout(true);
|
||||||
|
contentsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDebuggerId(String id) {
|
||||||
|
fDebuggerId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDebuggerId() {
|
||||||
|
return fDebuggerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ICDebuggerPage getDynamicTab() {
|
||||||
|
return fDynamicTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDynamicTab(ICDebuggerPage tab) {
|
||||||
|
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
||||||
|
((ICDebuggerPageExtension)fDynamicTab).removeContentChangeListener( fContentListener );
|
||||||
|
fDynamicTab = tab;
|
||||||
|
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
||||||
|
((ICDebuggerPageExtension)fDynamicTab).addContentChangeListener( fContentListener );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Composite getDynamicTabHolder() {
|
||||||
|
return fDynamicTabHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDynamicTabHolder(Composite tabHolder) {
|
||||||
|
fDynamicTabHolder = tabHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ILaunchConfigurationWorkingCopy getLaunchConfigurationWorkingCopy() {
|
||||||
|
return fWorkingCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
|
||||||
|
fLaunchConfiguration = launchConfiguration;
|
||||||
|
setLaunchConfigurationWorkingCopy(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ILaunchConfiguration getLaunchConfiguration() {
|
||||||
|
return fLaunchConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setLaunchConfigurationWorkingCopy(ILaunchConfigurationWorkingCopy workingCopy) {
|
||||||
|
fWorkingCopy = workingCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden here so that any error message in the dynamic UI gets
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* @see ILaunchConfigurationTab#getErrorMessage()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getErrorMessage() {
|
||||||
|
ICDebuggerPage tab = getDynamicTab();
|
||||||
|
if ( (super.getErrorMessage() != null) || (tab == null)) {
|
||||||
|
return super.getErrorMessage();
|
||||||
|
}
|
||||||
|
return tab.getErrorMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification that the user changed the selection of the Debugger.
|
||||||
|
*/
|
||||||
|
protected void handleDebuggerChanged() {
|
||||||
|
loadDynamicDebugArea();
|
||||||
|
|
||||||
|
// always set the newly created area with defaults
|
||||||
|
ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy();
|
||||||
|
if (getDynamicTab() == null) {
|
||||||
|
// remove any debug specfic args from the config
|
||||||
|
if (wc == null) {
|
||||||
|
if (getLaunchConfiguration().isWorkingCopy()) {
|
||||||
|
wc = (ILaunchConfigurationWorkingCopy)getLaunchConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wc != null) {
|
||||||
|
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (wc == null) {
|
||||||
|
try {
|
||||||
|
if (getLaunchConfiguration().isWorkingCopy()) {
|
||||||
|
setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy)getLaunchConfiguration());
|
||||||
|
} else {
|
||||||
|
setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy());
|
||||||
|
}
|
||||||
|
wc = getLaunchConfigurationWorkingCopy();
|
||||||
|
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (initDefaults()) {
|
||||||
|
getDynamicTab().setDefaults(wc);
|
||||||
|
}
|
||||||
|
setInitializeDefault(false);
|
||||||
|
getDynamicTab().initializeFrom(wc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
|
||||||
|
ICDebuggerPage dynamicTab = getDynamicTab();
|
||||||
|
if (dynamicTab != null) {
|
||||||
|
dynamicTab.activated(workingCopy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean initDefaults() {
|
||||||
|
return fInitDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Image getImage() {
|
||||||
|
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return LaunchMessages.getString("AbstractCDebuggerTab.Debugger"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createDebuggerCombo(Composite parent) {
|
||||||
|
Composite comboComp = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayout layout = new GridLayout(2, false);
|
||||||
|
comboComp.setLayout(layout);
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
comboComp.setLayoutData(gd);
|
||||||
|
Label dlabel = new Label(comboComp, SWT.NONE);
|
||||||
|
dlabel.setText(LaunchMessages.getString("Launch.common.DebuggerColon")); //$NON-NLS-1$
|
||||||
|
fDCombo = new Combo(comboComp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
|
fDCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
fDCombo.addSelectionListener(new SelectionListener() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if (!isInitializing()) {
|
||||||
|
setInitializeDefault(true);
|
||||||
|
updateComboFromSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadDebuggerCombo(String[] names, String current) {
|
||||||
|
if (fDCombo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fDCombo.removeAll();
|
||||||
|
int select = -1;
|
||||||
|
for (int i = 0; i < names.length; i++) {
|
||||||
|
fDCombo.add(names[i]);
|
||||||
|
if (names[i].equalsIgnoreCase(current)) {
|
||||||
|
select = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (select != -1) {
|
||||||
|
fDCombo.select(select);
|
||||||
|
} else {
|
||||||
|
fDCombo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateComboFromSelection();
|
||||||
|
getControl().getParent().layout(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createDebuggerGroup(Composite parent, int colspan) {
|
||||||
|
Group debuggerGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
|
||||||
|
debuggerGroup.setText(LaunchMessages.getString("CDebuggerTab.Debugger_Options")); //$NON-NLS-1$
|
||||||
|
setDynamicTabHolder(debuggerGroup);
|
||||||
|
GridLayout tabHolderLayout = new GridLayout();
|
||||||
|
tabHolderLayout.marginHeight = 0;
|
||||||
|
tabHolderLayout.marginWidth = 0;
|
||||||
|
tabHolderLayout.numColumns = 1;
|
||||||
|
getDynamicTabHolder().setLayout(tabHolderLayout);
|
||||||
|
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||||
|
gd.horizontalSpan = colspan;
|
||||||
|
getDynamicTabHolder().setLayoutData(gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateComboFromSelection() {
|
||||||
|
handleDebuggerChanged();
|
||||||
|
updateLaunchConfigurationDialog();
|
||||||
|
initializeCommonControls(getLaunchConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isInitializing() {
|
||||||
|
return fIsInitializing;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInitializing(boolean isInitializing) {
|
||||||
|
fIsInitializing = isInitializing;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getIdForCurrentDebugger() {
|
||||||
|
if (fDCombo == null) {
|
||||||
|
return getDebuggerId();
|
||||||
|
} else {
|
||||||
|
int selectedIndex = fDCombo.getSelectionIndex();
|
||||||
|
return fDCombo.getItem(selectedIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
@ -22,32 +19,4 @@ public class CoreFileDebuggerTab extends CDebuggerTab {
|
||||||
public CoreFileDebuggerTab() {
|
public CoreFileDebuggerTab() {
|
||||||
super(SessionType.CORE, false);
|
super(SessionType.CORE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadDynamicDebugArea() {
|
|
||||||
// Dispose of any current child widgets in the tab holder area
|
|
||||||
Control[] children = getDynamicTabHolder().getChildren();
|
|
||||||
for (int i = 0; i < children.length; i++) {
|
|
||||||
children[i].dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
|
|
||||||
if (debugConfig == null) {
|
|
||||||
setDynamicTab(null);
|
|
||||||
} else {
|
|
||||||
ICDebuggerPage tab = new GdbCoreDebuggerPage();
|
|
||||||
setDynamicTab(tab);
|
|
||||||
}
|
|
||||||
setDebugConfig(debugConfig);
|
|
||||||
|
|
||||||
if (getDynamicTab() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Ask the dynamic UI to create its Control
|
|
||||||
getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog());
|
|
||||||
getDynamicTab().createControl(getDynamicTabHolder());
|
|
||||||
getDynamicTab().getControl().setVisible(true);
|
|
||||||
getDynamicTabHolder().layout(true);
|
|
||||||
contentsChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,24 +61,5 @@
|
||||||
contextId="org.eclipse.cdt.debug.ui.debugging"
|
contextId="org.eclipse.cdt.debug.ui.debugging"
|
||||||
debugModelId="org.eclipse.cdt.dsf.gdb"/>
|
debugModelId="org.eclipse.cdt.dsf.gdb"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.cdt.debug.core.CDebugger">
|
|
||||||
<debugger
|
|
||||||
class="org.eclipse.cdt.dsf.gdb.launching.GDBDebugger"
|
|
||||||
cpu="native"
|
|
||||||
id="org.eclipse.cdt.dsf.gdb.GdbDebugger"
|
|
||||||
modes="dsf"
|
|
||||||
name="gdb/mi"
|
|
||||||
platform="*">
|
|
||||||
</debugger>
|
|
||||||
<debugger
|
|
||||||
class="org.eclipse.cdt.dsf.gdb.launching.GDBServerDebugger"
|
|
||||||
cpu="*"
|
|
||||||
id="org.eclipse.cdt.dsf.gdb.GdbServerDebugger"
|
|
||||||
modes="dsf"
|
|
||||||
name="gdbserver Debugger"
|
|
||||||
platform="*">
|
|
||||||
</debugger>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
Loading…
Add table
Reference in a new issue