Java Code Examples for com.intellij.util.Alarm#ThreadToUse

The following examples show how to use com.intellij.util.Alarm#ThreadToUse . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MergingUpdateQueue.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @param name                   name of this queue, used only for debugging purposes
 * @param mergingTimeSpan        time (in milliseconds) for which execution of tasks will be postponed
 * @param isActive               if {@code true} the queue will execute tasks otherwise it'll just collect them and execute only after {@link #activate()} is called
 * @param modalityStateComponent makes sense only if {@code thread} is {@linkplain Alarm.ThreadToUse#SWING_THREAD SWING_THREAD}, in that
 *                               case the tasks will be processed in {@link ModalityState} corresponding the given component
 * @param parent                 if not {@code null} the queue will be disposed when the given parent is disposed
 * @param activationComponent    if not {@code null} the tasks will be processing only when the given component is showing
 * @param thread                 specifies on which thread the tasks are executed
 */
public MergingUpdateQueue(@NonNls @Nonnull String name,
                          int mergingTimeSpan,
                          boolean isActive,
                          @Nullable JComponent modalityStateComponent,
                          @Nullable Disposable parent,
                          @Nullable JComponent activationComponent,
                          @Nonnull Alarm.ThreadToUse thread) {
  myMergingTimeSpan = mergingTimeSpan;
  myModalityStateComponent = modalityStateComponent;
  myName = name;
  Application app = ApplicationManager.getApplication();
  myPassThrough = app == null || app.isUnitTestMode();
  myExecuteInDispatchThread = thread == Alarm.ThreadToUse.SWING_THREAD;

  if (parent != null) {
    Disposer.register(parent, this);
  }

  myWaiterForMerge = createAlarm(thread, myExecuteInDispatchThread ? null : this);

  if (isActive) {
    showNotify();
  }

  if (activationComponent != null) {
    setActivationComponent(activationComponent);
  }
}
 
Example 2
Source File: DialogWrapper.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
protected Alarm.ThreadToUse getValidationThreadToUse() {
  return Alarm.ThreadToUse.SWING_THREAD;
}
 
Example 3
Source File: MergingUpdateQueue.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static Alarm createAlarm(@Nonnull Alarm.ThreadToUse thread, @Nullable Disposable parent) {
  return parent == null ? new Alarm(thread) : new Alarm(thread, parent);
}
 
Example 4
Source File: ZipperUpdater.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ZipperUpdater(final int delay, final Alarm.ThreadToUse threadToUse, @Nonnull Disposable parentDisposable) {
  myDelay = delay;
  myThreadToUse = threadToUse;
  myIsEmpty = true;
  myAlarm = new Alarm(threadToUse, parentDisposable);
}