Examples of IJavaObject


Examples of org.eclipse.jdt.debug.core.IJavaObject

   * @exception DebugException
   *                if an exception is thrown accessing the given object
   */
  protected void initializeLocals(IJavaObject object) throws DebugException {
    IJavaVariable[] locals = null;
    IJavaObject thisObject = getThis();
    if (getStackFrame() != null) {
      locals = getStackFrame().getLocalVariables();
    }
    if (locals != null) {
      for (IJavaVariable local : locals) {
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

   * @return a new instance on the target, as an <code>IJavaValue</code>
   * @exception DebugException
   *                if creation fails
   */
  protected IJavaObject newInstance(String className) throws DebugException {
    IJavaObject object = null;
    IJavaClassType clazz = null;
    IJavaType[] types = getDebugTarget().getJavaTypes(className);
    if (types != null && types.length > 0) {
      clazz = (IJavaClassType) types[0];
    }
    if (clazz == null) {
      // The class is not loaded on the target VM.
      // Force the load of the class.
      types = getDebugTarget().getJavaTypes("java.lang.Class"); //$NON-NLS-1$
      IJavaClassType classClass = null;
      if (types != null && types.length > 0) {
        classClass = (IJavaClassType) types[0];
      }
      if (classClass == null) {
        // unable to load the class
        throw new DebugException(
            new Status(
                IStatus.ERROR,
                JDIDebugModel.getPluginIdentifier(),
                DebugException.REQUEST_FAILED,
                EvaluationMessages.LocalEvaluationEngine_Evaluation_failed___unable_to_instantiate_code_snippet_class__11,
                null));
      }
      IJavaValue[] args = new IJavaValue[] { getDebugTarget().newValue(
          className) };
      IJavaObject classObject = (IJavaObject) classClass
          .sendMessage(
              "forName", "(Ljava/lang/String;)Ljava/lang/Class;", args, getThread()); //$NON-NLS-2$ //$NON-NLS-1$
      object = (IJavaObject) classObject
          .sendMessage(
              "newInstance", "()Ljava/lang/Object;", null, getThread(), false); //$NON-NLS-2$ //$NON-NLS-1$
    } else {
      object = clazz.newInstance("<init>", null, getThread()); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

  protected void configureInstanceFilters(EventRequest request,
      JDIDebugTarget target) {
    if (fInstanceFilters != null && !fInstanceFilters.isEmpty()) {
      Iterator<IJavaObject> iter = fInstanceFilters.iterator();
      while (iter.hasNext()) {
        IJavaObject object = iter.next();
        if (object.getDebugTarget().equals(target)) {
          addInstanceFilter(request,
              ((JDIObjectValue) object).getUnderlyingObject());
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

    }

    // remove instance filters
    if (fInstanceFilters != null && !fInstanceFilters.isEmpty()) {
      for (int i = 0; i < fInstanceFilters.size(); i++) {
        IJavaObject object = fInstanceFilters.get(i);
        if (object.getDebugTarget().equals(target)) {
          fInstanceFilters.remove(i);
          changed = true;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

    IJavaValue value = popValue();
    if (value instanceof JDINullValue) {
      pushNewValue(false);
      return;
    }
    IJavaObject object = (IJavaObject) value;

    IJavaObject classObject = getClassObject(type);
    if (classObject == null) {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              JDIDebugPlugin.getUniqueIdentifier(),
              IStatus.OK,
              NLS.bind(InstructionsEvaluationMessages.InstanceOfOperator_No_class_object,
                      new String[] { type.getName() }),
              null));
    }
    push(classObject.sendMessage(IS_INSTANCE, IS_INSTANCE_SIGNATURE,
        new IJavaValue[] { object }, getContext().getThread(), false));
  }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

    if (value instanceof JDINullValue) {
      throw new CoreException(new Status(IStatus.ERROR,
          JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK,
          InstructionsEvaluationMessages.PushFieldVariable_0, null));
    }
    IJavaObject receiver = (IJavaObject) value;

    IJavaVariable field = null;

    if (fDeclaringTypeSignature == null) {
      field = ((JDIObjectValue) receiver).getField(fName,
          fSuperClassLevel);
    } else {
      field = receiver.getField(fName, fDeclaringTypeSignature);
    }

    if (field == null) {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              JDIDebugPlugin.getUniqueIdentifier(),
              IStatus.OK,
              NLS.bind(InstructionsEvaluationMessages.PushFieldVariable_Cannot_find_the_field__0__for_the_object__1__1,
                      new String[] { fName,
                          receiver.toString() }),
              null)); //
    }
    push(field);
  }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

   */
  private void releaseObjects() {
    if (fPermStorage != null) {
      Iterator<IJavaObject> iterator = fPermStorage.iterator();
      while (iterator.hasNext()) {
        IJavaObject object = iterator.next();
        try {
          object.enableCollection();
        } catch (CoreException e) {
          // don't worry about GC if the VM has terminated
          if ((e.getStatus().getException() instanceof VMDisconnectedException)) {
            break;
          }
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

  /**
   * @see IJavaStackFrame#getThis()
   */
  public IJavaObject getThis() throws DebugException {
    IJavaObject receiver = null;
    if (!isStatic()) {
      ObjectReference thisObject = getUnderlyingThisObject();
      if (thisObject != null) {
        receiver = (IJavaObject) JDIValue.createValue(
            (JDIDebugTarget) getDebugTarget(), thisObject);
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

  }

  @Override
  public void execute() throws CoreException {
    IRuntimeContext context = getContext();
    IJavaObject thisInstance = context.getThis();
    if (thisInstance == null) {
      // static context
      push(context.getReceivingType());
    } else {
      if (fEnclosingLevel != 0) {
View Full Code Here

Examples of org.eclipse.jdt.debug.core.IJavaObject

   */
  public IValue getLogicalStructure(IValue value) throws CoreException {
    if (!(value instanceof IJavaObject)) {
      return value;
    }
    IJavaObject javaValue = (IJavaObject) value;
    try {
      IJavaReferenceType type = getType(javaValue);
      if (type == null) {
        return value;
      }
      IJavaStackFrame stackFrame = getStackFrame(javaValue);
      if (stackFrame == null) {
        return value;
      }

      // find the project the snippets will be compiled in.
      ISourceLocator locator = javaValue.getLaunch().getSourceLocator();
      Object sourceElement = null;
      if (locator instanceof ISourceLookupDirector) {
        String[] sourcePaths = type.getSourcePaths(null);
        if (sourcePaths != null && sourcePaths.length > 0) {
          sourceElement = ((ISourceLookupDirector) locator)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.