Examples of IJavaStackFrame


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

        try {
            IJavaType type = javaValue.getJavaType();
            if (!(type instanceof IJavaClassType)) {
                return null;
            }
            IJavaStackFrame stackFrame = getStackFrame(javaValue);
            if (stackFrame == null) {
                return null;
            }

            // find the project the snippets will be compiled in.
            ISourceLocator locator = javaValue.getLaunch().getSourceLocator();
            Object sourceElement = null;
            if (locator instanceof ISourceLookupDirector) {
                if (type instanceof JDIReferenceType) {
                    String[] sourcePaths = ((JDIReferenceType) type)
                            .getSourcePaths(null);
                    if (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 null;
            }

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

            EvaluationBlock evaluationBlock = new EvaluationBlock(javaValue,
                    (IJavaReferenceType) type, (IJavaThread) stackFrame.getThread(),
                    evaluationEngine);
            return evaluationBlock.evaluate(expression);

        } catch (CoreException e) {
            DroolsIDEPlugin.log(e);
View Full Code Here

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

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

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

    public void setShowLogicalStructure(boolean showLogical) {
        this.showLogical = showLogical;
    }

    protected void setViewerInput(IStructuredSelection ssel) {
        IJavaStackFrame frame = null;
        IVariable variable = null;
        if (ssel.size() == 1) {
            Object input = ssel.getFirstElement();
            if (input instanceof IJavaStackFrame) {
                frame = (IJavaStackFrame) input;
            } else if (input instanceof IVariable) {
                variable = (IVariable) input;
            }
        }

        getDetailViewer().setEditable(frame != null || variable != null);

        Object current = getViewer().getInput();
       
        // if the debug view stack still contains the same WorkingMemoryImpl, do nothing
        if (current != null) {
            ISelection stackSelection = getSite().getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
            if (stackSelection instanceof IStructuredSelection) {
                Object stack = ((IStructuredSelection) stackSelection).getFirstElement();
                if (stack instanceof IJavaStackFrame) {
                    try {
                        IJavaObject stackObj = ((IJavaStackFrame) stack).getThis();
                        if (current.equals(stackObj)) {
                            return;
                        }
                    } catch (Throwable t) {
                        // do nothing
                    }
                }
            }
        }

        if (current == null && frame == null && variable == null) {
            return;
        }

        if (current != null) {
            try {
                if ((frame != null && current.equals(frame.getThis()))
                        || (variable != null && current.equals(variable.getValue()))) {
                    return;
                }
            } catch (Throwable t) {
                // do nothing
            }
        }

        if (current != null) {
            fLastState = getViewerState();
            fSelectionStates.put(current, fLastState);
        }

        if (frame != null) {
            setDebugModel(frame.getModelIdentifier());
        } else if (variable != null) {
            setDebugModel(variable.getModelIdentifier());
        }

        showViewer();
       
        Object input = null;
        if (frame != null) {
            try {
                IJavaObject stackObj = frame.getThis();
                if ((stackObj != null)
                        && (stackObj.getJavaType() != null)
                        && ("org.drools.reteoo.WorkingMemoryImpl".equals(
                            stackObj.getJavaType().getName()))) {
                    input = stackObj;
View Full Code Here

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

        try {
            IJavaType type = javaValue.getJavaType();
            if (!(type instanceof IJavaClassType)) {
                return null;
            }
            IJavaStackFrame stackFrame = getStackFrame(javaValue);
            if (stackFrame == null) {
                return null;
            }

            // find the project the snippets will be compiled in.
            ISourceLocator locator= javaValue.getLaunch().getSourceLocator();
            Object sourceElement= null;
            if (locator instanceof ISourceLookupDirector) {
                String[] sourcePaths = ((IJavaClassType) 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) {
                    Object newSourceElement = ((IAdaptable) sourceElement).getAdapter(IJavaElement.class);
                    // if the source is a drl during the execution of the rule
                    if (newSourceElement != null) {
                        sourceElement = newSourceElement;
                    }
                }
            }
            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 null;
            }

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

            EvaluationBlock evaluationBlock = new EvaluationBlock(javaValue,
                    (IJavaReferenceType) type, (IJavaThread) stackFrame.getThread(),
                    evaluationEngine);
            return evaluationBlock.evaluate(expression);

        } catch (CoreException e) {
            DroolsEclipsePlugin.log(e);
View Full Code Here

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

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

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

    throws DebugException
  {
    StringBuilder result = new StringBuilder();
    result.append(STACK_FRAME_PREFIX);

    IJavaStackFrame frame = (IJavaStackFrame) stackFrame.getAdapter(
        IJavaStackFrame.class);
    if (frame != null) {
      String dec = frame.getDeclaringTypeName();

      if (frame.isObsolete()) {
        result.append(dec);
        result.append('>');
        return result.toString();
      }

      boolean javaStratum = true;
      javaStratum = frame.getReferenceType().getDefaultStratum().equals("Java");

      if (javaStratum) {
        // receiver name
        String rec = frame.getReceivingTypeName();
        result.append(ViewUtils.getQualifiedName(rec));

        // append declaring type name if different
        if (!dec.equals(rec)) {
          result.append('(');
          result.append(ViewUtils.getQualifiedName(dec));
          result.append(')');
        }
        // append a dot separator and method name
        result.append('.');
        result.append(frame.getMethodName());
        List<String> args = frame.getArgumentTypeNames();
        if (args.isEmpty()) {
          result.append("()");
        } else {
          result.append('(');
          Iterator<String> iter = args.iterator();
          while (iter.hasNext()) {
            result.append(ViewUtils.getQualifiedName(iter.next()));
            if (iter.hasNext()) {
              result.append(", ");
            } else if (frame.isVarArgs()) {
              result.replace(result.length() - 2, result.length(), "...");
            }
          }
          result.append(')');
        }
      } else {
        result.append(frame.getSourcePath());
      }

      int lineNumber = frame.getLineNumber();
      result.append(' ');
      result.append(' ');
      if (lineNumber >= 0) {
        result.append(lineNumber);
      } else {
        if (frame.isNative()) {
          result.append(' ');
        }
      }

      if (!frame.wereLocalsAvailable()) {
        result.append(' ');
      }

      return result.toString();
View Full Code Here

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

    if (kind == DebugEvent.SUSPEND) {
      if ((detail == DebugEvent.STEP_END) ||
          (detail == DebugEvent.BREAKPOINT))
      {
        IJavaStackFrame topStackFrame = (IJavaStackFrame) thread.getTopStackFrame();
        String fileName = getFileNameInFrame(ctx, topStackFrame);
        int lineNum = topStackFrame.getLineNumber();

        if (logger.isDebugEnabled()) {
          if (detail == DebugEvent.BREAKPOINT) {
            logger.debug("Breakpoint hit: " + fileName + " at " + lineNum);
          }
View Full Code Here

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

        try {
            IJavaType type = javaValue.getJavaType();
            if (!(type instanceof IJavaClassType)) {
                return null;
            }
            IJavaStackFrame stackFrame = getStackFrame(javaValue);
            if (stackFrame == null) {
                return null;
            }

            // find the project the snippets will be compiled in.
            ISourceLocator locator= javaValue.getLaunch().getSourceLocator();
            Object sourceElement= null;
            if (locator instanceof ISourceLookupDirector) {
                String[] sourcePaths = ((IJavaClassType) 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) {
                    Object newSourceElement = ((IAdaptable) sourceElement).getAdapter(IJavaElement.class);
                    // if the source is a drl during the execution of the rule
                    if (newSourceElement != null) {
                        sourceElement = newSourceElement;
                    }
                }
            }
            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 null;
            }

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

            EvaluationBlock evaluationBlock = new EvaluationBlock(javaValue,
                    (IJavaReferenceType) type, (IJavaThread) stackFrame.getThread(),
                    evaluationEngine);
            return evaluationBlock.evaluate(expression);

        } catch (CoreException e) {
            throw new RuntimeException("Could not evaluate expression", e);
View Full Code Here

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

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

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

        if (condition == null) {
          return SUSPEND;
        }
        EvaluationListener listener = new EvaluationListener(
            lineBreakpoint);
        IJavaStackFrame frame = (IJavaStackFrame) thread
            .getTopStackFrame();
        IJavaProject project = lineBreakpoint.getJavaProject(frame);
        if (project == null) {
          fireConditionHasErrors(
              lineBreakpoint,
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.