public boolean evaluateCondition(EvaluationContextImpl context, LocatableEvent event)
     throws EvaluateException {
   if (CLASS_FILTERS_ENABLED) {
     String className = null;
     final ObjectReference thisObject = (ObjectReference) context.getThisObject();
     if (thisObject != null) {
       className = thisObject.referenceType().name();
     } else {
       final StackFrameProxyImpl frame = context.getFrameProxy();
       if (frame != null) {
         className = frame.location().declaringType().name();
       }
     }
     if (className != null) {
       boolean matches = false;
       for (ClassFilter classFilter : getClassFilters()) {
         if (classFilter.isEnabled() && classFilter.matches(className)) {
           matches = true;
           break;
         }
       }
       if (!matches) {
         return false;
       }
       for (ClassFilter classFilter : getClassExclusionFilters()) {
         if (classFilter.isEnabled() && classFilter.matches(className)) {
           return false;
         }
       }
     }
   }
   return super.evaluateCondition(context, event);
 }
 protected void superBuildVariables(
     final EvaluationContextImpl evaluationContext, XValueChildrenList children)
     throws EvaluateException {
   final StackFrameProxyImpl frame = getStackFrameProxy();
   for (final LocalVariableProxyImpl local : frame.visibleVariables()) {
     final LocalVariableDescriptorImpl descriptor =
         myNodeManager.getLocalVariableDescriptor(null, local);
     children.add(JavaValue.create(descriptor, evaluationContext, myNodeManager));
   }
 }
 protected EvaluationContextImpl createEvaluationContext(final SuspendContextImpl suspendContext) {
   try {
     StackFrameProxyImpl proxy = suspendContext.getFrameProxy();
     assertNotNull(proxy);
     return new EvaluationContextImpl(suspendContext, proxy, proxy.thisObject());
   } catch (EvaluateException e) {
     error(e);
     return null;
   }
 }
 protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event)
     throws EvaluateException {
   ThreadReferenceProxyImpl thread = context.getThread();
   if (thread != null) {
     StackFrameProxyImpl stackFrameProxy = thread.frame(0);
     if (stackFrameProxy != null) {
       return stackFrameProxy.thisObject();
     }
   }
   return null;
 }
  @Override
  public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException {
    boolean isVisible = myFrameProxy.isLocalVariableVisible(getLocalVariable());
    if (isVisible) {
      final String typeName = getLocalVariable().typeName();
      myTypeName = typeName;
      myIsPrimitive = DebuggerUtils.isPrimitiveType(typeName);
      return myFrameProxy.getValue(getLocalVariable());
    }

    return null;
  }
 @Override
 protected String calculateEventClass(EvaluationContextImpl context, LocatableEvent event)
     throws EvaluateException {
   String className = null;
   final ObjectReference thisObject = (ObjectReference) context.getThisObject();
   if (thisObject != null) {
     className = thisObject.referenceType().name();
   } else {
     final StackFrameProxyImpl frame = context.getFrameProxy();
     if (frame != null) {
       className = frame.location().declaringType().name();
     }
   }
   return className;
 }
 private static Map<String, LocalVariableProxyImpl> getVisibleVariables(
     final StackFrameProxyImpl frame) throws EvaluateException {
   final Map<String, LocalVariableProxyImpl> vars = new HashMap<String, LocalVariableProxyImpl>();
   for (LocalVariableProxyImpl localVariableProxy : frame.visibleVariables()) {
     vars.put(localVariableProxy.name(), localVariableProxy);
   }
   return vars;
 }
  public DebuggerContextImpl createDebuggerContext(
      final SuspendContextImpl suspendContext, StackFrameProxyImpl stackFrame) {
    final DebuggerSession[] session = new DebuggerSession[1];

    UIUtil.invokeAndWaitIfNeeded(
        new Runnable() {
          @Override
          public void run() {
            session[0] =
                DebuggerManagerEx.getInstanceEx(myProject)
                    .getSession(suspendContext.getDebugProcess());
          }
        });

    DebuggerContextImpl debuggerContext =
        DebuggerContextImpl.createDebuggerContext(
            session[0],
            suspendContext,
            stackFrame != null ? stackFrame.threadProxy() : null,
            stackFrame);
    debuggerContext.initCaches();
    return debuggerContext;
  }
Beispiel #9
0
    public void contextAction() throws Exception {
      final ThreadReferenceProxyImpl thread = myDebuggerContext.getThreadProxy();
      try {
        if (!getSuspendContext().getDebugProcess().getSuspendManager().isSuspended(thread)) {
          DebuggerInvocationUtil.swingInvokeLater(
              getProject(),
              new Runnable() {
                public void run() {
                  try {
                    myFramesListener.setEnabled(false);
                    synchronized (myFramesList) {
                      final DefaultListModel model = myFramesList.getModel();
                      model.clear();
                      model.addElement(
                          new Object() {
                            public String toString() {
                              return DebuggerBundle.message("frame.panel.frames.not.available");
                            }
                          });
                      myFramesList.setSelectedIndex(0);
                    }
                  } finally {
                    myFramesListener.setEnabled(true);
                  }
                }
              });

          return;
        }
      } catch (ObjectCollectedException e) {
        return;
      }

      List<StackFrameProxyImpl> frames;
      try {
        frames = thread.frames();
      } catch (EvaluateException e) {
        frames = Collections.emptyList();
      }

      final StackFrameProxyImpl contextFrame = myDebuggerContext.getFrameProxy();
      final EvaluationContextImpl evaluationContext = myDebuggerContext.createEvaluationContext();
      final DebuggerManagerThreadImpl managerThread =
          myDebuggerContext.getDebugProcess().getManagerThread();
      final MethodsTracker tracker = new MethodsTracker();
      final int totalFramesCount = frames.size();
      int index = 0;
      final long timestamp = System.nanoTime();
      for (StackFrameProxyImpl stackFrameProxy : frames) {
        managerThread.schedule(
            new AppendFrameCommand(
                getSuspendContext(),
                stackFrameProxy,
                evaluationContext,
                tracker,
                index++,
                stackFrameProxy.equals(contextFrame),
                totalFramesCount,
                timestamp));
      }
    }