当前位置: 首页>>代码示例>>Java>>正文


Java ProgressIndicatorUtils.runInReadActionWithWriteActionPriority方法代码示例

本文整理汇总了Java中com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressIndicatorUtils.runInReadActionWithWriteActionPriority方法的具体用法?Java ProgressIndicatorUtils.runInReadActionWithWriteActionPriority怎么用?Java ProgressIndicatorUtils.runInReadActionWithWriteActionPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.progress.util.ProgressIndicatorUtils的用法示例。


在下文中一共展示了ProgressIndicatorUtils.runInReadActionWithWriteActionPriority方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runInReadActionWithWriteActionPriorityWithRetries

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
public static <T> T runInReadActionWithWriteActionPriorityWithRetries(@NotNull Computable<T> action)
{
	if(ApplicationManagerEx.getApplicationEx().holdsReadLock())
	{
		return action.compute();
	}
	Ref<T> res = Ref.create();
	while(true)
	{
		if(ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(() -> res.set(action.compute())))
		{
			return res.get();
		}
		ProgressIndicatorUtils.yieldToPendingWriteActions();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:DebuggerUtilsImpl.java

示例2: runInReadActionWithWriteActionPriority

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
private static boolean runInReadActionWithWriteActionPriority(Runnable runnable) {
  boolean success = ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(runnable);
  if (!success) {
    yieldToPendingWriteActions();
  }
  return success;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:8,代码来源:CidrCacheFiller.java

示例3: computeWithWritePriority

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
@Nonnull
private FilterResults computeWithWritePriority(Computable<FilterResults> bgComputation) {
  Ref<FilterResults> applyResults = Ref.create(FilterResults.EMPTY);
  Runnable computeInReadAction = () -> {
    if (myEditor.isDisposed()) return;
    applyResults.set(bgComputation.compute());
  };
  while (!ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(computeInReadAction)) {
    ProgressIndicatorUtils.yieldToPendingWriteActions();
  }
  return applyResults.get();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:AsyncFilterRunner.java

示例4: processFilesInReadActionWithYieldingToWriteAction

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
private void processFilesInReadActionWithYieldingToWriteAction() {
  try {
    while (myVfsEventsMerger.hasChanges()) {
      if (!ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(this::processFilesInReadAction)) {
        ProgressIndicatorUtils.yieldToPendingWriteActions();
      }
    }
  }
  finally {
    myScheduledVfsEventsWorkers.decrementAndGet();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:FileBasedIndexImpl.java

示例5: runSmartModeReadActionWithWritePriority

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
/**
 * @return true if runnable has been executed with no write action interference and in "smart" mode
 */
private boolean runSmartModeReadActionWithWritePriority(@NotNull Runnable runnable, ProgressIndicator indicator)
{
	DumbService dumbService = DumbService.getInstance(myProject);

	indicator.checkCanceled();
	dumbService.waitForSmartMode();

	AtomicBoolean dumb = new AtomicBoolean();
	boolean success = ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(() ->
	{
		if(myProject.isDisposed())
		{
			return;
		}

		if(dumbService.isDumb())
		{
			dumb.set(true);
			return;
		}

		runnable.run();
	}, indicator);
	if(dumb.get())
	{
		return false;
	}
	if(!success)
	{
		ProgressIndicatorUtils.yieldToPendingWriteActions();
	}
	return success;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:37,代码来源:SearchForTestsTask.java

示例6: runInReadActionWithWriteActionPriority

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入方法依赖的package包/类
@Override
public boolean runInReadActionWithWriteActionPriority(@Nonnull Runnable action, @Nullable ProgressIndicator indicator) {
  return ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(action, indicator);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ProgressManagerImpl.java


注:本文中的com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。