示例#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
  /**
   * Removes this object from the object bench. This will also remove it from the view of the object
   * bench. Once the object is removed from the bench it will not be available again.
   *
   * @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 removeFromBench() throws ProjectNotOpenException, PackageNotFoundException {
    Package aPackage = wrapperId.getBluejPackage();
    PkgMgrFrame aFrame = wrapperId.getPackageFrame();

    ObjectBench aBench = aFrame.getObjectBench();
    aBench.removeObject(objectWrapper, aPackage.getId());

    objectWrapper = null;
  }
示例#3
0
  /**
   * Returns the package this object belongs to.
   *
   * @return The package value
   * @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 BPackage getPackage() throws ProjectNotOpenException, PackageNotFoundException {
    Package bluejPkg = wrapperId.getBluejPackage();

    return bluejPkg.getBPackage();
  }