attrs = configuration.getAttributes();
+
+ if ( fAutoSoLibButton != null )
+ attrs.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, Boolean.valueOf( fAutoSoLibButton.getSelection() ) );
+ if ( fStopOnSolibEventsButton != null )
+ attrs.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, Boolean.valueOf( fStopOnSolibEventsButton.getSelection() ) );
+ configuration.setAttributes( attrs );
+ }
+ catch( CoreException e ) {
+ }
+ }
+
+ public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
+ if ( fSolibSearchPathBlock != null )
+ fSolibSearchPathBlock.setDefaults( configuration );
+ configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT );
+ configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IGDBLaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT );
+ }
+
+ protected void updateButtons() {
+ }
+
+ public void dispose() {
+ deleteObservers();
+ if ( fSolibSearchPathBlock != null ) {
+ if ( fSolibSearchPathBlock instanceof Observable )
+ ((Observable)fSolibSearchPathBlock).deleteObserver( this );
+ fSolibSearchPathBlock.dispose();
+ }
+ }
+
+ public void update( Observable o, Object arg ) {
+ changed();
+ }
+
+ protected void changed() {
+ setChanged();
+ notifyObservers();
+ }
+
+ protected void initializeButtons( ILaunchConfiguration configuration ) {
+ try {
+ boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "" ) ); //$NON-NLS-1$
+ if ( fAutoSoLibButton != null )
+ fAutoSoLibButton.setEnabled( enable );
+ if ( fStopOnSolibEventsButton != null )
+ fStopOnSolibEventsButton.setEnabled( enable );
+ }
+ catch( CoreException e ) {
+ }
+ }
+
+ public Control getControl() {
+ return fControl;
+ }
+
+ public boolean isValid( ILaunchConfiguration launchConfig ) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java
new file mode 100644
index 00000000000..96d86ba7161
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * Ericsson - Modified for DSF
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import java.io.File;
+import java.util.Observable;
+import java.util.Observer;
+
+import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The dynamic tab for gdb-based debugger implementations.
+ */
+public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
+
+ protected TabFolder fTabFolder;
+ protected Text fGDBCommandText;
+ protected Text fGDBInitText;
+ private IMILaunchConfigurationComponent fSolibBlock;
+ private boolean fIsInitializing = false;
+
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout());
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fTabFolder = new TabFolder(comp, SWT.NONE);
+ fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
+ createTabs(fTabFolder);
+ fTabFolder.setSelection(0);
+ setControl(parent);
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
+ IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
+ if (fSolibBlock != null)
+ fSolibBlock.setDefaults(configuration);
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ boolean valid = fGDBCommandText.getText().length() != 0;
+ if (valid) {
+ setErrorMessage(null);
+ setMessage(null);
+ }
+ else {
+ setErrorMessage(LaunchUIMessages.getString("GDBDebuggerPage.0")); //$NON-NLS-1$
+ setMessage(null);
+ }
+ return valid;
+ }
+
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ setInitializing(true);
+ String gdbCommand = IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT;
+ String gdbInit = IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT;
+ try {
+ gdbCommand = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
+ }
+ catch(CoreException e) {
+ }
+ try {
+ gdbInit = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
+ IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
+ }
+ catch(CoreException e) {
+ }
+
+ if (fSolibBlock != null)
+ fSolibBlock.initializeFrom(configuration);
+ fGDBCommandText.setText(gdbCommand);
+ fGDBInitText.setText(gdbInit);
+
+ setInitializing(false);
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ fGDBCommandText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
+ fGDBInitText.getText().trim());
+
+ if (fSolibBlock != null)
+ fSolibBlock.performApply(configuration);
+ }
+
+ public String getName() {
+ return LaunchUIMessages.getString("GDBDebuggerPage.1"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
+ */
+ @Override
+ protected Shell getShell() {
+ return super.getShell();
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
+ */
+ @Override
+ protected void updateLaunchConfigurationDialog() {
+ super.updateLaunchConfigurationDialog();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+ */
+ public void update(Observable o, Object arg) {
+ if (!isInitializing())
+ updateLaunchConfigurationDialog();
+ }
+
+ public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
+ IMILaunchConfigurationComponent block = new GDBSolibBlock( new SolibSearchPathBlock(), true, true);
+ block.createControl(parent);
+ return block;
+ }
+
+ public void createTabs(TabFolder tabFolder) {
+ createMainTab(tabFolder);
+ createSolibTab(tabFolder);
+ }
+
+ public void createMainTab(TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
+ tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.2")); //$NON-NLS-1$
+ Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ comp.setFont(tabFolder.getFont());
+ tabItem.setControl(comp);
+ Composite subComp = ControlFactory.createCompositeEx(comp, 3, GridData.FILL_HORIZONTAL);
+ ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+ subComp.setFont(tabFolder.getFont());
+ Label label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.3")); //$NON-NLS-1$
+ GridData gd = new GridData();
+ // gd.horizontalSpan = 2;
+ label.setLayoutData(gd);
+ fGDBCommandText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
+ fGDBCommandText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent evt) {
+ if (!isInitializing())
+ updateLaunchConfigurationDialog();
+ }
+ });
+ Button button = createPushButton(subComp, LaunchUIMessages.getString("GDBDebuggerPage.4"), null); //$NON-NLS-1$
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ handleGDBButtonSelected();
+ updateLaunchConfigurationDialog();
+ }
+
+ private void handleGDBButtonSelected() {
+ FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
+ dialog.setText(LaunchUIMessages.getString("GDBDebuggerPage.5")); //$NON-NLS-1$
+ String gdbCommand = fGDBCommandText.getText().trim();
+ int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
+ if (lastSeparatorIndex != -1) {
+ dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
+ }
+ String res = dialog.open();
+ if (res == null) {
+ return;
+ }
+ fGDBCommandText.setText(res);
+ }
+ });
+ label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.6")); //$NON-NLS-1$
+ gd = new GridData();
+ // gd.horizontalSpan = 2;
+ label.setLayoutData(gd);
+ fGDBInitText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fGDBInitText.setLayoutData(gd);
+ fGDBInitText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent evt) {
+ if (!isInitializing())
+ updateLaunchConfigurationDialog();
+ }
+ });
+ button = createPushButton(subComp, LaunchUIMessages.getString("GDBDebuggerPage.7"), null); //$NON-NLS-1$
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ handleGDBInitButtonSelected();
+ updateLaunchConfigurationDialog();
+ }
+
+ private void handleGDBInitButtonSelected() {
+ FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
+ dialog.setText(LaunchUIMessages.getString("GDBDebuggerPage.8")); //$NON-NLS-1$
+ String gdbCommand = fGDBInitText.getText().trim();
+ int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
+ if (lastSeparatorIndex != -1) {
+ dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
+ }
+ String res = dialog.open();
+ if (res == null) {
+ return;
+ }
+ fGDBInitText.setText(res);
+ }
+ });
+ label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.9"), //$NON-NLS-1$
+ 200, SWT.DEFAULT, SWT.WRAP);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ gd.widthHint = 200;
+ label.setLayoutData(gd);
+ }
+
+ public void createSolibTab(TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
+ tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.10")); //$NON-NLS-1$
+ Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1, GridData.FILL_BOTH);
+ comp.setFont(tabFolder.getFont());
+ tabItem.setControl(comp);
+ fSolibBlock = createSolibBlock(comp);
+ if (fSolibBlock instanceof Observable)
+ ((Observable)fSolibBlock).addObserver(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (fSolibBlock != null) {
+ if (fSolibBlock instanceof Observable)
+ ((Observable)fSolibBlock).deleteObserver(this);
+ fSolibBlock.dispose();
+ }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
+ // Override the default behavior
+ }
+
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ private void setInitializing(boolean isInitializing) {
+ fIsInitializing = isInitializing;
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbServerDebuggerPage.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbServerDebuggerPage.java
new file mode 100644
index 00000000000..1ff00be5367
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbServerDebuggerPage.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * Ericsson - Modified for DSF
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import org.eclipse.cdt.debug.internal.ui.dialogfields.ComboDialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+/**
+ * The dynamic debugger tab for remote launches using gdb server.
+ */
+public class GdbServerDebuggerPage extends GdbDebuggerPage {
+
+ private final static String CONNECTION_TCP = LaunchUIMessages.getString("GDBServerDebuggerPage.0"); //$NON-NLS-1$
+
+ private final static String CONNECTION_SERIAL = LaunchUIMessages.getString("GDBServerDebuggerPage.1"); //$NON-NLS-1$
+
+ private ComboDialogField fConnectionField;
+
+ private String[] fConnections = new String[]{ CONNECTION_TCP, CONNECTION_SERIAL };
+
+ private TCPSettingsBlock fTCPBlock;
+
+ private SerialPortSettingsBlock fSerialBlock;
+
+ private Composite fConnectionStack;
+
+ private boolean fIsInitializing = false;
+
+ public GdbServerDebuggerPage() {
+ super();
+ fConnectionField = createConnectionField();
+ fTCPBlock = new TCPSettingsBlock();
+ fSerialBlock = new SerialPortSettingsBlock();
+ fTCPBlock.addObserver(this);
+ fSerialBlock.addObserver(this);
+ }
+
+ protected void createConnectionTab(TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
+ tabItem.setText(LaunchUIMessages.getString("GDBServerDebuggerPage.10")); //$NON-NLS-1$
+ Composite comp1 = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
+ ((GridLayout)comp1.getLayout()).makeColumnsEqualWidth = false;
+ comp1.setFont(tabFolder.getFont());
+ tabItem.setControl(comp1);
+ Composite comp = ControlFactory.createCompositeEx(comp1, 2, GridData.FILL_BOTH);
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ comp.setFont(comp1.getFont());
+ fConnectionField.doFillIntoGrid(comp, 2);
+ ((GridData)fConnectionField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ fConnectionStack = ControlFactory.createCompositeEx(comp, 1, GridData.FILL_BOTH);
+ StackLayout stackLayout = new StackLayout();
+ fConnectionStack.setLayout(stackLayout);
+ ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 2;
+ fTCPBlock.createBlock(fConnectionStack);
+ fSerialBlock.createBlock(fConnectionStack);
+ }
+
+ private ComboDialogField createConnectionField() {
+ ComboDialogField field = new ComboDialogField(SWT.DROP_DOWN | SWT.READ_ONLY);
+ field.setLabelText(LaunchUIMessages.getString("GDBServerDebuggerPage.9")); //$NON-NLS-1$
+ field.setItems(fConnections);
+ field.setDialogFieldListener(new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField f) {
+ if (!isInitializing())
+ connectionTypeChanged();
+ }
+ });
+ return field;
+ }
+
+ protected void connectionTypeChanged() {
+ connectionTypeChanged0();
+ updateLaunchConfigurationDialog();
+ }
+
+ private void connectionTypeChanged0() {
+ ((StackLayout)fConnectionStack.getLayout()).topControl = null;
+ int index = fConnectionField.getSelectionIndex();
+ if (index >= 0 && index < fConnections.length) {
+ String[] connTypes = fConnectionField.getItems();
+ if (CONNECTION_TCP.equals(connTypes[index]))
+ ((StackLayout)fConnectionStack.getLayout()).topControl = fTCPBlock.getControl();
+ else if (CONNECTION_SERIAL.equals(connTypes[index]))
+ ((StackLayout)fConnectionStack.getLayout()).topControl = fSerialBlock.getControl();
+ }
+ fConnectionStack.layout();
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ if (super.isValid(launchConfig)) {
+ setErrorMessage(null);
+ setMessage(null);
+ int index = fConnectionField.getSelectionIndex();
+ if (index >= 0 && index < fConnections.length) {
+ String[] connTypes = fConnectionField.getItems();
+ if (CONNECTION_TCP.equals(connTypes[index])) {
+ if (!fTCPBlock.isValid(launchConfig)) {
+ setErrorMessage(fTCPBlock.getErrorMessage());
+ return false;
+ }
+ }
+ else if (CONNECTION_SERIAL.equals(connTypes[index])) {
+ if (!fSerialBlock.isValid(launchConfig)) {
+ setErrorMessage(fSerialBlock.getErrorMessage());
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ setInitializing(true);
+ super.initializeFrom(configuration);
+ boolean isTcp = false;
+ try {
+ isTcp = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
+ }
+ catch(CoreException e) {
+ }
+ fTCPBlock.initializeFrom(configuration);
+ fSerialBlock.initializeFrom(configuration);
+ fConnectionField.selectItem((isTcp) ? 0 : 1);
+ connectionTypeChanged0();
+ setInitializing(false);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ super.performApply(configuration);
+ if (fConnectionField != null)
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0);
+ fTCPBlock.performApply(configuration);
+ fSerialBlock.performApply(configuration);
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ super.setDefaults(configuration);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
+ fTCPBlock.setDefaults(configuration);
+ fSerialBlock.setDefaults(configuration);
+ }
+
+ @Override
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ private void setInitializing(boolean isInitializing) {
+ fIsInitializing = isInitializing;
+ }
+
+ @Override
+ public void createTabs(TabFolder tabFolder) {
+ super.createTabs(tabFolder);
+ createConnectionTab(tabFolder);
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java
new file mode 100644
index 00000000000..0504917a6f5
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 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
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * The common interface for UI components of the launch configuration tabs.
+ */
+public interface IMILaunchConfigurationComponent {
+
+ /**
+ * Creates the top level control for this component under the given parent composite.
+ *
+ * Implementors are responsible for ensuring that the created control can be accessed via getControl
+ *
+ *
+ * @param parent the parent composite
+ */
+ public void createControl( Composite parent );
+
+ /**
+ * Returns the top level control for this component.
+ *
+ * May return null
if the control has not been created yet.
+ *
+ *
+ * @return the top level control or null
+ */
+ public Control getControl();
+
+ /**
+ * Initializes the given component with default values.
+ * This method may be called before this tab's control is created.
+ *
+ * @param configuration launch configuration
+ */
+ public void setDefaults( ILaunchConfigurationWorkingCopy configuration );
+
+ /**
+ * Initializes this component's controls with values from the given
+ * launch configuration.
+ *
+ * @param configuration launch configuration
+ */
+ public void initializeFrom( ILaunchConfiguration configuration );
+
+ /**
+ * Notifies this component that it has been disposed.
+ * Marks the end of this component's lifecycle, allowing
+ * to perform any cleanup required.
+ */
+ public void dispose();
+
+ /**
+ * Copies values from this component into the given launch configuration.
+ *
+ * @param configuration launch configuration
+ */
+ public void performApply( ILaunchConfigurationWorkingCopy configuration );
+
+ /**
+ * Returns whether this component is in a valid state in the context
+ * of the specified launch configuration.
+ *
+ * @param launchConfig launch configuration which provides context
+ * for validating this component.
+ * This value must not be null
.
+ *
+ * @return whether this component is in a valid state
+ */
+ public boolean isValid(ILaunchConfiguration launchConfig);
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.java
new file mode 100644
index 00000000000..f5569e3fe53
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 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
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class LaunchUIMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.dd.gdb.internal.ui.launching.LaunchUIMessages";//$NON-NLS-1$
+
+ private static ResourceBundle RESOURCE_BUNDLE = null;
+
+ static {
+ try {
+ RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ }
+ catch (MissingResourceException x) {
+ }
+ }
+
+ private LaunchUIMessages() {}
+
+ public static String getFormattedString(String key, String arg) {
+ return MessageFormat.format(getString(key), (Object[])new String[]{arg});
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(getString(key), (Object[])args);
+ }
+
+ public static String getString(String key) {
+ if (RESOURCE_BUNDLE == null) return '!' + key + '!';
+ return RESOURCE_BUNDLE.getString(key);
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.properties b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.properties
new file mode 100644
index 00000000000..b8023908379
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/LaunchUIMessages.properties
@@ -0,0 +1,75 @@
+###############################################################################
+# Copyright (c) 2003, 2006 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
+###############################################################################
+
+CygwinDebuggerPage.0=Cygwin GDB Debugger Options
+GDBDebuggerPage.0=Debugger executable must be specified.
+GDBDebuggerPage.1=GDB Debugger Options
+GDBDebuggerPage.2=Main
+GDBDebuggerPage.3=GDB debugger:
+GDBDebuggerPage.4=&Browse...
+GDBDebuggerPage.5=GDB Debugger
+GDBDebuggerPage.6=GDB command file:
+GDBDebuggerPage.7=B&rowse...
+GDBDebuggerPage.8=GDB Command File
+GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
+GDBDebuggerPage.10=Shared Libraries
+GDBDebuggerPage.11=Protocol:
+GDBDebuggerPage.12=Default
+StandardGDBDebuggerPage.0=Debugger executable must be specified.
+StandardGDBDebuggerPage.1=GDB Debugger Options
+StandardGDBDebuggerPage.2=Main
+StandardGDBDebuggerPage.3=GDB debugger:
+StandardGDBDebuggerPage.4=&Browse...
+StandardGDBDebuggerPage.5=GDB Debugger
+StandardGDBDebuggerPage.6=GDB command file:
+StandardGDBDebuggerPage.7=B&rowse...
+StandardGDBDebuggerPage.8=GDB Command File
+StandardGDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
+StandardGDBDebuggerPage.10=Shared Libraries
+StandardGDBDebuggerPage.11=Protocol:
+StandardGDBDebuggerPage.12=GDB command set:
+StandardGDBDebuggerPage.13=Verbose console mode
+StandardGDBDebuggerPage.14=Use full file path to set breakpoints
+GDBServerDebuggerPage.0=TCP
+GDBServerDebuggerPage.1=Serial
+GDBServerDebuggerPage.10=Connection
+GDBServerDebuggerPage.2=Main
+GDBServerDebuggerPage.3=GDB debugger
+GDBServerDebuggerPage.4=&Browse...
+GDBServerDebuggerPage.5=GDB Debugger
+GDBServerDebuggerPage.6=GDB command file:
+GDBServerDebuggerPage.7=B&rowse...
+GDBServerDebuggerPage.8=GDB Command File
+GDBServerDebuggerPage.9=Type:
+GDBSolibBlock.0=Load shared library symbols automatically
+GDBSolibBlock.1=Stop on shared library events
+SerialPortSettingsBlock.0=Device:
+SerialPortSettingsBlock.1=Speed:
+SerialPortSettingsBlock.2=Device must be specified.
+SerialPortSettingsBlock.3=Invalid device.
+SerialPortSettingsBlock.4=Speed must be specified.
+SolibSearchPathBlock.0=Add...
+SolibSearchPathBlock.1=Up
+SolibSearchPathBlock.2=Down
+SolibSearchPathBlock.3=Remove
+SolibSearchPathBlock.4=Directories:
+SolibSearchPathBlock.5=Select directory that contains shared library.
+SolibSearchPathBlock.6=Select From List
+SolibSearchPathBlock.7=Select Libraries
+SolibSearchPathBlock.8=Select libraries to load symbols automatically.
+SolibSearchPathBlock.9=No libraries found.
+SolibSearchPathBlock.Add_Directory=Add Directory
+TCPSettingsBlock.0=Host name or IP address:
+TCPSettingsBlock.1=Port number:
+TCPSettingsBlock.2=Host name or IP address must be specified.
+TCPSettingsBlock.3=Invalid host name or IP address.
+TCPSettingsBlock.4=Port number must be specified.
+TCPSettingsBlock.5=Invalid port number.
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SerialPortSettingsBlock.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SerialPortSettingsBlock.java
new file mode 100644
index 00000000000..ff9123465b8
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SerialPortSettingsBlock.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ *******************************************************************************/
+
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import java.util.Observable;
+
+import org.eclipse.cdt.debug.internal.ui.PixelConverter;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.ComboDialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.StringDialogField;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class SerialPortSettingsBlock extends Observable {
+
+ private final static String DEFAULT_ASYNC_DEVICE = "/dev/ttyS0"; //$NON-NLS-1$
+
+ private final static String DEFAULT_ASYNC_DEVICE_SPEED = "115200"; //$NON-NLS-1$
+
+ private Shell fShell;
+
+ private StringDialogField fDeviceField;
+
+ private ComboDialogField fSpeedField;
+
+ private String fSpeedChoices[] = { "9600", "19200", "38400", "57600", "115200" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+ private Control fControl;
+
+ private String fErrorMessage = null;
+
+ public SerialPortSettingsBlock() {
+ super();
+ fDeviceField = createDeviceField();
+ fSpeedField = createSpeedField();
+ }
+
+ public void createBlock(Composite parent) {
+ fShell = parent.getShell();
+ Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout)comp.getLayout()).marginHeight = 0;
+ ((GridLayout)comp.getLayout()).marginWidth = 0;
+ comp.setFont(parent.getFont());
+ PixelConverter converter = new PixelConverter(comp);
+ fDeviceField.doFillIntoGrid(comp, 2);
+ LayoutUtil.setWidthHint(fDeviceField.getTextControl(null), converter.convertWidthInCharsToPixels(20));
+ fSpeedField.doFillIntoGrid(comp, 2);
+ ((GridData)fSpeedField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ setControl(comp);
+ }
+
+ protected Shell getShell() {
+ return fShell;
+ }
+
+ public void dispose() {
+ deleteObservers();
+ }
+
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ initializeDevice(configuration);
+ initializeSpeed(configuration);
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED);
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (fDeviceField != null)
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, fDeviceField.getText().trim());
+ if (fSpeedField != null) {
+ int index = fSpeedField.getSelectionIndex();
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, getSpeedItem(index));
+ }
+ }
+
+ private StringDialogField createDeviceField() {
+ StringDialogField field = new StringDialogField();
+ field.setLabelText(LaunchUIMessages.getString("SerialPortSettingsBlock.0")); //$NON-NLS-1$
+ field.setDialogFieldListener(new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField f) {
+ deviceFieldChanged();
+ }
+ });
+ return field;
+ }
+
+ private ComboDialogField createSpeedField() {
+ ComboDialogField field = new ComboDialogField(SWT.DROP_DOWN | SWT.READ_ONLY);
+ field.setLabelText(LaunchUIMessages.getString("SerialPortSettingsBlock.1")); //$NON-NLS-1$
+ field.setItems(fSpeedChoices);
+ field.setDialogFieldListener(new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField f) {
+ speedFieldChanged();
+ }
+ });
+ return field;
+ }
+
+ protected void deviceFieldChanged() {
+ updateErrorMessage();
+ setChanged();
+ notifyObservers();
+ }
+
+ protected void speedFieldChanged() {
+ updateErrorMessage();
+ setChanged();
+ notifyObservers();
+ }
+
+ private void initializeDevice(ILaunchConfiguration configuration) {
+ if (fDeviceField != null) {
+ try {
+ fDeviceField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE));
+ }
+ catch(CoreException e) {
+ }
+ }
+ }
+
+ private void initializeSpeed(ILaunchConfiguration configuration) {
+ if (fSpeedField != null) {
+ int index = 0;
+ try {
+ index = getSpeedItemIndex(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED));
+ }
+ catch(CoreException e) {
+ }
+ fSpeedField.selectItem(index);
+ }
+ }
+
+ private String getSpeedItem(int index) {
+ return (index >= 0 && index < fSpeedChoices.length) ? fSpeedChoices[index] : null;
+ }
+
+ private int getSpeedItemIndex(String item) {
+ for(int i = 0; i < fSpeedChoices.length; ++i)
+ if (fSpeedChoices[i].equals(item))
+ return i;
+ return 0;
+ }
+
+ public Control getControl() {
+ return fControl;
+ }
+
+ protected void setControl(Control control) {
+ fControl = control;
+ }
+
+ public boolean isValid(ILaunchConfiguration configuration) {
+ updateErrorMessage();
+ return (getErrorMessage() == null);
+ }
+
+ private void updateErrorMessage() {
+ setErrorMessage(null);
+ if (fDeviceField != null && fSpeedField != null) {
+ if (fDeviceField.getText().trim().length() == 0)
+ setErrorMessage(LaunchUIMessages.getString("SerialPortSettingsBlock.2")); //$NON-NLS-1$
+ else if (!deviceIsValid(fDeviceField.getText().trim()))
+ setErrorMessage(LaunchUIMessages.getString("SerialPortSettingsBlock.3")); //$NON-NLS-1$
+ else if (fSpeedField.getSelectionIndex() < 0)
+ setErrorMessage(LaunchUIMessages.getString("SerialPortSettingsBlock.4")); //$NON-NLS-1$
+ }
+ }
+
+ public String getErrorMessage() {
+ return fErrorMessage;
+ }
+
+ private void setErrorMessage(String string) {
+ fErrorMessage = string;
+ }
+
+ private boolean deviceIsValid(String hostName) {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SolibSearchPathBlock.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SolibSearchPathBlock.java
new file mode 100644
index 00000000000..d58d2acbbd7
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/SolibSearchPathBlock.java
@@ -0,0 +1,620 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 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.dd.gdb.internal.ui.launching;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Observable;
+import java.util.Set;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IBinaryParser;
+import org.eclipse.cdt.core.ICExtensionReference;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryShared;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.internal.ui.PixelConverter;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
+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.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
+
+/**
+ * The UI component to access the shared libraries search path.
+ */
+public class SolibSearchPathBlock extends Observable implements IMILaunchConfigurationComponent, IDialogFieldListener {
+
+ class AddDirectoryDialog extends Dialog {
+
+ protected Text fText;
+
+ private Button fBrowseButton;
+
+ private IPath fValue;
+
+ /**
+ * Constructor for AddDirectoryDialog.
+ */
+ public AddDirectoryDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Composite subComp = ControlFactory.createCompositeEx(composite, 2, GridData.FILL_HORIZONTAL);
+ ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ subComp.setLayoutData(data);
+ subComp.setFont(parent.getFont());
+
+ fText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ fText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ fText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ updateOKButton();
+ }
+ });
+
+ fBrowseButton = ControlFactory.createPushButton(subComp, LaunchUIMessages.getString("GDBServerDebuggerPage.7")); //$NON-NLS-1$
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ fBrowseButton.setLayoutData(data);
+ fBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ DirectoryDialog dialog = new DirectoryDialog(AddDirectoryDialog.this.getShell());
+ dialog.setMessage(LaunchUIMessages.getString("SolibSearchPathBlock.5")); //$NON-NLS-1$
+ String res = dialog.open();
+ if (res != null) {
+ fText.setText(res);
+ }
+ }
+ });
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(LaunchUIMessages.getString("SolibSearchPathBlock.Add_Directory")); //$NON-NLS-1$
+ }
+
+ public IPath getValue() {
+ return fValue;
+ }
+
+ private void setValue(String value) {
+ fValue = (value != null) ? new Path(value) : null;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ setValue(fText.getText());
+ }
+ else {
+ setValue(null);
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ protected void updateOKButton() {
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ String text = fText.getText();
+ okButton.setEnabled(isValid(text));
+ }
+
+ protected boolean isValid(String text) {
+ return (text.trim().length() > 0);
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control control = super.createButtonBar(parent);
+ updateOKButton();
+ return control;
+ }
+ }
+
+ private Composite fControl;
+
+ public class SolibSearchPathListDialogField extends ListDialogField {
+
+ public SolibSearchPathListDialogField(IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider) {
+ super(adapter, buttonLabels, lprovider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#managedButtonPressed(int)
+ */
+ @Override
+ protected boolean managedButtonPressed(int index) {
+ boolean result = super.managedButtonPressed(index);
+ if (result)
+ buttonPressed(index);
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField#getManagedButtonState(org.eclipse.jface.viewers.ISelection, int)
+ */
+ @Override
+ protected boolean getManagedButtonState(ISelection sel, int index) {
+ if (index > 3)
+ return getButtonState(sel, index);
+ return super.getManagedButtonState(sel, index);
+ }
+ }
+
+ private static String[] fgStaticButtonLabels = new String[] {
+ LaunchUIMessages.getString("SolibSearchPathBlock.0"), //$NON-NLS-1$
+ LaunchUIMessages.getString("SolibSearchPathBlock.1"), //$NON-NLS-1$
+ LaunchUIMessages.getString("SolibSearchPathBlock.2"), //$NON-NLS-1$
+ LaunchUIMessages.getString("SolibSearchPathBlock.3"), //$NON-NLS-1$
+ LaunchUIMessages.getString("SolibSearchPathBlock.6"), //$NON-NLS-1$
+ null, // separator
+ };
+
+ private IProject fProject;
+
+ private Shell fShell;
+
+ private SolibSearchPathListDialogField fDirList;
+
+ private IListAdapter fCustomListAdapter;
+
+ private File[] fAutoSolibs = new File[0];
+
+ public SolibSearchPathBlock() {
+ this(new String[0], null);
+ }
+
+ public SolibSearchPathBlock(String[] customButtonLabels, IListAdapter customListAdapter) {
+ super();
+ fCustomListAdapter = customListAdapter;
+ int length = fgStaticButtonLabels.length;
+ if (customButtonLabels.length > 0)
+ length += customButtonLabels.length;
+ String[] buttonLabels = new String[length];
+ System.arraycopy(fgStaticButtonLabels, 0, buttonLabels, 0, fgStaticButtonLabels.length);
+ if (length > fgStaticButtonLabels.length) {
+ for (int i = fgStaticButtonLabels.length; i < length; ++i)
+ buttonLabels[i] = customButtonLabels[i - fgStaticButtonLabels.length];
+ }
+ IListAdapter listAdapter = new IListAdapter() {
+ public void customButtonPressed(DialogField field, int index) {
+ buttonPressed(index);
+ }
+ public void selectionChanged(DialogField field) {
+ }
+ };
+ ILabelProvider lp = new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IPath)
+ return ((IPath)element).toOSString();
+ return super.getText(element);
+ }
+ };
+ fDirList = new SolibSearchPathListDialogField(listAdapter, buttonLabels, lp);
+ fDirList.setLabelText(LaunchUIMessages.getString("SolibSearchPathBlock.4")); //$NON-NLS-1$
+ fDirList.setUpButtonIndex(1);
+ fDirList.setDownButtonIndex(2);
+ fDirList.setRemoveButtonIndex(3);
+
+ fDirList.setDialogFieldListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ fShell = parent.getShell();
+ Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout)comp.getLayout()).marginHeight = 0;
+ ((GridLayout)comp.getLayout()).marginWidth = 0;
+ comp.setFont(parent.getFont());
+ PixelConverter converter = new PixelConverter(comp);
+ fDirList.doFillIntoGrid(comp, 3);
+ LayoutUtil.setHorizontalSpan(fDirList.getLabelControl(null), 2);
+ LayoutUtil.setWidthHint(fDirList.getLabelControl(null), converter.convertWidthInCharsToPixels(30));
+ LayoutUtil.setHorizontalGrabbing(fDirList.getListControl(null));
+ fControl = comp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ IProject project = null;
+ try {
+ String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ if (projectName != null) {
+ projectName = projectName.trim();
+ if (projectName.length() > 0) {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ }
+ }
+ }
+ catch(CoreException e) {
+ }
+ setProject(project);
+
+ if (fDirList != null) {
+ try {
+ @SuppressWarnings("unchecked")
+ List values = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
+ Collections.EMPTY_LIST);
+ ArrayList paths = new ArrayList(values.size());
+ Iterator it = values.iterator();
+ while(it.hasNext()) {
+ paths.add(new Path(it.next()));
+ }
+ fDirList.addElements(paths);
+ }
+ catch(CoreException e) {
+ }
+ }
+
+ try {
+ fAutoSolibs = getAutoSolibs(configuration);
+ }
+ catch(CoreException e) {
+ }
+ }
+
+ public static File[] getAutoSolibs(ILaunchConfiguration configuration) throws CoreException {
+ @SuppressWarnings("unchecked")
+ List autoSolibs = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, Collections.EMPTY_LIST );
+
+ List list = new ArrayList(autoSolibs.size());
+ Iterator it = autoSolibs.iterator();
+ while(it.hasNext()) {
+ list.add(new File(it.next()));
+ }
+ return list.toArray(new File[list.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (fDirList != null) {
+
+ @SuppressWarnings("unchecked")
+ List elements = fDirList.getElements();
+
+ ArrayList values = new ArrayList(elements.size());
+ Iterator it = elements.iterator();
+ while(it.hasNext()) {
+ values.add((it.next()).toOSString());
+ }
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, values);
+ }
+ ArrayList autoLibs = new ArrayList(fAutoSolibs.length);
+ for (int i = 0; i < fAutoSolibs.length; ++i)
+ autoLibs.add(fAutoSolibs[i].getPath());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, autoLibs);
+ }
+
+ protected void buttonPressed(int index) {
+ boolean changed = false;
+ if (index == 0) { // Add button
+ changed = addDirectory();
+ }
+ else if (index == 4) { //Select from list
+ changed = selectFromList();
+ }
+ else if (index >= fgStaticButtonLabels.length && fCustomListAdapter != null) {
+ fCustomListAdapter.customButtonPressed(fDirList, index);
+ changed = true;
+ }
+ if (changed) {
+ setChanged();
+ notifyObservers();
+ }
+ }
+
+ protected boolean getButtonState(ISelection sel, int index) {
+ if (index == 4) { // select from list
+ return (!sel.isEmpty());
+ }
+ return true;
+ }
+
+ protected Shell getShell() {
+ return fShell;
+ }
+
+ private boolean addDirectory() {
+ boolean changed = false;
+ AddDirectoryDialog dialog = new AddDirectoryDialog(getShell());
+ dialog.open();
+ IPath result = dialog.getValue();
+ if (result != null && !contains(result)) {
+ fDirList.addElement(result);
+ changed = true;
+ }
+ return changed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose()
+ */
+ public void dispose() {
+ deleteObservers();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl()
+ */
+ public Control getControl() {
+ return fControl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ private boolean contains(IPath path) {
+ @SuppressWarnings("unchecked")
+ List list = fDirList.getElements();
+
+ Iterator it = list.iterator();
+ while(it.hasNext()) {
+ IPath p = it.next();
+ if (p.toFile().equals(path.toFile()))
+ return true;
+ }
+ return false;
+ }
+
+ protected IProject getProject() {
+ return fProject;
+ }
+
+ private void setProject(IProject project) {
+ fProject = project;
+ }
+
+ protected boolean selectFromList() {
+ boolean changed = false;
+
+ @SuppressWarnings("unchecked")
+ List dirList = fDirList.getSelectedElements();
+
+ final HashSet libs = new HashSet(10);
+ if (generateLibraryList(dirList.toArray(new IPath[dirList.size()]), libs)) {
+ ITreeContentProvider cp = new ITreeContentProvider() {
+
+ public Object[] getChildren(Object parentElement) {
+ return getElements(parentElement);
+ }
+
+ public Object getParent(Object element) {
+ if (libs.contains(element))
+ return libs;
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof Set) {
+ return ((Set)inputElement).toArray();
+ }
+ return new Object[0];
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ };
+
+ LabelProvider lp = new LabelProvider() {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof File)
+ return ((File)element).getName();
+ return super.getText(element);
+ }
+ };
+ CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(getShell(), lp, cp);
+ dialog.setTitle(LaunchUIMessages.getString("SolibSearchPathBlock.7")); //$NON-NLS-1$
+ dialog.setMessage(LaunchUIMessages.getString("SolibSearchPathBlock.8")); //$NON-NLS-1$
+ dialog.setEmptyListMessage(LaunchUIMessages.getString("SolibSearchPathBlock.9")); //$NON-NLS-1$
+ dialog.setSorter(new ViewerSorter());
+ dialog.setInput(libs);
+ dialog.setInitialElementSelections(Arrays.asList(fAutoSolibs));
+ if (dialog.open() == Window.OK) {
+ Object[] result = dialog.getResult();
+ fAutoSolibs = (File[])Arrays.asList(result).toArray(new File[result.length]);
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ private boolean generateLibraryList(final IPath[] paths, final Set libs) {
+ boolean result = true;
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+
+ for (int i = 0; i < paths.length; ++i) {
+ File dir = paths[i].toFile();
+ if (dir.exists() && dir.isDirectory()) {
+ File[] all = dir.listFiles();
+ for (int j = 0; j < all.length; ++j) {
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+ monitor.subTask(all[j].getPath());
+ String libName = getSharedLibraryName(all[j]);
+ if (libName != null) {
+ libs.add(new File(libName));
+ }
+ }
+ }
+ }
+ }
+ };
+ try {
+ IRunnableContext context = new ProgressMonitorDialog(getShell());
+ context.run(true, true, runnable);
+ }
+ catch(InvocationTargetException e) {
+ }
+ catch(InterruptedException e) {
+ result = false;
+ }
+ return result;
+ }
+
+ protected String getSharedLibraryName(File file) {
+ if (!file.isFile())
+ return null;
+ IProject project = getProject();
+ if (project != null) {
+ IPath fullPath = new Path(file.getPath());
+ try {
+ ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project);
+ for(int i = 0; i < binaryParsersExt.length; i++) {
+ IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension();
+ try {
+ IBinaryFile bin = parser.getBinary(fullPath);
+ if (bin instanceof IBinaryShared) {
+ String soname = ((IBinaryShared)bin).getSoName();
+ return (soname.length() != 0) ? soname : file.getName();
+ }
+ }
+ catch(IOException e) {
+ }
+ }
+ }
+ catch(CoreException e) {
+ }
+ return null;
+ }
+ // no project: for now
+ IPath path = new Path(file.getPath());
+ String name = path.lastSegment();
+ String extension = path.getFileExtension();
+ if (extension != null && (extension.compareTo("so") == 0 || extension.compareToIgnoreCase("dll") == 0)) //$NON-NLS-1$ //$NON-NLS-2$
+ return name;
+ return (name.indexOf(".so.") >= 0) ? name : null; //$NON-NLS-1$
+ }
+
+ protected boolean isSharedLibrary(File file) {
+ if (!file.isFile())
+ return false;
+ IProject project = getProject();
+ if (project != null) {
+ IPath fullPath = new Path(file.getPath());
+ try {
+ ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project);
+ for(int i = 0; i < binaryParsersExt.length; i++) {
+ IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension();
+ try {
+ IBinaryFile bin = parser.getBinary(fullPath);
+ return (bin instanceof IBinaryShared);
+ }
+ catch(IOException e) {
+ }
+ }
+ }
+ catch(CoreException e) {
+ }
+ return false;
+ }
+ // no project: for now
+ IPath path = new Path(file.getPath());
+ String extension = path.getFileExtension();
+ if (extension != null && (extension.compareTo("so") == 0 || extension.compareToIgnoreCase("dll") == 0)) //$NON-NLS-1$ //$NON-NLS-2$
+ return true;
+ String name = path.lastSegment();
+ return (name.indexOf(".so.") >= 0); //$NON-NLS-1$
+ }
+
+ public void dialogFieldChanged(DialogField field) {
+ setChanged();
+ notifyObservers();
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/TCPSettingsBlock.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/TCPSettingsBlock.java
new file mode 100644
index 00000000000..6df2bd82001
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/TCPSettingsBlock.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ *******************************************************************************/
+
+package org.eclipse.dd.gdb.internal.ui.launching;
+
+import java.util.Observable;
+
+import org.eclipse.cdt.debug.internal.ui.PixelConverter;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.StringDialogField;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class TCPSettingsBlock extends Observable {
+
+ private final static String DEFAULT_HOST_NAME = "localhost"; //$NON-NLS-1$
+
+ private final static String DEFAULT_PORT_NUMBER = "10000"; //$NON-NLS-1$
+
+ private Shell fShell;
+
+ private StringDialogField fHostNameField;
+
+ private StringDialogField fPortNumberField;
+
+ private Control fControl;
+
+ private String fErrorMessage = null;
+
+ public TCPSettingsBlock() {
+ super();
+ fHostNameField = createHostNameField();
+ fPortNumberField = createPortNumberField();
+ }
+
+ public void createBlock(Composite parent) {
+ fShell = parent.getShell();
+ Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout)comp.getLayout()).marginHeight = 0;
+ ((GridLayout)comp.getLayout()).marginWidth = 0;
+ comp.setFont(parent.getFont());
+ PixelConverter converter = new PixelConverter(comp);
+ fHostNameField.doFillIntoGrid(comp, 2);
+ LayoutUtil.setWidthHint(fHostNameField.getTextControl(null), converter.convertWidthInCharsToPixels(20));
+ fPortNumberField.doFillIntoGrid(comp, 2);
+ ((GridData)fPortNumberField.getTextControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ LayoutUtil.setWidthHint(fPortNumberField.getTextControl(null), converter.convertWidthInCharsToPixels(10));
+ setControl(comp);
+ }
+
+ protected Shell getShell() {
+ return fShell;
+ }
+
+ public void dispose() {
+ deleteObservers();
+ }
+
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ initializeHostName(configuration);
+ initializePortNumber(configuration);
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER);
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (fHostNameField != null)
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, fHostNameField.getText().trim());
+ if (fPortNumberField != null)
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, fPortNumberField.getText().trim());
+ }
+
+ private StringDialogField createHostNameField() {
+ StringDialogField field = new StringDialogField();
+ field.setLabelText(LaunchUIMessages.getString("TCPSettingsBlock.0")); //$NON-NLS-1$
+ field.setDialogFieldListener(new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField f) {
+ hostNameFieldChanged();
+ }
+ });
+ return field;
+ }
+
+ private StringDialogField createPortNumberField() {
+ StringDialogField field = new StringDialogField();
+ field.setLabelText(LaunchUIMessages.getString("TCPSettingsBlock.1")); //$NON-NLS-1$
+ field.setDialogFieldListener(new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField f) {
+ portNumberFieldChanged();
+ }
+ });
+ return field;
+ }
+
+ protected void hostNameFieldChanged() {
+ updateErrorMessage();
+ setChanged();
+ notifyObservers();
+ }
+
+ protected void portNumberFieldChanged() {
+ updateErrorMessage();
+ setChanged();
+ notifyObservers();
+ }
+
+ private void initializeHostName(ILaunchConfiguration configuration) {
+ if (fHostNameField != null) {
+ try {
+ fHostNameField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME));
+ }
+ catch(CoreException e) {
+ }
+ }
+ }
+
+ private void initializePortNumber(ILaunchConfiguration configuration) {
+ if (fPortNumberField != null) {
+ try {
+ fPortNumberField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER));
+ }
+ catch(CoreException e) {
+ }
+ }
+ }
+
+ public Control getControl() {
+ return fControl;
+ }
+
+ protected void setControl(Control control) {
+ fControl = control;
+ }
+
+ public boolean isValid(ILaunchConfiguration configuration) {
+ updateErrorMessage();
+ return (getErrorMessage() == null);
+ }
+
+ private void updateErrorMessage() {
+ setErrorMessage(null);
+ if (fHostNameField != null && fPortNumberField != null) {
+ if (fHostNameField.getText().trim().length() == 0)
+ setErrorMessage(LaunchUIMessages.getString("TCPSettingsBlock.2")); //$NON-NLS-1$
+ else if (!hostNameIsValid(fHostNameField.getText().trim()))
+ setErrorMessage(LaunchUIMessages.getString("TCPSettingsBlock.3")); //$NON-NLS-1$
+ else if (fPortNumberField.getText().trim().length() == 0)
+ setErrorMessage(LaunchUIMessages.getString("TCPSettingsBlock.4")); //$NON-NLS-1$
+ else if (!portNumberIsValid(fPortNumberField.getText().trim()))
+ setErrorMessage(LaunchUIMessages.getString("TCPSettingsBlock.5")); //$NON-NLS-1$
+ }
+ }
+
+ public String getErrorMessage() {
+ return fErrorMessage;
+ }
+
+ private void setErrorMessage(String string) {
+ fErrorMessage = string;
+ }
+
+ private boolean hostNameIsValid(String hostName) {
+ return true;
+ }
+
+ private boolean portNumberIsValid(String portNumber) {
+ try {
+ int port = Integer.parseInt(portNumber);
+ return (port > 0 && port <= 0xFFFF);
+ }
+ catch(NumberFormatException e) {
+ return false;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.dd.gdb/plugin.xml b/plugins/org.eclipse.dd.gdb/plugin.xml
index 09c4d758542..e09d01321cf 100644
--- a/plugins/org.eclipse.dd.gdb/plugin.xml
+++ b/plugins/org.eclipse.dd.gdb/plugin.xml
@@ -17,5 +17,24 @@
contextId="org.eclipse.cdt.debug.ui.debugging"
debugModelId="org.eclipse.dd.gdb"/>
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/IGDBLaunchConfigurationConstants.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/IGDBLaunchConfigurationConstants.java
index e77b40cf9bf..501651cc8bd 100644
--- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/IGDBLaunchConfigurationConstants.java
+++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/IGDBLaunchConfigurationConstants.java
@@ -10,21 +10,19 @@
*******************************************************************************/
package org.eclipse.dd.gdb.internal.provisional;
+import org.eclipse.dd.gdb.internal.GdbPlugin;
+
public class IGDBLaunchConfigurationConstants {
- // This is the ID used by CDT. We must use the same because we still use some CDT code
- // and we must be consistent, or else these values will not be found in the Launch
- private static final String CDT_CONSTS_ID = "org.eclipse.cdt.debug.mi.core" ; //$NON-NLS-1$
-
//
// Taken from org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants
//
- public static final String ATTR_REMOTE_TCP = CDT_CONSTS_ID + ".REMOTE_TCP"; //$NON-NLS-1$
- public static final String ATTR_HOST = CDT_CONSTS_ID + ".HOST"; //$NON-NLS-1$
- public static final String ATTR_PORT = CDT_CONSTS_ID + ".PORT"; //$NON-NLS-1$
- public static final String ATTR_DEV = CDT_CONSTS_ID + ".DEV"; //$NON-NLS-1$
- public static final String ATTR_DEV_SPEED = CDT_CONSTS_ID + ".DEV_SPEED"; //$NON-NLS-1$
+ public static final String ATTR_REMOTE_TCP = GdbPlugin.PLUGIN_ID + ".REMOTE_TCP"; //$NON-NLS-1$
+ public static final String ATTR_HOST = GdbPlugin.PLUGIN_ID + ".HOST"; //$NON-NLS-1$
+ public static final String ATTR_PORT = GdbPlugin.PLUGIN_ID + ".PORT"; //$NON-NLS-1$
+ public static final String ATTR_DEV = GdbPlugin.PLUGIN_ID + ".DEV"; //$NON-NLS-1$
+ public static final String ATTR_DEV_SPEED = GdbPlugin.PLUGIN_ID + ".DEV_SPEED"; //$NON-NLS-1$
//
//
@@ -42,34 +40,34 @@ public class IGDBLaunchConfigurationConstants {
* Launch configuration attribute key. The value is the name of
* the Debuger associated with a C/C++ launch configuration.
*/
- public static final String ATTR_DEBUG_NAME = CDT_CONSTS_ID + ".DEBUG_NAME"; //$NON-NLS-1$
+ public static final String ATTR_DEBUG_NAME = GdbPlugin.PLUGIN_ID + ".DEBUG_NAME"; //$NON-NLS-1$
/**
* Launch configuration attribute key. Boolean value to set the gdb command file
* Debuger/gdb/MI property.
*/
- public static final String ATTR_GDB_INIT = CDT_CONSTS_ID + ".GDB_INIT"; //$NON-NLS-1$
+ public static final String ATTR_GDB_INIT = GdbPlugin.PLUGIN_ID + ".GDB_INIT"; //$NON-NLS-1$
/**
* Launch configuration attribute key. Boolean value to set the 'automatically load shared library symbols' flag of the debugger.
*/
- public static final String ATTR_DEBUGGER_AUTO_SOLIB = CDT_CONSTS_ID + ".AUTO_SOLIB"; //$NON-NLS-1$
+ public static final String ATTR_DEBUGGER_AUTO_SOLIB = GdbPlugin.PLUGIN_ID + ".AUTO_SOLIB"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. Boolean value to set the 'stop on shared library events' flag of the debugger.
+ */
+ public static final String ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS = GdbPlugin.PLUGIN_ID + ".STOP_ON_SOLIB_EVENTS"; //$NON-NLS-1$
-// /**
-// * Launch configuration attribute key. Boolean value to set the 'stop on shared library events' flag of the debugger.
-// */
-// public static final String ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS = CDT_CONSTS_ID + ".STOP_ON_SOLIB_EVENTS"; //$NON-NLS-1$
-//
/**
* Launch configuration attribute key. The value is a List (array of String) of directories for the search path of shared libraries.
*/
- public static final String ATTR_DEBUGGER_SOLIB_PATH = CDT_CONSTS_ID + ".SOLIB_PATH"; //$NON-NLS-1$
+ public static final String ATTR_DEBUGGER_SOLIB_PATH = GdbPlugin.PLUGIN_ID + ".SOLIB_PATH"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a List (array of String) of shared libraries to load symbols automatically.
+ */
+ public static final String ATTR_DEBUGGER_AUTO_SOLIB_LIST = GdbPlugin.PLUGIN_ID + ".AUTO_SOLIB_LIST"; //$NON-NLS-1$
-// /**
-// * Launch configuration attribute key. The value is a List (array of String) of shared libraries to load symbols automatically.
-// */
-// public static final String ATTR_DEBUGGER_AUTO_SOLIB_LIST = CDT_CONSTS_ID + ".AUTO_SOLIB_LIST"; //$NON-NLS-1$
-//
/**
* Launch configuration attribute value. The key is ATTR_DEBUG_NAME.
*/
@@ -85,26 +83,26 @@ public class IGDBLaunchConfigurationConstants {
*/
public static final boolean DEBUGGER_AUTO_SOLIB_DEFAULT = true;
-// /**
-// * Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS.
-// */
-// public static final boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
-//
+ /**
+ * Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS.
+ */
+ public static final boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
+
// /**
// * Launch configuration attribute key. The value is a string specifying the identifier of the command factory to use.
// */
-// public static final String ATTR_DEBUGGER_COMMAND_FACTORY = CDT_CONSTS_ID + ".commandFactory"; //$NON-NLS-1$
+// public static final String ATTR_DEBUGGER_COMMAND_FACTORY = GdbPlugin.PLUGIN_ID + ".commandFactory"; //$NON-NLS-1$
//
// /**
// * Launch configuration attribute key. The value is a string specifying the protocol to
// * use. For now only "mi", "mi1", "m2", "mi3" are supported.
// */
-// public static final String ATTR_DEBUGGER_PROTOCOL = CDT_CONSTS_ID + ".protocol"; //$NON-NLS-1$
+// public static final String ATTR_DEBUGGER_PROTOCOL = GdbPlugin.PLUGIN_ID + ".protocol"; //$NON-NLS-1$
//
// /**
// * Launch configuration attribute key. The value is a boolean specifying the mode of the gdb console.
// */
-// public static final String ATTR_DEBUGGER_VERBOSE_MODE = CDT_CONSTS_ID + ".verboseMode"; //$NON-NLS-1$
+// public static final String ATTR_DEBUGGER_VERBOSE_MODE = GdbPlugin.PLUGIN_ID + ".verboseMode"; //$NON-NLS-1$
//
// /**
// * Launch configuration attribute value. The key is ATTR_DEBUGGER_VERBOSE_MODE.
@@ -113,7 +111,7 @@ public class IGDBLaunchConfigurationConstants {
// /**
// * Launch configuration attribute key. The value is a boolean specifying is debugger should use full pathname to set breakpoints.
// */
-// public static final String ATTR_DEBUGGER_FULLPATH_BREAKPOINTS = CDT_CONSTS_ID + ".breakpointsFullPath"; //$NON-NLS-1$
+// public static final String ATTR_DEBUGGER_FULLPATH_BREAKPOINTS = GdbPlugin.PLUGIN_ID + ".breakpointsFullPath"; //$NON-NLS-1$
//
// /**
// * Launch configuration default attribute value. The key is ATTR_DEBUGGER_FULLPATH_BREAKPOINTS.
diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBDebugger.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBDebugger.java
new file mode 100644
index 00000000000..2f891e2a652
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBDebugger.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * Ericsson - Modified for DSF
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.provisional.launching;
+
+/* This class simply exists because the extension needs it.
+ * However, since we only use the extension to re-use some CDT code,
+ * we don't actually need this class to do anything.
+ */
+public class GDBDebugger {}
diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBServerDebugger.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBServerDebugger.java
new file mode 100644
index 00000000000..60559df1fde
--- /dev/null
+++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GDBServerDebugger.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * Ericsson - Modified for Ericsson
+ *******************************************************************************/
+package org.eclipse.dd.gdb.internal.provisional.launching;
+
+/* This class simply exists because the extension needs it.
+ * However, since we only use the extension to re-use some CDT code,
+ * we don't actually need this class to do anything.
+ */
+public class GDBServerDebugger {}