Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-patch] CDT Head patch: Shared Library path editor.

Why didn't you use the existing GDBSolibBlock or SolibSearchPathBlock
classes?
I think it would be better to make the GDB Server page look like all other
pages.

----- Original Message -----
From: "Ashish Karkare" <ashish.karkare@xxxxxxxxxxx>
To: <cdt-patch@xxxxxxxxxxx>
Sent: Friday, November 14, 2003 1:03 PM
Subject: [cdt-patch] CDT Head patch: Shared Library path editor.


> Hello,
>
> The current (CDT 1.2 and HEAD) implementation of
> GDBServerDebuggerPage doesn't allow the user to add
> shared library paths to the launch configuration.
> (There is an incomplete implementation that is commented out.)
>
> Please find attached a proposed patch that provides a simple,
> working implementation of a shared library path editor.  The
> patch adds a PathEditor to GDBServerDebuggerPage.
>
> The patch is cumulative to the serial line patch that I
> submitted earlier.
>
> Regards,
>
> Ashish
> TimeSys Corporation
>


----------------------------------------------------------------------------
----


> --- ./merge/latest/GDBServerDebuggerPage.java 2003-11-13
15:15:14.000000000 -0500
> +++ ./merge/outbound/GDBServerDebuggerPage.java 2003-11-13
15:17:15.000000000 -0500
> @@ -11,6 +11,9 @@
>
>  package org.eclipse.cdt.debug.mi.internal.ui;
>
> +import java.util.ArrayList;
> +import java.util.List;
> +
>  import
org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
>  import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
>  import org.eclipse.core.runtime.CoreException;
> @@ -40,6 +43,8 @@
>   protected Text fAsyncDev;
>   protected Combo fAsyncDevSpeedCombo;
>   private Button fAutoSoLibButton;
> +
> + private SharedLibPathDialog solibPath;
>
>   public void createControl(Composite parent) {
>   Composite comp = new Composite(parent, SWT.NONE);
> @@ -165,6 +170,11 @@
>   gd = new GridData();
>   gd.horizontalSpan = 2;
>   fAutoSoLibButton.setLayoutData(gd);
> +
> + solibPath = new SharedLibPathDialog("Shared library search paths:",
"Shared library directory:",comp);
> +
> +
> +
>  /*
>   ListEditor listEditor = new ListEditor("1", "Shared library search
paths:", comp) {
>   protected String createList(String[] items) {
> @@ -299,6 +309,11 @@
>   hostPort =
configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_POR
T, "");
>   asyncDev =
configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV
, "");
>   asyncDevSpeed =
configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV
_SPEED, "");
> + List p =
configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_SOL
IB_PATH, new ArrayList(1));
> + if (p.size() > 0) {
> + solibPath.initializePathFromList(p);
> + }
> +
>   } catch (CoreException e) {
>   }
>   fDebuggerCommandText.setText(debuggerCommand);
> @@ -332,6 +347,9 @@
>
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_POR
T, hostPort);
>
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV
, asyncDev);
>
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV
_SPEED, asyncDevSpeed);
> +
> +
> +
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_SOL
IB_PATH, solibPath.pathToArrayList());
>   }
>
>   public String getName() {
>


----------------------------------------------------------------------------
----


> --- ./merge/latest/SharedLibPathDialog.java 1969-12-31
19:00:00.000000000 -0500
> +++ ./merge/outbound/SharedLibPathDialog.java 2003-11-14
14:14:40.000000000 -0500
> @@ -0,0 +1,69 @@
>
+/**************************************************************************
*****
> + * Copyright (c) 2000, 2003 IBM Corporation and others.
> + * Copyright (c) 2003, TimeSys Corporation
> + *
> + * All rights reserved. This program and the accompanying materials
> + * are made available under the terms of the Common Public License v1.0
> + * which accompanies this distribution, and is available at
> + * http://www.eclipse.org/legal/cpl-v10.html
> + *
> + * Contributors:
> + *     TimeSys Corporation - initial API and implementation
> + */
> +package org.eclipse.cdt.debug.mi.internal.ui;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +import org.eclipse.jface.preference.PathEditor;
> +import org.eclipse.jface.preference.PreferenceStore;
> +import org.eclipse.swt.widgets.Composite;
> +
> +/**
> + * @author TimeSys Corporation.
> + * * (c) Copyright TimeSys Corporation. 2003.
> + * All Rights Reserved.
> +*/
> +
> +
> +class SharedLibPathDialog extends PathEditor {
> + private  PreferenceStore pStore;
> + private static final String id="1";
> +
> + public SharedLibPathDialog (String title, String label, Composite c) {
> + super (id, title, label, c);
> + pStore = new PreferenceStore();
> + setPreferenceStore(pStore);
> + }
> +
> + // Convenience method for parsing the path string in a platform specific
way and returning the result as an array list.
> + private ArrayList convertStringToArrayList (String s) {
> + String [] sa = parseString(s);
> + ArrayList al = new ArrayList(Arrays.asList(sa));
> + return  al;
> + }
> +
> + // Inverse of the above operation
> + private  String convertListToString(List p) {
> + String[] paths = (String[])p.toArray(new String[0]);
> + String s = createList( paths);
> + return s;
> + }
> +
> + public ArrayList pathToArrayList () {
> + store();
> +
> + String s = pStore.getString(id);
> + ArrayList al = convertStringToArrayList(s);
> + return al;
> +
> + }
> + public void initializePathFromList(List p) {
> +
> + String s = convertListToString(p);
> + pStore.setValue(id,s);
> + loadDefault();  //Clear list.
> + load();// Load current values.
> + }
> +}
> +
>



Back to the top