本文整理汇总了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());
}
}
}
示例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
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例6: getModalityState
@NotNull
public ModalityState getModalityState() {
if (myModalityStateComponent == null) {
return ModalityState.NON_MODAL;
}
return ModalityState.stateForComponent(myModalityStateComponent);
}
示例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;
}
示例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();
}
}
});
}
}
示例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);
}
});
}
}
示例10: getDefaultModalityState
@NotNull
protected ModalityState getDefaultModalityState() {
return ModalityState.NON_MODAL;
}
示例11: getModalityState
@Override
@NotNull
public ModalityState getModalityState() {
return ModalityState.NON_MODAL;
}
示例12: getModalityStateForQuestionDialogs
@Override
public ModalityState getModalityStateForQuestionDialogs() {
return ModalityState.NON_MODAL;
}
示例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;
}
}
示例14: getModalityState
@NotNull
@Override
public ModalityState getModalityState() {
return ModalityState.NON_MODAL;
}