protected List<FeatureFieldDescription> getFieldDescriptors() { if (interpreterValue == null || interpreterValue.getValue() == null) { return Collections.emptyList(); } MetamodelManager manager = ((MitraDebugTarget) getDebugTarget()).getMetamodelManager(); IMetamodel metamodel = manager.getMetamodel(interpreterValue.getActualType()); return metamodel.getAllFeatureFieldsDescriptions(interpreterValue.getActualType(), true, false); }
/** @see org.eclipse.debug.core.model.IValue#hasVariables() */ @Override public boolean hasVariables() throws DebugException { if (interpreterValue.getValue() == null) { return false; } if (interpreterValue.getActualType() instanceof CollectionType) { return !((MitraCollection) interpreterValue.getValue()).isEmpty(); } else { return getFieldDescriptors().size() > 0; } }
/** @see org.eclipse.debug.core.model.IValue#getVariables() */ @Override public IVariable[] getVariables() throws DebugException { if (interpreterValue.getValue() == null) { return null; } if (interpreterValue.getActualType() instanceof CollectionType) { return getElements(); } else { return getFields(); } }
/** @see org.eclipse.debug.core.model.IValue#getValueString() */ @Override public String getValueString() throws DebugException { if (interpreterValue != null) { return interpreterValue.toString(true); } return value; }
protected IVariable[] getFields() throws DebugException { List<FeatureFieldDescription> features = getFieldDescriptors(); if (features.size() == 0) { return null; } IVariable[] variables = new IVariable[features.size()]; MitraStackFrame stackFrame = variable.getStackFrame(); MetamodelManager manager = ((MitraDebugTarget) getDebugTarget()).getMetamodelManager(); PseudoFeatureAccessPath<MObject> path; Type actualType = interpreterValue.getActualType(); for (int i = 0; i < variables.length; i++) { FeatureFieldDescription featureDescription = features.get(i); path = new PseudoFeatureAccessPath<MObject>(actualType); path.add(new FeaturePathItem<MObject>(null, featureDescription)); String strName = featureDescription.getName(); MObject value = manager.getFeature(interpreterValue, path); MitraVariable mitraVariable = new MitraVariable(stackFrame, strName); MitraValue mitraValue = new MitraValue((MitraDebugTarget) getDebugTarget(), mitraVariable, value); mitraVariable.setValue(mitraValue); variables[i] = mitraVariable; } return variables; }
public MitraValue(MitraDebugTarget target, MitraVariable var, MObject interpreterValue) { super(target); String valueString = "not initialized"; if (interpreterValue != null) { Object valObject = interpreterValue.getValue(); if (valObject != null) { valueString = valObject.toString(); } } variable = var; value = valueString; this.interpreterValue = interpreterValue; }
protected IVariable[] getElements() throws DebugException { MitraStackFrame stackFrame = variable.getStackFrame(); MitraCollection oclCollection = (MitraCollection) interpreterValue.getValue(); IVariable[] variables = new IVariable[oclCollection.size()]; int index = 0; for (MObject element : oclCollection) { String name = "[" + index + "]"; MitraVariable mitraVariable = new MitraVariable(stackFrame, name); MitraValue mitraValue = new MitraValue((MitraDebugTarget) getDebugTarget(), mitraVariable, element); mitraVariable.setValue(mitraValue); variables[index] = mitraVariable; index++; } return variables; }