Package org.eclipse.jdt.debug.core

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


  public IJavaVariable findVariable(String varName) throws DebugException {
    if (isSuspended()) {
      try {
        IStackFrame[] stackFrames = getStackFrames();
        for (IStackFrame stackFrame : stackFrames) {
          IJavaStackFrame sf = (IJavaStackFrame) stackFrame;
          IJavaVariable var = sf.findVariable(varName);
          if (var != null) {
            return var;
          }
        }
      } catch (DebugException e) {
View Full Code Here


   */
  public boolean test(Object receiver, String property, Object[] args,
      Object expectedValue) {
    if (property.equals("isMultiStrata")) { //$NON-NLS-1$
      if (receiver instanceof IStackFrame) {
        IJavaStackFrame frame = (IJavaStackFrame) ((IStackFrame) receiver)
            .getAdapter(IJavaStackFrame.class);
        if (frame != null) {
          try {
            return frame.getReferenceType().getAvailableStrata().length > 1;
          } catch (DebugException e) {
          }
        }
      }
    }
View Full Code Here

  public static String getSourceName(Object object) throws CoreException {
    if (object instanceof String) {
      // assume it's a file name
      return (String) object;
    }
    IJavaStackFrame frame = null;
    if (object instanceof IAdaptable) {
      frame = (IJavaStackFrame) ((IAdaptable) object)
          .getAdapter(IJavaStackFrame.class);
    }
    String typeName = null;
    try {
      if (frame != null) {
        if (frame.isObsolete()) {
          return null;
        }
        String sourceName = frame.getSourcePath();
        // TODO: this may break fix to bug 21518
        if (sourceName == null) {
          // no debug attributes, guess at source name
          typeName = frame.getDeclaringTypeName();
        } else {
          return sourceName;
        }
      } else {
        if (object instanceof IJavaValue) {
View Full Code Here

    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)
              .getSourceElement(sourcePaths[0]);
        }
        if (!(sourceElement instanceof IJavaElement)
            && sourceElement instanceof IAdaptable) {
          sourceElement = ((IAdaptable) sourceElement)
              .getAdapter(IJavaElement.class);
        }
      }
      if (sourceElement == null) {
        sourceElement = locator.getSourceElement(stackFrame);
        if (!(sourceElement instanceof IJavaElement)
            && sourceElement instanceof IAdaptable) {
          sourceElement = ((IAdaptable) sourceElement)
              .getAdapter(IJavaElement.class);
        }
      }
      IJavaProject project = null;
      if (sourceElement instanceof IJavaElement) {
        project = ((IJavaElement) sourceElement).getJavaProject();
      } else if (sourceElement instanceof IResource) {
        IJavaProject resourceProject = JavaCore
            .create(((IResource) sourceElement).getProject());
        if (resourceProject.exists()) {
          project = resourceProject;
        }
      }
      if (project == null) {
        return value;
      }

      IAstEvaluationEngine evaluationEngine = JDIDebugPlugin.getDefault()
          .getEvaluationEngine(project,
              (IJavaDebugTarget) stackFrame.getDebugTarget());

      EvaluationBlock evaluationBlock = new EvaluationBlock(javaValue,
          type, (IJavaThread) stackFrame.getThread(),
          evaluationEngine);
      if (fValue == null) {
        // evaluate each variable
        IJavaVariable[] variables = new IJavaVariable[fVariables.length];
        for (int i = 0; i < fVariables.length; i++) {
View Full Code Here

   * @throws CoreException
   */
  private IJavaStackFrame getStackFrame(IValue value) throws CoreException {
    IStatusHandler handler = getStackFrameProvider();
    if (handler != null) {
      IJavaStackFrame stackFrame = (IJavaStackFrame) handler
          .handleStatus(JDIDebugPlugin.STATUS_GET_EVALUATION_FRAME,
              value);
      if (stackFrame != null) {
        return stackFrame;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.debug.core.IJavaStackFrame

Copyright © 2018 www.massapicom. 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.