示例#1
0
  /**
   * Adds this object on the object bench. If you pass null as instanceName the object will have a
   * predefined name. If the object is not a valid one nothing will happen.
   *
   * @param instanceName The name you want this object to have on the bench.
   * @throws ProjectNotOpenException if the project to which this object belongs has been closed by
   *     the user.
   * @throws PackageNotFoundException if the package to which this object belongs has been deleted
   *     by the user.
   */
  public void addToBench(String instanceName)
      throws ProjectNotOpenException, PackageNotFoundException {
    if (objectWrapper == null) {
      return;
    }

    // Not rational to add a null object, is it ?
    if (objectWrapper.getObject().isNullObject()) {
      return;
    }

    // If you want you may set the instance name here. Otherwise accept default
    if (instanceName != null) {
      objectWrapper.setName(instanceName);
    }

    // This should really always exists, no need to check
    Package aPackage = wrapperId.getBluejPackage();
    PkgMgrFrame aFrame = wrapperId.getPackageFrame();

    ObjectBench aBench = aFrame.getObjectBench();
    aBench.addObject(objectWrapper);

    // load the object into runtime scope
    aPackage
        .getDebugger()
        .addObject(aPackage.getId(), objectWrapper.getName(), objectWrapper.getObject());
  }
示例#2
0
  /**
   * Constructor for BObject.
   *
   * @param aWrapper Description of the Parameter
   */
  BObject(ObjectWrapper aWrapper) {
    objectWrapper = aWrapper;

    Package bluejPkg = objectWrapper.getPackage();
    Project bluejProj = bluejPkg.getProject();

    // It really seems that the translation between Java naming and Class is needed.
    // Also tryng to get the Class instead of just the name is a mess...
    String className = transJavaToClass(objectWrapper.getClassName());

    wrapperId = new Identifier(bluejProj, bluejPkg, className);
  }
示例#3
0
  /**
   * Return the name of this object on the object bench.
   *
   * @return The instance name if the object can be put into bench, null othervise
   */
  public String getInstanceName() {
    if (objectWrapper == null) {
      return null;
    }

    return objectWrapper.getName();
  }
示例#4
0
  /**
   * Returns a string representation of the Object
   *
   * @return Description of the Return Value
   */
  public String toString() {
    String className = "";
    if (objectWrapper != null) {
      className = objectWrapper.getClassName();
    }

    return "BObject instanceName=" + getInstanceName() + " Class Name=" + className;
  }
示例#5
0
  /**
   * Used by BField to get hold of the real Object
   *
   * @return The objectReference value
   */
  ObjectReference getObjectReference() {
    if (objectWrapper == null) {
      return null;
    }
    DebuggerObject obj = objectWrapper.getObject();

    if (obj == null) {
      return null;
    }
    return obj.getObjectReference();
  }