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

refactor/bug fix

This commit is contained in:
David Inglis 2003-07-22 19:07:36 +00:00
parent aa45081d82
commit a91ac220d1
4 changed files with 29 additions and 31 deletions

View file

@ -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
* src/org/eclipse/cdt/launch/ui/CMainTab.java
Use project name for configuration naming when no binary selected

View file

@ -14,6 +14,7 @@ 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.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@ -158,7 +159,6 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
abstract protected ICDebugConfiguration getConfigForCurrentDebugger();
abstract public void createControl(Composite parent);
abstract public String getName();
public void initializeFrom(ILaunchConfiguration config) {
setLaunchConfiguration(config);
@ -212,4 +212,12 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
return fInitDefaults;
}
public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
}
public String getName() {
return "Debugger";
}
}

View file

@ -10,7 +10,6 @@ import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
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.runtime.CoreException;
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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@ -296,13 +294,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
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()
*/

View file

@ -64,16 +64,15 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
ICDebugConfiguration[] debugConfigs;
String configPlatform = getPlatform(config);
ICElement ce = getContext(config, null);
String projectPlatform = "native";
String projectCPU = "native";
String projectPlatform = "*";
String projectCPU = "*";
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
projectPlatform = descriptor.getPlatform();
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
}
catch (Exception e) {
} catch (Exception e) {
}
}
fDCombo.removeAll();
@ -83,15 +82,14 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
for (int i = 0; i < debugConfigs.length; i++) {
if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
String debuggerPlatform = debugConfigs[i].getPlatform();
boolean isNative = configPlatform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform)
|| (isNative && debuggerPlatform.equalsIgnoreCase("native"))) {
boolean platformMatch = configPlatform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) {
if (debugConfigs[i].supportsCPU(projectCPU)) {
fDCombo.add(debugConfigs[i].getName());
fDCombo.setData(Integer.toString(x), debugConfigs[i]);
// select first exact matching debugger for platform or requested selection
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(projectPlatform)) ||
selection.equals(debugConfigs[i].getID())) {
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(projectPlatform))
|| selection.equals(debugConfigs[i].getID())) {
selndx = x;
}
x++;
@ -117,8 +115,7 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
if (getDebugConfig() == null || !getDebugConfig().getID().equals(id)) {
loadDebuggerComboBox(config, id);
}
}
catch (CoreException e) {
} catch (CoreException e) {
return;
}
}
@ -141,16 +138,15 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
private boolean validateDebuggerConfig(ILaunchConfiguration config) {
String platform = getPlatform(config);
ICElement ce = getContext(config, null);
String projectPlatform = "native";
String projectCPU = "native";
String projectPlatform = "*";
String projectCPU = "*";
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
projectPlatform = descriptor.getPlatform();
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
}
catch (Exception e) {
} catch (Exception e) {
}
}
ICDebugConfiguration debugConfig = getDebugConfig();
@ -158,8 +154,8 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
return false;
}
String debuggerPlatform = debugConfig.getPlatform();
boolean isNative = platform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (isNative && debuggerPlatform.equalsIgnoreCase("native"))) {
boolean platformMatch = platform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) {
if (debugConfig.supportsCPU(projectCPU)) {
return true;
}
@ -177,10 +173,6 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
}
public String getName() {
return "Debugger";
}
/**
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#handleDebuggerChanged()
*/