• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProgressIndicatorUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ProgressIndicatorUtils类属于com.intellij.openapi.progress.util包,在下文中一共展示了ProgressIndicatorUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: execute

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
public void execute(BrowseMode browseMode) {
  myBrowseMode = browseMode;

  Document document = myEditor.getDocument();
  final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
  if (file == null) return;
  PsiDocumentManager.getInstance(myProject).commitAllDocuments();

  if (EditorUtil.inVirtualSpace(myEditor, myPosition)) {
    return;
  }

  final int offset = myEditor.logicalPositionToOffset(myPosition);

  int selStart = myEditor.getSelectionModel().getSelectionStart();
  int selEnd = myEditor.getSelectionModel().getSelectionEnd();

  if (offset >= selStart && offset < selEnd) return;
  ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      ProgressIndicatorUtils.runWithWriteActionPriority(new Runnable() {
        @Override
        public void run() {
          doExecute(file, offset);
        }
      });
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:CtrlMouseHandler.java


示例4: updateHighlighters

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
public static void updateHighlighters(@Nonnull Project project, @Nonnull Editor editor, @Nonnull VirtualFile file) {
  AsyncHighlighterUpdater task = new AsyncHighlighterUpdater(project, editor, file);
  if (task.isEverythingValid()) {
    CompletableFuture<?> future = ProgressIndicatorUtils.scheduleWithWriteActionPriority(ourExecutor, task);
    ourHighlighterFutures.add(future);
    future.whenComplete((a, b) -> ourHighlighterFutures.remove(future));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:AsyncHighlighterUpdater.java


示例5: scheduleLoading

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
private Future<Runnable> scheduleLoading() {
  PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(myProject);
  long startStamp = myEditor.getDocument().getModificationStamp();
  return ourExecutor.submit(() -> {
    Ref<Runnable> ref = new Ref<>();
    try {
      while (!myEditorComponent.isDisposed()) {
        ProgressIndicatorUtils.runWithWriteActionPriority(
                () -> ref.set(psiDocumentManager.commitAndRunReadAction(() -> myProject.isDisposed() ? EmptyRunnable.INSTANCE
                                                                                                     : myTextEditor.loadEditorInBackground())),
                new ProgressIndicatorBase()
        );
        Runnable continuation = ref.get();
        if (continuation != null) {
          invokeLater(() -> {
            if (startStamp == myEditor.getDocument().getModificationStamp()) loadingFinished(continuation);
            else if (!myProject.isDisposed() && !myEditorComponent.isDisposed()) scheduleLoading();
          });
          return continuation;
        }
        ProgressIndicatorUtils.yieldToPendingWriteActions();
      }
    }
    finally {
      if (ref.isNull()) invokeLater(() -> loadingFinished(null));
    }
    return null;
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:AsyncEditorLoader.java


示例6: 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


示例7: 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


示例8: 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


示例9: scheduleThread

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
void scheduleThread() {
  ApplicationManager.getApplication().assertIsDispatchThread();
  myCalcElementsThread = this;
  showCard(SEARCHING_CARD, 200);
  ProgressIndicatorUtils.scheduleWithWriteActionPriority(myProgress, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ChooseByNameBase.java


示例10: createProgressIndicator

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
@NotNull
protected ProgressIndicator createProgressIndicator() {
  return ProgressIndicatorUtils.forceWriteActionPriority(new ProgressIndicatorBase(true), this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AntExplorerTreeBuilder.java


示例11: createProgressIndicator

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
@NotNull
protected ProgressIndicator createProgressIndicator() {
    return ProgressIndicatorUtils.forceWriteActionPriority(new ProgressIndicatorBase(true), this);
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:5,代码来源:SlingServerTreeBuilder.java


示例12: createProgressIndicator

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
@NotNull
protected ProgressIndicator createProgressIndicator() {
  return ProgressIndicatorUtils.forceWriteActionPriority(new ProgressIndicatorBase(), this);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:AntExplorerTreeBuilder.java


示例13: createProgressIndicator

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
protected ProgressIndicator createProgressIndicator() {
  if (isToBuildChildrenInBackground(getRootElement())) {
    return ProgressIndicatorUtils.forceWriteActionPriority(new ProgressIndicatorBase(true), this);
  }
  return super.createProgressIndicator();
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:7,代码来源:JamAbstractTreeBuilder.java


示例14: 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


示例15: lookForInjectedAndMatchBracesInOtherThread

import com.intellij.openapi.progress.util.ProgressIndicatorUtils; //导入依赖的package包/类
static void lookForInjectedAndMatchBracesInOtherThread(@Nonnull final Editor editor,
                                                       @Nonnull final Alarm alarm,
                                                       @Nonnull final Processor<BraceHighlightingHandler> processor) {
  ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
  if (!isValidEditor(editor)) return;
  if (!PROCESSED_EDITORS.add(editor)) {
    // Skip processing if that is not really necessary.
    // Assuming to be in EDT here.
    return;
  }
  final int offset = editor.getCaretModel().getOffset();

  // any request to the UI component need to be done from EDT
  final ModalityState modalityState = ModalityState.stateForComponent(editor.getComponent());
  final DumbAwareRunnable removeEditorFromProcessed = () -> PROCESSED_EDITORS.remove(editor);

  ApplicationManager.getApplication().executeOnPooledThread(() -> {
    if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(() ->
                                                                  {
                                                                    try {
                                                                      ((ApplicationImpl)ApplicationManager.getApplication()).executeByImpatientReader(()->{
                                                                        if (!ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(()->{
                                                                          if (!isValidEditor(editor)) {
                                                                            removeFromProcessedLater(editor);
                                                                            return;
                                                                          }
                                                                          @SuppressWarnings("ConstantConditions") // the `project` is valid after the `isValidEditor` call
                                                                          @Nonnull final Project project = editor.getProject();

                                                                          final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
                                                                          PsiFile injected = psiFile instanceof PsiBinaryFile || !isValidFile(psiFile)
                                                                                             ? null
                                                                                             : getInjectedFileIfAny(editor, project, offset, psiFile, alarm);
                                                                          ApplicationManager.getApplication().invokeLater((DumbAwareRunnable)() -> {
                                                                            try {
                                                                              if (isValidEditor(editor) && isValidFile(injected)) {
                                                                                Editor newEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injected);
                                                                                BraceHighlightingHandler handler = new BraceHighlightingHandler(project, newEditor, alarm, injected);
                                                                                processor.process(handler);
                                                                              }
                                                                            }
                                                                            finally {
                                                                              removeEditorFromProcessed.run();
                                                                            }
                                                                          }, modalityState);
                                                                        })) {
                                                                          removeFromProcessedLater(editor);
                                                                        }}
                                                                      );
                                                                    }
                                                                    catch(Exception e) {
                                                                      // Reset processing flag in case of unexpected exception.
                                                                      removeFromProcessedLater(editor);
                                                                      throw e;
                                                                    }
                                                                  }
    )) {
      // write action is queued in AWT. restart after it's finished
      ApplicationManager.getApplication().invokeLater(() -> {
        removeEditorFromProcessed.run();
        lookForInjectedAndMatchBracesInOtherThread(editor, alarm, processor);
      }, modalityState);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:66,代码来源:BraceHighlightingHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SEIModel类代码示例发布时间:2022-05-23
下一篇:
Java XmlNamespace类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap