本文整理匯總了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());
}
}
示例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;
}
}
示例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();
}
});
}
}
}
示例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;
}
示例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();
}
}
示例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);
}
示例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);
}
示例8: assertDispatchThread
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void assertDispatchThread() {
Application application = ApplicationManager.getApplication();
if (myAssertDispatchThread && !application.isUnitTestMode()) {
application.assertIsDispatchThread();
}
}