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


Java ProgressIndicatorProvider类代码示例

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


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

示例1: processClassesByNames

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
public static boolean processClassesByNames(Project project,
                                            final GlobalSearchScope scope,
                                            Collection<String> names,
                                            Processor<PsiClass> processor) {
  final PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
  for (final String name : names) {
    ProgressIndicatorProvider.checkCanceled();
    final PsiClass[] classes = MethodUsagesSearcher.resolveInReadAction(project, new Computable<PsiClass[]>() {
      @Override
      public PsiClass[] compute() {
        return cache.getClassesByName(name, scope);
      }
    });
    for (PsiClass psiClass : classes) {
      ProgressIndicatorProvider.checkCanceled();
      if (!processor.process(psiClass)) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AllClassesSearchExecutor.java

示例2: findClass

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
  ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly

  Map<String, PsiClass> map = myClassCache.get(scope);
  if (map == null) {
    map = ContainerUtil.createConcurrentWeakValueMap();
    map = ConcurrencyUtil.cacheOrGet(myClassCache, scope, map);
  }
  PsiClass result = map.get(qualifiedName);
  if (result == null) {
    result = doFindClass(qualifiedName, scope);
    if (result != null) {
      map.put(qualifiedName, result);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaPsiFacadeImpl.java

示例3: findReplacement

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Nullable
private static PsiLocalVariable findReplacement(@NotNull PsiMethod method,
                                                @NotNull PsiVariable castedVar,
                                                @NotNull PsiTypeCastExpression expression) {
  final TextRange expressionTextRange = expression.getTextRange();
  for (PsiExpression occurrence : CodeInsightUtil.findExpressionOccurrences(method,expression)){
    ProgressIndicatorProvider.checkCanceled();
    final TextRange occurrenceTextRange = occurrence.getTextRange();
    if (occurrence == expression || occurrenceTextRange.getEndOffset() >= expressionTextRange.getStartOffset()) {
      continue;
    }

    final PsiLocalVariable variable = getVariable(occurrence);

    final PsiCodeBlock methodBody = method.getBody();
    if (variable != null && methodBody != null &&
        !isChangedBetween(castedVar, methodBody, occurrence, expression) && !isChangedBetween(variable, methodBody, occurrence, expression)) {
      return variable;
    }
  }


  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ReplaceCastWithVariableAction.java

示例4: visitFile

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public void visitFile(final PsiFile file) {
  if (myVisitAllFileRoots) {
    final FileViewProvider viewProvider = file.getViewProvider();
    final List<PsiFile> allFiles = viewProvider.getAllFiles();
    if (allFiles.size() > 1) {
      if (file == viewProvider.getPsi(viewProvider.getBaseLanguage())) {
        for (PsiFile lFile : allFiles) {
          ProgressIndicatorProvider.checkCanceled();
          lFile.acceptChildren(this);
        }
        return;
      }
    }
  }

  super.visitFile(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiRecursiveElementVisitor.java

示例5: init

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public void init() {
  long start = System.currentTimeMillis();

  final ProgressIndicator progressIndicator = isDefault() ? null : ProgressIndicatorProvider.getGlobalProgressIndicator();
  if (progressIndicator != null) {
    progressIndicator.pushState();
  }
  super.init(progressIndicator);
  if (progressIndicator != null) {
    progressIndicator.popState();
  }

  long time = System.currentTimeMillis() - start;
  LOG.info(getComponentConfigCount() + " project components initialized in " + time + " ms");

  getMessageBus().syncPublisher(ProjectLifecycleListener.TOPIC).projectComponentsInitialized(this);

  //noinspection SynchronizeOnThis
  synchronized (this) {
    myProjectManagerListener = new MyProjectManagerListener();
    myProjectManager.addProjectManagerListener(this, myProjectManagerListener);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProjectImpl.java

示例6: insertLeaves

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
private int insertLeaves(int curToken, int lastIdx, final CompositeElement curNode) {
  lastIdx = Math.min(lastIdx, myLexemeCount);
  while (curToken < lastIdx) {
    ProgressIndicatorProvider.checkCanceled();
    final int start = myLexStarts[curToken];
    final int end = myLexStarts[curToken + 1];
    if (start < end || myLexTypes[curToken] instanceof ILeafElementType) { // Empty token. Most probably a parser directive like indent/dedent in Python
      final IElementType type = myLexTypes[curToken];
      final TreeElement leaf = createLeaf(type, start, end);
      curNode.rawAddChildrenWithoutNotifications(leaf);
    }
    curToken++;
  }

  return curToken;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PsiBuilderImpl.java

示例7: processChildren

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public boolean processChildren(PsiElementProcessor<PsiFileSystemItem> processor) {
  checkValid();
  ProgressIndicatorProvider.checkCanceled();

  for (VirtualFile vFile : myFile.getChildren()) {
    boolean isDir = vFile.isDirectory();
    if (processor instanceof PsiFileSystemItemProcessor && !((PsiFileSystemItemProcessor)processor).acceptItem(vFile.getName(), isDir)) {
      continue;
    }

    PsiFileSystemItem item = isDir ? myManager.findDirectory(vFile) : myManager.findFile(vFile);
    if (item != null && !processor.execute(item)) {
      return false;
    }
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PsiDirectoryImpl.java

示例8: filterNames

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@NotNull
@Override
public List<String> filterNames(@NotNull ChooseByNameBase base, @NotNull String[] names, @NotNull String pattern) {
  final List<String> filtered = new ArrayList<String>();
  processNamesByPattern(base, names, convertToMatchingPattern(base, pattern), ProgressIndicatorProvider.getGlobalProgressIndicator(), new Consumer<MatchResult>() {
    @Override
    public void consume(MatchResult result) {
      synchronized (filtered) {
        filtered.add(result.elementName);
      }
    }
  });
  synchronized (filtered) {
    return filtered;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DefaultChooseByNameItemProvider.java

示例9: findFilesWithoutAttrs

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@NotNull
private Collection<VirtualFile> findFilesWithoutAttrs(@NotNull VirtualFile root, @NotNull Collection<VirtualFile> files) {
  GitRepository repository = myPlatformFacade.getRepositoryManager(myProject).getRepositoryForRoot(root);
  if (repository == null) {
    LOG.warn("Repository is null for " + root);
    return Collections.emptyList();
  }
  Collection<String> interestingAttributes = Arrays.asList(GitAttribute.TEXT.getName(), GitAttribute.CRLF.getName());
  GitCommandResult result = myGit.checkAttr(repository, interestingAttributes, files);
  if (!result.success()) {
    LOG.warn(String.format("Couldn't git check-attr. Attributes: %s, files: %s", interestingAttributes, files));
    return Collections.emptyList();
  }
  GitCheckAttrParser parser = GitCheckAttrParser.parse(result.getOutput());
  Map<String, Collection<GitAttribute>> attributes = parser.getAttributes();
  Collection<VirtualFile> filesWithoutAttrs = new ArrayList<VirtualFile>();
  for (VirtualFile file : files) {
    ProgressIndicatorProvider.checkCanceled();
    String relativePath = FileUtil.getRelativePath(root.getPath(), file.getPath(), '/');
    Collection<GitAttribute> attrs = attributes.get(relativePath);
    if (attrs == null || !attrs.contains(GitAttribute.TEXT) && !attrs.contains(GitAttribute.CRLF)) {
      filesWithoutAttrs.add(file);
    }
  }
  return filesWithoutAttrs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitCrlfProblemsDetector.java

示例10: processQuery

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public void processQuery(@NotNull SchemaTypeParentsSearch.SearchParameters parameters, @NotNull Processor<SchemaTypeDef> consumer) {
  SchemaTypeDef baseType = parameters.schemaTypeDef;

  ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
  if (progress != null) {
    progress.pushState();

    String typeName = ApplicationManager.getApplication().runReadAction((Computable<String>) baseType::getName);
    progress.setText(typeName == null ?
        "Searching for parents" : "Searching for parents of " + typeName
    );
  }

  try {
    processParents(consumer, baseType, parameters);
  } finally {
    if (progress != null) progress.popState();
  }
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:21,代码来源:SchemaTypeParentsSearcher.java

示例11: processQuery

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public void processQuery(@NotNull SchemaTypeInheritorsSearch.SearchParameters parameters, @NotNull Processor<SchemaTypeDef> consumer) {
  SchemaTypeDef baseType = parameters.schemaTypeDef;

  ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
  if (progress != null) {
    progress.pushState();

    String typeName = ApplicationManager.getApplication().runReadAction((Computable<String>) baseType::getName);
    progress.setText(typeName == null ?
        "Searching for inheritors" : "Searching for inheritors of " + typeName
    );
  }

  try {
    processInheritors(consumer, baseType, parameters);
  } finally {
    if (progress != null) progress.popState();
  }
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:21,代码来源:SchemaTypeInheritorsSearcher.java

示例12: nextToken

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
/** Create an ANTLR Token from the current token type of the builder
	 *  then advance the builder to next token (which ultimately calls an
	 *  ANTLR lexer).  The {@link ANTLRLexerAdaptor} creates tokens via
	 *  an ANTLR lexer but converts to {@link TokenIElementType} and here
	 *  we have to convert back to an ANTLR token using what info we
	 *  can get from the builder. We lose info such as the original channel.
	 *  So, whitespace and comments (typically hidden channel) will look like
	 *  real tokens. Jetbrains uses {@link ParserDefinition#getWhitespaceTokens()}
	 *  and {@link ParserDefinition#getCommentTokens()} to strip these before
	 *  our ANTLR parser sees them.
	 */
	@Override
	public Token nextToken() {
		ProgressIndicatorProvider.checkCanceled();

		TokenIElementType ideaTType = (TokenIElementType)builder.getTokenType();
		int type = ideaTType!=null ? ideaTType.getANTLRTokenType() : Token.EOF;

		int channel = Token.DEFAULT_CHANNEL;
		Pair<TokenSource, CharStream> source = new Pair<TokenSource, CharStream>(this, null);
		String text = builder.getTokenText();
		int start = builder.getCurrentOffset();
		int length = text != null ? text.length() : 0;
		int stop = start + length - 1;
		// PsiBuilder doesn't provide line, column info
		int line = 0;
		int charPositionInLine = 0;
		Token t = tokenFactory.create(source, type, text, channel, start, stop, line, charPositionInLine);
		builder.advanceLexer();
//		System.out.println("TOKEN: "+t);
		return t;
	}
 
开发者ID:antlr,项目名称:jetbrains,代码行数:33,代码来源:PSITokenSource.java

示例13: generateThrow

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
private void generateThrow(PsiClassType unhandledException, PsiElement throwingElement) {
  final List<PsiElement> catchBlocks = findThrowToBlocks(unhandledException);
  for (PsiElement block : catchBlocks) {
    ProgressIndicatorProvider.checkCanceled();
    ConditionalThrowToInstruction instruction = new ConditionalThrowToInstruction(0);
    myCurrentFlow.addInstruction(instruction);
    if (!patchCheckedThrowInstructionIfInsideFinally(instruction, throwingElement, block)) {
      if (block == null) {
        addElementOffsetLater(myCodeFragment, false);
      }
      else {
        instruction.offset--; // -1 for catch block param init
        addElementOffsetLater(block, true);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ControlFlowAnalyzer.java

示例14: visitCodeBlock

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override public void visitCodeBlock(PsiCodeBlock block) {
  startElement(block);
  int prevOffset = myCurrentFlow.getSize();
  PsiStatement[] statements = block.getStatements();
  for (PsiStatement statement : statements) {
    ProgressIndicatorProvider.checkCanceled();
    statement.accept(this);
  }

  //each statement should contain at least one instruction in order to getElement(offset) work
  int nextOffset = myCurrentFlow.getSize();
  if (!(block.getParent() instanceof PsiSwitchStatement) && prevOffset == nextOffset) {
    emitEmptyInstruction();
  }

  finishElement(block);
  if (prevOffset != 0) {
    registerSubRange(block, prevOffset);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ControlFlowAnalyzer.java

示例15: visitDeclarationStatement

import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入依赖的package包/类
@Override
public void visitDeclarationStatement(PsiDeclarationStatement statement) {
  startElement(statement);
  int pc = myCurrentFlow.getSize();
  PsiElement[] elements = statement.getDeclaredElements();
  for (PsiElement element : elements) {
    ProgressIndicatorProvider.checkCanceled();
    if (element instanceof PsiClass) {
      element.accept(this);
    }
    else if (element instanceof PsiVariable) {
      processVariable((PsiVariable)element);
    }
  }
  if (pc == myCurrentFlow.getSize()) {
    // generate at least one instruction for declaration
    emitEmptyInstruction();
  }
  finishElement(statement);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ControlFlowAnalyzer.java


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