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


Java Application.assertIsDispatchThread方法代碼示例

本文整理匯總了Java中com.intellij.openapi.application.Application.assertIsDispatchThread方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.assertIsDispatchThread方法的具體用法?Java Application.assertIsDispatchThread怎麽用?Java Application.assertIsDispatchThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.application.Application的用法示例。


在下文中一共展示了Application.assertIsDispatchThread方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkCanPaint

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void checkCanPaint(Graphics g) {
  if (UIUtil.isPrinting(g)) return;

  /* wtf??
  if (!isDisplayable()) {
    LOG.assertTrue(false, logSwingPath());
  }
  */
  final Application application = ApplicationManager.getApplication();
  if (application != null) {
    application.assertIsDispatchThread();
  }
  else if (!SwingUtilities.isEventDispatchThread()) {
    throw new RuntimeException(Thread.currentThread().toString());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:SimpleColoredComponent.java

示例2: doApplyInformationToEditor

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void doApplyInformationToEditor() {
  Application application = ApplicationManager.getApplication();
  application.assertIsDispatchThread();
  if (!application.isUnitTestMode() && !myEditor.getContentComponent().hasFocus()) return;
  int caretOffset = myEditor.getCaretModel().getOffset();
  importUnambiguousImports(caretOffset);
  List<HighlightInfo> visibleHighlights = getVisibleHighlights(myStartOffset, myEndOffset, myProject, myEditor);

  for (int i = visibleHighlights.size() - 1; i >= 0; i--) {
    HighlightInfo info = visibleHighlights.get(i);
    if (info.startOffset <= caretOffset && showAddImportHint(info)) return;
  }

  for (HighlightInfo visibleHighlight : visibleHighlights) {
    if (visibleHighlight.startOffset > caretOffset && showAddImportHint(visibleHighlight)) return;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ShowAutoImportPass.java

示例3: decrementPostponedCounter

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void decrementPostponedCounter() {
  Application application = ApplicationManager.getApplication();
  application.assertIsDispatchThread();
  if (--getContext().myPostponedCounter == 0) {
    if (application.isWriteAccessAllowed()) {
      doPostponedFormatting();
    }
    else {
      application.runWriteAction(new Runnable() {
        @Override
        public void run() {
          doPostponedFormatting();
        }
      });
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:PostprocessReformattingAspect.java

示例4: attachToWizard

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
/**
 * Attach this path to a {@link DynamicWizard}, linking it to that wizard's state.
 */
@Override
public final void attachToWizard(@NotNull DynamicWizard wizard) {
  Application application = ApplicationManager.getApplication();
  if (application != null && !application.isUnitTestMode()) {
    application.assertIsDispatchThread();
  }
  myWizard = wizard;
  myUpdateQueue = wizard.getUpdateQueue();
  Map<String, Object> myCurrentValues = myState.flatten();
  myState = new ScopedStateStore(ScopedStateStore.Scope.PATH, myWizard.getState(), this);
  for (String keyName : myCurrentValues.keySet()) {
    myState.put(myState.createKey(keyName, Object.class), myCurrentValues.get(keyName));
  }
  init();
  myIsInitialized = true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:DynamicWizardPath.java

示例5: postponeFormattingInside

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public <T> T postponeFormattingInside(@NotNull Computable<T> computable) {
  Application application = ApplicationManager.getApplication();
  application.assertIsDispatchThread();
  try {
    incrementPostponedCounter();
    return computable.compute();
  }
  finally {
    decrementPostponedCounter();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:PostprocessReformattingAspect.java

示例6: runSensitiveOperation

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void runSensitiveOperation(@NotNull ProgressIndicator progressIndicator, boolean cancellable, @NotNull final Runnable operation) {
  final Application application = ApplicationManager.getApplication();
  application.assertIsDispatchThread();
  if (!myCurrentProgressIndicator.compareAndSet(null, progressIndicator)) {
    throw new IllegalStateException("Submitting an operation while another is in progress.");
  }
  final JRootPane rootPane = myFrame.getRootPane();
  final JButton defaultButton = rootPane.getDefaultButton();
  rootPane.setDefaultButton(null);
  updateButtons(false, false, true, false);
  Task.Backgroundable task = new LongRunningOperationWrapper(operation, cancellable, defaultButton);
  ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, progressIndicator);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:FirstRunWizardHost.java

示例7: runSensitiveOperation

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void runSensitiveOperation(@NotNull final ProgressIndicator progressIndicator,
                                  boolean cancellable, @NotNull final Runnable operation) {
  final Application application = ApplicationManager.getApplication();
  application.assertIsDispatchThread();
  if (!myCurrentProgressIndicator.compareAndSet(null, progressIndicator)) {
    throw new IllegalStateException("Submitting an operation while another is in progress.");
  }
  final JRootPane rootPane = getRootPane();
  rootPane.setDefaultButton(null);
  updateButtons(false, false, true, false);

  Task.Backgroundable task = new Task.Backgroundable(null, myWizard.getWizardActionDescription(), cancellable) {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      operation.run();
      // this can't be done in onSuccess because the ModalityState needs to be set
      ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        @Override
        public void run() {
          updateButtons(false, false, false, true);
          myCurrentProgressIndicator.set(null);
        }
      }, ModalityState.stateForComponent(myWizard.getContentPane()));
    }
  };
  ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, progressIndicator);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:DialogWrapperHost.java

示例8: assertDispatchThread

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void assertDispatchThread() {
  Application application = ApplicationManager.getApplication();
  if (myAssertDispatchThread && !application.isUnitTestMode()) {
    application.assertIsDispatchThread();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:PendingEventDispatcher.java


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