本文整理汇总了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();
}
}
示例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;
}
示例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();
}
示例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();
}
}
示例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;
}
示例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);
}