Пример #1
0
  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);
  }
Пример #2
0
  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;
  }
Пример #3
0
 /** @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;
   }
 }
Пример #4
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();
    }
  }