/** * 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()); }
/** * 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(); }