當前位置: 首頁>>代碼示例>>Java>>正文


Java LocatableEventRequestor類代碼示例

本文整理匯總了Java中com.intellij.debugger.engine.requests.LocatableEventRequestor的典型用法代碼示例。如果您正苦於以下問題:Java LocatableEventRequestor類的具體用法?Java LocatableEventRequestor怎麽用?Java LocatableEventRequestor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocatableEventRequestor類屬於com.intellij.debugger.engine.requests包,在下文中一共展示了LocatableEventRequestor類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processLocatableEvent

import com.intellij.debugger.engine.requests.LocatableEventRequestor; //導入依賴的package包/類
private void processLocatableEvent(final SuspendContextImpl suspendContext, final LocatableEvent event) {
  if (myReturnValueWatcher != null && event instanceof MethodExitEvent) {
    if (myReturnValueWatcher.processMethodExitEvent(((MethodExitEvent)event))) {
      return;
    }
  }

  ThreadReference thread = event.thread();
  //LOG.assertTrue(thread.isSuspended());
  preprocessEvent(suspendContext, thread);

  //we use schedule to allow processing other events during processing this one
  //this is especially nesessary if a method is breakpoint condition
  getManagerThread().schedule(new SuspendContextCommandImpl(suspendContext) {
    public void contextAction() throws Exception {
      final SuspendManager suspendManager = getSuspendManager();
      SuspendContextImpl evaluatingContext = SuspendManagerUtil.getEvaluatingContext(suspendManager, getSuspendContext().getThread());

      if (evaluatingContext != null && !enableBreakpointsDuringEvaluation()) {
        // is inside evaluation, so ignore any breakpoints
        suspendManager.voteResume(suspendContext);
        return;
      }

      final LocatableEventRequestor requestor = (LocatableEventRequestor) getRequestsManager().findRequestor(event.request());

      boolean resumePreferred = requestor != null && DebuggerSettings.SUSPEND_NONE.equals(requestor.getSuspendPolicy());
      boolean requestHit = false;
      try {
        requestHit = (requestor != null) && requestor.processLocatableEvent(this, event);
      }
      catch (final LocatableEventRequestor.EventProcessingException ex) {
        if (LOG.isDebugEnabled()) {
          LOG.debug(ex.getMessage());
        }
        final boolean[] considerRequestHit = new boolean[]{true};
        DebuggerInvocationUtil.invokeAndWait(getProject(), new Runnable() {
          public void run() {
            DebuggerPanelsManager.getInstance(getProject()).toFront(mySession);
            final String displayName = requestor instanceof Breakpoint? ((Breakpoint)requestor).getDisplayName() : requestor.getClass().getSimpleName();
            final String message = DebuggerBundle.message("error.evaluating.breakpoint.condition.or.action", displayName, ex.getMessage());
            considerRequestHit[0] = Messages.showYesNoDialog(getProject(), message, ex.getTitle(), Messages.getQuestionIcon()) == 0;
          }
        }, ModalityState.NON_MODAL);
        requestHit = considerRequestHit[0];
        resumePreferred = !requestHit;
      }

      if (requestHit && requestor instanceof Breakpoint) {
        // if requestor is a breakpoint and this breakpoint was hit, no matter its suspend policy
        myBreakpointManager.processBreakpointHit((Breakpoint)requestor);
      }

      if(!requestHit || resumePreferred) {
        suspendManager.voteResume(suspendContext);
      }
      else {
        if (myReturnValueWatcher != null) {
          myReturnValueWatcher.disable();
        }
        //if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
        //  // there could be explicit resume as a result of call to voteSuspend()
        //  // e.g. when breakpoint was considered invalid, in that case the filter will be applied _after_
        //  // resuming and all breakpoints in other threads will be ignored.
        //  // As resume() implicitly cleares the filter, the filter must be always applied _before_ any resume() action happens
        //  myBreakpointManager.applyThreadFilter(DebugProcessEvents.this, event.thread());
        //}
        suspendManager.voteSuspend(suspendContext);
        showStatusText(DebugProcessEvents.this, event);
      }
    }
  });
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:74,代碼來源:DebugProcessEvents.java


注:本文中的com.intellij.debugger.engine.requests.LocatableEventRequestor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。