mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 00:35:49 +02:00
Bug 52100 - Patch for Sergey - Remove the private/public children from the variables view.
This commit is contained in:
parent
317bdea60e
commit
03d085016c
1 changed files with 21 additions and 6 deletions
|
@ -10,6 +10,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
|
@ -79,11 +82,11 @@ import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo;
|
|||
/**
|
||||
*/
|
||||
public abstract class Variable extends VariableDescriptor implements ICDIVariable {
|
||||
|
||||
private static final ICDIVariable[] NO_CHILDREN = new ICDIVariable[0];
|
||||
protected MIVarCreate fVarCreateCMD;
|
||||
protected MIVar fMIVar;
|
||||
Value value;
|
||||
public ICDIVariable[] children = new ICDIVariable[0];
|
||||
public ICDIVariable[] children = NO_CHILDREN;
|
||||
String editable = null;
|
||||
String language;
|
||||
boolean isFake = false;
|
||||
|
@ -243,6 +246,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
* allow the override of the timeout.
|
||||
*/
|
||||
public ICDIVariable[] getChildren(int timeout) throws CDIException {
|
||||
children = NO_CHILDREN;
|
||||
MISession mi = ((Target)getTarget()).getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIVarListChildren var = factory.createMIVarListChildren(getMIVar().getVarName());
|
||||
|
@ -257,9 +261,10 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
MIVar[] vars = info.getMIVars();
|
||||
children = new Variable[vars.length];
|
||||
List childrenList = new ArrayList(vars.length);
|
||||
// children = new Variable[vars.length];
|
||||
// For C++ in GDB the children of the
|
||||
// the struture are the scope and the inherited classes.
|
||||
// the structure are the scope and the inherited classes.
|
||||
// For example:
|
||||
// class foo: public bar {
|
||||
// int x;
|
||||
|
@ -279,7 +284,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
boolean container = isStructureProvider(t);
|
||||
for (int i = 0; i < vars.length; i++) {
|
||||
String prefix = "(" + getFullName() + ")"; // parent qualified name
|
||||
String childName = vars[i].getExp(); // chield simple name
|
||||
String childName = vars[i].getExp(); // child simple name
|
||||
String childFullName = prefix + "." + childName; // fallback full name
|
||||
ICDIType childType = null;
|
||||
boolean childFake = false;
|
||||
|
@ -322,8 +327,18 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
v.fType = childType;
|
||||
}
|
||||
v.setIsFake(childFake);
|
||||
children[i] = v;
|
||||
if (childFake && isAccessQualifier(childName)) {
|
||||
// Replace a fake variable representing an access qualifier with its children.
|
||||
ICDIVariable[] grandchildren = v.getChildren(timeout);
|
||||
for (int j = 0; j < grandchildren.length; j++) {
|
||||
childrenList.add(grandchildren[j]);
|
||||
}
|
||||
} else {
|
||||
childrenList.add(v);
|
||||
}
|
||||
}
|
||||
if (!childrenList.isEmpty())
|
||||
children = (ICDIVariable[]) childrenList.toArray(new Variable[childrenList.size()]);
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue