Java Code Examples for com.intellij.openapi.application.Application#assertIsDispatchThread()
The following examples show how to use
com.intellij.openapi.application.Application#assertIsDispatchThread() .
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: MultiIconSimpleColoredComponent.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()); } }
Example 2
Source File: MultiIconSimpleColoredComponent.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()); } }
Example 3
Source File: SimpleColoredComponent.java From consulo with Apache License 2.0 | 6 votes |
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()); } }
Example 4
Source File: ShowAutoImportPass.java From consulo with Apache License 2.0 | 6 votes |
private void showImports() { Application application = ApplicationManager.getApplication(); application.assertIsDispatchThread(); if (!application.isHeadlessEnvironment() && !myEditor.getContentComponent().hasFocus()) return; if (DumbService.isDumb(myProject) || !myFile.isValid()) return; if (myEditor.isDisposed() || myEditor instanceof EditorWindow && !((EditorWindow)myEditor).isValid()) return; int caretOffset = myEditor.getCaretModel().getOffset(); importUnambiguousImports(caretOffset); List<HighlightInfo> visibleHighlights = getVisibleHighlights(myStartOffset, myEndOffset, myProject, myEditor, hasDirtyTextRange); 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; } }
Example 5
Source File: CoreCommandProcessor.java From consulo with Apache License 2.0 | 5 votes |
private void executeCommand(@Nullable Project project, @Nonnull Runnable command, @Nullable String name, @Nullable Object groupId, @Nonnull UndoConfirmationPolicy confirmationPolicy, boolean shouldRecordCommandForActiveDocument, @Nullable Document document) { Application application = ApplicationManager.getApplication(); application.assertIsDispatchThread(); if (project != null && project.isDisposed()) { CommandLog.LOG.error("Project " + project + " already disposed"); return; } if (CommandLog.LOG.isDebugEnabled()) { CommandLog.LOG.debug("executeCommand: " + command + ", name = " + name + ", groupId = " + groupId + ", in command = " + (myCurrentCommand != null) + ", in transparent action = " + isUndoTransparentActionInProgress()); } if (myCurrentCommand != null) { command.run(); return; } Throwable throwable = null; try { myCurrentCommand = new CommandDescriptor(command, project, name, groupId, confirmationPolicy, shouldRecordCommandForActiveDocument, document); fireCommandStarted(); command.run(); } catch (Throwable th) { throwable = th; } finally { finishCommand(myCurrentCommand, throwable); } }
Example 6
Source File: PostprocessReformattingAspect.java From consulo with Apache License 2.0 | 5 votes |
public <T> T postponeFormattingInside(@Nonnull Computable<T> computable) { Application application = ApplicationManager.getApplication(); application.assertIsDispatchThread(); try { incrementPostponedCounter(); return computable.compute(); } finally { decrementPostponedCounter(); } }
Example 7
Source File: PendingEventDispatcher.java From consulo with Apache License 2.0 | 4 votes |
private void assertDispatchThread() { Application application = ApplicationManager.getApplication(); if (myAssertDispatchThread && !application.isUnitTestMode()) { application.assertIsDispatchThread(); } }