diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.classpath b/debug/org.eclipse.cdt.debug.mi.ui/.classpath new file mode 100644 index 00000000000..8b37395920f --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/.classpath @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.cvsignore b/debug/org.eclipse.cdt.debug.mi.ui/.cvsignore new file mode 100644 index 00000000000..ba077a4031a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/.cvsignore @@ -0,0 +1 @@ +bin diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.project b/debug/org.eclipse.cdt.debug.mi.ui/.project new file mode 100644 index 00000000000..97bee48cc25 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/.project @@ -0,0 +1,39 @@ + + + org.eclipse.cdt.debug.mi.ui + + + org.eclipse.cdt.debug.core + org.eclipse.cdt.debug.mi.core + org.eclipse.cdt.debug.ui + org.eclipse.cdt.launch + org.eclipse.cdt.ui + org.eclipse.core.boot + org.eclipse.core.resources + org.eclipse.core.runtime + org.eclipse.debug.core + org.eclipse.debug.ui + org.eclipse.ui + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/debug/org.eclipse.cdt.debug.mi.ui/build.properties b/debug/org.eclipse.cdt.debug.mi.ui/build.properties new file mode 100644 index 00000000000..25432e6cf94 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/build.properties @@ -0,0 +1 @@ +source.miui.jar = src/ diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties new file mode 100644 index 00000000000..04492609a8b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties @@ -0,0 +1,2 @@ +pluginName=GDB/MI CDI Debugger UI +providerName=Eclipse.org diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml new file mode 100644 index 00000000000..50689f0e0f9 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java new file mode 100644 index 00000000000..54e4b647629 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java @@ -0,0 +1,110 @@ +/* + * (c) Copyright QNX Software System Ltd. 2002. + * All Rights Reserved. + */ +package org.eclipse.cdt.debug.mi.internal.ui; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.debug.core.ICDebugConfiguration; +import org.eclipse.cdt.launch.ICDTLaunchConfigurationConstants; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; +import org.eclipse.swt.SWT; +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.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class CDebuggerPage extends AbstractLaunchConfigurationTab { + protected Text fDebuggerCommandText; + + protected static final Map EMPTY_MAP = new HashMap(1); + + public void createControl(Composite parent) { + Composite comp = new Composite(parent, SWT.NONE); + GridLayout topLayout = new GridLayout(); + comp.setLayout(topLayout); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + comp.setLayoutData(gd); + + createVerticalSpacer(comp, 2); + + Label debugCommandLabel= new Label(comp, SWT.NONE); + debugCommandLabel.setText("Debugger executable:"); + + fDebuggerCommandText= new Text(comp, SWT.SINGLE | SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + fDebuggerCommandText.setLayoutData(gd); + fDebuggerCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { + updateLaunchConfigurationDialog(); + } + }); + fDebuggerCommandText.setText(getCommand()); + + setControl(comp); + } + + public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { + Map attributeMap = new HashMap(1); +// attributeMap.put(ATTR_DEBUGGER_COMMAND, getCommand()); + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, attributeMap); + } + + private String getCommand() { + return "gdb"; + } + + /** + * @see ILaunchConfigurationTab#isValid(ILaunchConfiguration) + */ + public boolean isValid(ILaunchConfiguration launchConfig) { + boolean valid= fDebuggerCommandText.getText().length() != 0; + if (valid) { + setErrorMessage(null); + setMessage(null); + } else { + setErrorMessage("Debugger executable must be specified"); + setMessage(null); + } + return valid; + } + + public void initializeFrom(ILaunchConfiguration configuration) { + String debuggerCommand= null; + try { + Map attributeMap = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, EMPTY_MAP); + if (attributeMap != null) { +// debuggerCommand = (String) attributeMap.get(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND); + if (debuggerCommand == null) { + debuggerCommand = getCommand(); + } + } + } catch(CoreException ce) { +// JDIDebugUIPlugin.log(ce); + } + fDebuggerCommandText.setText(debuggerCommand); + } + + public void performApply(ILaunchConfigurationWorkingCopy configuration) { + String debuggerCommand = fDebuggerCommandText.getText(); + Map attributeMap = new HashMap(1); +// attributeMap.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAPVA_COMMAND, debuggerCommand); + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, attributeMap); + + } + + public String getName() { + return "GDB/MI Debugger Options"; + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java new file mode 100644 index 00000000000..4a3138cb168 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java @@ -0,0 +1,63 @@ +package org.eclipse.cdt.debug.mi.internal.ui; + +import org.eclipse.ui.plugin.*; +import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.*; +import java.util.*; + +/** + * The main plugin class to be used in the desktop. + */ +public class MIUIPlugin extends AbstractUIPlugin { + //The shared instance. + private static MIUIPlugin plugin; + //Resource bundle. + private ResourceBundle resourceBundle; + + /** + * The constructor. + */ + public MIUIPlugin(IPluginDescriptor descriptor) { + super(descriptor); + plugin = this; + try { + resourceBundle= ResourceBundle.getBundle("org.eclipse.cdt.debug.mi.ui.UiPluginResources"); + } catch (MissingResourceException x) { + resourceBundle = null; + } + } + + /** + * Returns the shared instance. + */ + public static MIUIPlugin getDefault() { + return plugin; + } + + /** + * Returns the workspace instance. + */ + public static IWorkspace getWorkspace() { + return ResourcesPlugin.getWorkspace(); + } + + /** + * Returns the string from the plugin's resource bundle, + * or 'key' if not found. + */ + public static String getResourceString(String key) { + ResourceBundle bundle= MIUIPlugin.getDefault().getResourceBundle(); + try { + return bundle.getString(key); + } catch (MissingResourceException e) { + return key; + } + } + + /** + * Returns the plugin's resource bundle, + */ + public ResourceBundle getResourceBundle() { + return resourceBundle; + } +}