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


Java ModalityState.NON_MODAL屬性代碼示例

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


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

示例1: runOrInvokeLaterAboveProgress

public static void runOrInvokeLaterAboveProgress(final Runnable command, @Nullable final ModalityState modalityState, @NotNull final Project project) {
  final Application application = ApplicationManager.getApplication();
  if (application.isDispatchThread()) {
    command.run();
  } else {
    final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
    if (pi != null) {
      execute(pi);
      application.invokeLater(command, pi.getModalityState(), new Condition() {
        @Override
        public boolean value(Object o) {
          return (! project.isOpen()) || project.isDisposed();
        }
      });
    } else {
      final ModalityState notNullModalityState = modalityState == null ? ModalityState.NON_MODAL : modalityState;
      application.invokeLater(command, notNullModalityState, project.getDisposed());
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:WaitForProgressToShow.java

示例2: RefreshSessionImpl

public RefreshSessionImpl(boolean async, boolean recursive, @Nullable Runnable finishRunnable, @NotNull ModalityState modalityState) {
  myIsAsync = async;
  myIsRecursive = recursive;
  myFinishRunnable = finishRunnable;
  myModalityState = modalityState;
  LOG.assertTrue(modalityState == ModalityState.NON_MODAL || modalityState != ModalityState.any(), "Refresh session should have a specific modality");

  if (modalityState == ModalityState.NON_MODAL) {
    myDumbModePermission = null;
    myStartTrace = null;
  }
  else {
    myDumbModePermission = DumbServiceImpl.getExplicitPermission(modalityState);
    myStartTrace = new Throwable(); // please report exceptions here to peter
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:RefreshSessionImpl.java

示例3: doGetData

@Nullable
private Object doGetData(@NotNull String dataId) {
  Component component = myRef.get();
  if (PlatformDataKeys.IS_MODAL_CONTEXT.is(dataId)) {
    if (component == null) {
      return null;
    }
    return IdeKeyEventDispatcher.isModalContext(component);
  }
  if (PlatformDataKeys.CONTEXT_COMPONENT.is(dataId)) {
    return component;
  }
  if (PlatformDataKeys.MODALITY_STATE.is(dataId)) {
    return component != null ? ModalityState.stateForComponent(component) : ModalityState.NON_MODAL;
  }
  if (CommonDataKeys.EDITOR.is(dataId)) {
    Editor editor = (Editor)((DataManagerImpl)DataManager.getInstance()).getData(dataId, component);
    return validateEditor(editor);
  }
  return ((DataManagerImpl)DataManager.getInstance()).getData(dataId, component);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:DataManagerImpl.java

示例4: addMessage

public void addMessage(final CompilerMessage message) {
  prepareMessageView();

  final CompilerMessageCategory messageCategory = message.getCategory();
  if (CompilerMessageCategory.WARNING.equals(messageCategory)) {
    myWarningCount += 1;
  }
  else if (CompilerMessageCategory.ERROR.equals(messageCategory)) {
    myErrorCount += 1;
    informWolf(message);
  }

  if (ApplicationManager.getApplication().isDispatchThread()) {
    openMessageView();
    doAddMessage(message);
  }
  else {
    final Window window = getWindow();
    final ModalityState modalityState = window != null ? ModalityState.stateForComponent(window) : ModalityState.NON_MODAL;
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (myProject != null && !myProject.isDisposed()) {
          openMessageView();
          doAddMessage(message);
        }
      }
    }, modalityState);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:CompilerTask.java

示例5: runOrInvokeAndWaitAboveProgress

public static void runOrInvokeAndWaitAboveProgress(final Runnable command, @Nullable final ModalityState modalityState) {
  final Application application = ApplicationManager.getApplication();
  if (application.isDispatchThread()) {
    command.run();
  } else {
    final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
    if (pi != null) {
      execute(pi);
      application.invokeAndWait(command, pi.getModalityState());
    } else {
      final ModalityState notNullModalityState = modalityState == null ? ModalityState.NON_MODAL : modalityState;
      application.invokeAndWait(command, notNullModalityState);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:WaitForProgressToShow.java

示例6: getModalityState

@NotNull
public ModalityState getModalityState() {
  if (myModalityStateComponent == null) {
    return ModalityState.NON_MODAL;
  }
  return ModalityState.stateForComponent(myModalityStateComponent);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:MergingUpdateQueue.java

示例7: getDumbModePermission

@Nullable
private DumbModePermission getDumbModePermission(ModalityState modality) {
  DumbModePermission permission = getExplicitPermission(modality);
  if (permission != null) {
    return permission;
  }

  if (modality == ModalityState.NON_MODAL || !StartupManagerEx.getInstanceEx(myProject).postStartupActivityPassed()) {
    return DumbModePermission.MAY_START_BACKGROUND;
  }

  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:DumbServiceImpl.java

示例8: run

public final void run() {
  synchronized (myLock) {
    final CommandGroup commandGroup = getNextCommandGroup();
    if (commandGroup == null || commandGroup.isEmpty()) return;

    final Condition conditionForGroup = commandGroup.getExpireCondition();

    final FinalizableCommand command = commandGroup.takeNextCommand();
    myCommandCount--;

    final Condition expire = command.getExpireCondition() != null ? command.getExpireCondition() : conditionForGroup;

    if (LOG.isDebugEnabled()) {
      LOG.debug("CommandProcessor.run " + command);
    }
    // max. I'm not actually quite sure this should have NON_MODAL modality but it should
    // definitely have some since runnables in command list may (and do) request some PSI activity
    final boolean queueNext = myCommandCount > 0;
    Application application = ApplicationManager.getApplication();
    ModalityState modalityState = Registry.is("ide.perProjectModality") ? ModalityState.defaultModalityState() : ModalityState.NON_MODAL;
    application.getInvokator().invokeLater(command, modalityState, expire == null ? application.getDisposed() : expire).doWhenDone(new Runnable() {
      public void run() {
        if (queueNext) {
          CommandProcessor.this.run();
        }
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:CommandProcessor.java

示例9: showDumbModeWarningLaterIfNobodyConsumesEvent

private static void showDumbModeWarningLaterIfNobodyConsumesEvent(final InputEvent e, final AnActionEvent... actionEvents) {
  if (ModalityState.current() == ModalityState.NON_MODAL) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          if (e.isConsumed()) return;

          ActionUtil.showDumbModeWarning(actionEvents);
        }
      });
    }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:IdeKeyEventDispatcher.java

示例10: getDefaultModalityState

@NotNull
protected ModalityState getDefaultModalityState() {
  return ModalityState.NON_MODAL;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:RefreshQueue.java

示例11: getModalityState

@Override
@NotNull
public ModalityState getModalityState() {
  return ModalityState.NON_MODAL;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:EmptyProgressIndicator.java

示例12: getModalityStateForQuestionDialogs

@Override
public ModalityState getModalityStateForQuestionDialogs() {
  return ModalityState.NON_MODAL;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:AbstractIdeModifiableModelsProvider.java

示例13: getNextEvent

@Nullable
private static RunnableInfo getNextEvent(boolean remove) {
  synchronized (LOCK) {
    if (!ourForcedFlushQueue.isEmpty()) {
      final RunnableInfo toRun = remove ? ourForcedFlushQueue.remove(0) : ourForcedFlushQueue.get(0);
      if (!toRun.expired.value(null)) {
        return toRun;
      }
      else {
        toRun.callback.setDone();
      }
    }


    ModalityState currentModality;
    if (ourModalEntities.isEmpty()) {
      Application application = ApplicationManager.getApplication();
      currentModality = application == null ? ModalityState.NON_MODAL : application.getNoneModalityState();
    }
    else {
      currentModality = new ModalityStateEx(ourModalEntities.toArray());
    }

    while (ourQueueSkipCount < ourQueue.size()) {
      RunnableInfo info = ourQueue.get(ourQueueSkipCount);

      if (info.expired.value(null)) {
        ourQueue.remove(ourQueueSkipCount);
        info.callback.setDone();
        continue;
      }

      if (!currentModality.dominates(info.modalityState)) {
        if (remove) {
          ourQueue.remove(ourQueueSkipCount);
        }
        return info;
      }
      ourQueueSkipCount++;
    }

    return null;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:LaterInvocator.java

示例14: getModalityState

@NotNull
@Override
public ModalityState getModalityState() {
  return ModalityState.NON_MODAL;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:NonCancelableIndicator.java


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