Java 类com.intellij.util.SingleAlarm 实例源码

项目:intellij-ce-playground    文件:ActionMenu.java   
private UsabilityHelper(Component component, @NotNull Disposable disposable) {
  Disposer.register(disposable, this);
  myCallbackAlarm = new SingleAlarm(new Runnable() {
    @Override
    public void run() {
      Disposer.dispose(myCallbackAlarm);
      myCallbackAlarm = null;
      if (myEventToRedispatch != null) {
        IdeEventQueue.getInstance().dispatchEvent(myEventToRedispatch);
      }
    }
  }, 50, this);
  myComponent = component;
  PointerInfo info = MouseInfo.getPointerInfo();
  myLastMousePoint = info != null ? info.getLocation() : null;
  if (myLastMousePoint != null) {
    Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.COMPONENT_EVENT_MASK);
    IdeEventQueue.getInstance().addDispatcher(this, this);
  }
}
项目:intellij-ce-playground    文件:ThreadBlockedMonitor.java   
public ThreadBlockedMonitor(DebugProcessImpl process, Disposable disposable) {
  myProcess = process;
  myAlarm = new SingleAlarm(new Runnable() {
    @Override
    public void run() {
      checkBlockingThread();
    }
  }, 5000, Alarm.ThreadToUse.POOLED_THREAD, disposable);
}
项目:intellij-ce-playground    文件:XDebugView.java   
public XDebugView() {
  myClearAlarm = new SingleAlarm(new Runnable() {
    @Override
    public void run() {
      clear();
    }
  }, VIEW_CLEAR_DELAY, this);
}
项目:intellij-ce-playground    文件:DebugAttachDetector.java   
public DebugAttachDetector() {
  ApplicationEx app = ApplicationManagerEx.getApplicationEx();
  if (!app.isInternal()
      || app.isUnitTestMode()
      || app.isHeadlessEnvironment()
      || "true".equals(System.getProperty("idea.debug.mode"))) return;

  for (String argument : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
    if (argument.startsWith("-agentlib:jdwp") && argument.contains("transport=dt_socket")) {
      String[] params = argument.split(",");
      for (String param : params) {
        if (param.startsWith("address")) {
          try {
            String[] address = param.split("=")[1].split(":");
            if (address.length == 1) {
              myPort = Integer.parseInt(address[0]);
            }
            else {
              myHost = address[0];
              myPort = Integer.parseInt(address[1]);
            }
          }
          catch (Exception e) {
            LOG.error(e);
            return;
          }
          break;
        }
      }
      break;
    }
  }

  if (myPort < 0) return;

  myAlarm = new SingleAlarm(new Runnable() {
    @Override
    public void run() {
      boolean attached = !NetUtils.canConnectToRemoteSocket(myHost, myPort);
      if (!myReady) {
        myAttached = attached;
        myReady = true;
      }
      else if (attached != myAttached) {
        myAttached = attached;
        Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                                                  "Remote debugger",
                                                  myAttached ? "attached" : "detached",
                                                  NotificationType.WARNING));
      }
      myAlarm.request();
    }
  }, 5000, Alarm.ThreadToUse.POOLED_THREAD, null);
  myAlarm.request();
}
项目:consulo    文件:XDebugView.java   
public XDebugView() {
  myClearAlarm = new SingleAlarm(() -> clear(), VIEW_CLEAR_DELAY, this);
}