1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

add a method getChildreNumber to help the UI.

This commit is contained in:
Alain Magloire 2002-09-09 15:53:32 +00:00
parent 95f5a88e72
commit 3e24919f41
3 changed files with 23 additions and 3 deletions

View file

@ -32,6 +32,12 @@ public interface ICDIValue extends ICDIObject
* @throws CDIException if this method fails. Reasons include:
*/
String getValueString() throws CDIException;
/**
* Return the number of children.
* @return int children count
*/
int getChildrenNumber() throws CDIException;
/**
* @return true if value is a container like structure.

View file

@ -64,11 +64,19 @@ public class Value extends CObject implements ICDIValue {
}
return result;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
*/
public int getChildrenNumber() throws CDIException {
return variable.getMIVar().getNumChild();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
*/
public boolean hasChildren() throws CDIException {
/*
int number = 0;
MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory();
@ -85,7 +93,8 @@ public class Value extends CObject implements ICDIValue {
throw new CDIException(e.getMessage());
}
return (number > 0);
*/
return (getChildrenNumber() > 0);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()

View file

@ -76,7 +76,12 @@ public class MICommand extends Command
String command = getToken() + getOperation();
if (options != null && options.length > 0) {
for (int i = 0; i < options.length; i++) {
command += " " + options[i];
if (options[i].indexOf('\t') != -1 ||
options[i].indexOf(' ') != -1) {
command += " \"" + options[i] + "\"";
} else {
command += " " + options[i];
}
}
}
if (parameters != null && parameters.length > 0) {
@ -87,7 +92,7 @@ public class MICommand extends Command
// According to the MI documentation '-' is not permitted
//(parameters[i].indexOf('-') != -1 || parameters[i].indexof(\n)
if (parameters[i].indexOf('\t') != -1 ||
parameters[i].indexOf('\"') != -1||
parameters[i].indexOf('\"') != -1 ||
parameters[i].indexOf(' ') != -1) {
command += " \"" + parameters[i] + "\"";
} else {