当前位置: 首页>>代码示例>>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;未经允许,请勿转载。