mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
refactor/bug fix
This commit is contained in:
parent
aa45081d82
commit
a91ac220d1
4 changed files with 29 additions and 31 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2003-07-22 David Inglis
|
||||||
|
* src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java
|
||||||
|
* src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
|
||||||
|
* src/org/eclipse/cdt/launch/ui/CorefileDebuggerTab.java
|
||||||
|
Refactor getName & getImage up into AbstructCDebuggerTab
|
||||||
|
fixed problem with selecting a debugger for a core file from a unknown project platform.
|
||||||
|
|
||||||
2003-07-22 David Inglis
|
2003-07-22 David Inglis
|
||||||
* src/org/eclipse/cdt/launch/ui/CMainTab.java
|
* src/org/eclipse/cdt/launch/ui/CMainTab.java
|
||||||
Use project name for configuration naming when no binary selected
|
Use project name for configuration naming when no binary selected
|
||||||
|
|
|
@ -14,6 +14,7 @@ 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.debug.ui.ILaunchConfigurationTab;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
@ -158,7 +159,6 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
|
||||||
|
|
||||||
abstract protected ICDebugConfiguration getConfigForCurrentDebugger();
|
abstract protected ICDebugConfiguration getConfigForCurrentDebugger();
|
||||||
abstract public void createControl(Composite parent);
|
abstract public void createControl(Composite parent);
|
||||||
abstract public String getName();
|
|
||||||
|
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
public void initializeFrom(ILaunchConfiguration config) {
|
||||||
setLaunchConfiguration(config);
|
setLaunchConfiguration(config);
|
||||||
|
@ -212,4 +212,12 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
|
||||||
return fInitDefaults;
|
return fInitDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Image getImage() {
|
||||||
|
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Debugger";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ 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.launch.internal.ui.AbstractCDebuggerTab;
|
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
|
|
||||||
import org.eclipse.core.boot.BootLoader;
|
import org.eclipse.core.boot.BootLoader;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
@ -20,7 +19,6 @@ 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.graphics.Image;
|
|
||||||
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;
|
||||||
|
@ -296,13 +294,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
|
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return "Debugger";
|
|
||||||
}
|
|
||||||
|
|
||||||
public Image getImage() {
|
|
||||||
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
|
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,16 +64,15 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
ICDebugConfiguration[] debugConfigs;
|
ICDebugConfiguration[] debugConfigs;
|
||||||
String configPlatform = getPlatform(config);
|
String configPlatform = getPlatform(config);
|
||||||
ICElement ce = getContext(config, null);
|
ICElement ce = getContext(config, null);
|
||||||
String projectPlatform = "native";
|
String projectPlatform = "*";
|
||||||
String projectCPU = "native";
|
String projectCPU = "*";
|
||||||
if (ce != null) {
|
if (ce != null) {
|
||||||
try {
|
try {
|
||||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
|
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
|
||||||
projectPlatform = descriptor.getPlatform();
|
projectPlatform = descriptor.getPlatform();
|
||||||
IBinary bin = (IBinary) ce;
|
IBinary bin = (IBinary) ce;
|
||||||
projectCPU = bin.getCPU();
|
projectCPU = bin.getCPU();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fDCombo.removeAll();
|
fDCombo.removeAll();
|
||||||
|
@ -83,15 +82,14 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
for (int i = 0; i < debugConfigs.length; i++) {
|
for (int i = 0; i < debugConfigs.length; i++) {
|
||||||
if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
|
if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
|
||||||
String debuggerPlatform = debugConfigs[i].getPlatform();
|
String debuggerPlatform = debugConfigs[i].getPlatform();
|
||||||
boolean isNative = configPlatform.equals(projectPlatform);
|
boolean platformMatch = configPlatform.equals(projectPlatform);
|
||||||
if (debuggerPlatform.equalsIgnoreCase(projectPlatform)
|
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) {
|
||||||
|| (isNative && debuggerPlatform.equalsIgnoreCase("native"))) {
|
|
||||||
if (debugConfigs[i].supportsCPU(projectCPU)) {
|
if (debugConfigs[i].supportsCPU(projectCPU)) {
|
||||||
fDCombo.add(debugConfigs[i].getName());
|
fDCombo.add(debugConfigs[i].getName());
|
||||||
fDCombo.setData(Integer.toString(x), debugConfigs[i]);
|
fDCombo.setData(Integer.toString(x), debugConfigs[i]);
|
||||||
// select first exact matching debugger for platform or requested selection
|
// select first exact matching debugger for platform or requested selection
|
||||||
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(projectPlatform)) ||
|
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(projectPlatform))
|
||||||
selection.equals(debugConfigs[i].getID())) {
|
|| selection.equals(debugConfigs[i].getID())) {
|
||||||
selndx = x;
|
selndx = x;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
|
@ -117,8 +115,7 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
if (getDebugConfig() == null || !getDebugConfig().getID().equals(id)) {
|
if (getDebugConfig() == null || !getDebugConfig().getID().equals(id)) {
|
||||||
loadDebuggerComboBox(config, id);
|
loadDebuggerComboBox(config, id);
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch (CoreException e) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,16 +138,15 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
private boolean validateDebuggerConfig(ILaunchConfiguration config) {
|
private boolean validateDebuggerConfig(ILaunchConfiguration config) {
|
||||||
String platform = getPlatform(config);
|
String platform = getPlatform(config);
|
||||||
ICElement ce = getContext(config, null);
|
ICElement ce = getContext(config, null);
|
||||||
String projectPlatform = "native";
|
String projectPlatform = "*";
|
||||||
String projectCPU = "native";
|
String projectCPU = "*";
|
||||||
if (ce != null) {
|
if (ce != null) {
|
||||||
try {
|
try {
|
||||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
|
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
|
||||||
projectPlatform = descriptor.getPlatform();
|
projectPlatform = descriptor.getPlatform();
|
||||||
IBinary bin = (IBinary) ce;
|
IBinary bin = (IBinary) ce;
|
||||||
projectCPU = bin.getCPU();
|
projectCPU = bin.getCPU();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICDebugConfiguration debugConfig = getDebugConfig();
|
ICDebugConfiguration debugConfig = getDebugConfig();
|
||||||
|
@ -158,8 +154,8 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String debuggerPlatform = debugConfig.getPlatform();
|
String debuggerPlatform = debugConfig.getPlatform();
|
||||||
boolean isNative = platform.equals(projectPlatform);
|
boolean platformMatch = platform.equals(projectPlatform);
|
||||||
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (isNative && debuggerPlatform.equalsIgnoreCase("native"))) {
|
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) {
|
||||||
if (debugConfig.supportsCPU(projectCPU)) {
|
if (debugConfig.supportsCPU(projectCPU)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -177,10 +173,6 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
|
||||||
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
|
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return "Debugger";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#handleDebuggerChanged()
|
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#handleDebuggerChanged()
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue