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


Java PsiElementProcessor.execute方法代码示例

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


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

示例1: processChildren

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的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

示例2: processChildren

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
@Override
public boolean processChildren(final PsiElementProcessor<PsiFileSystemItem> processor) {
  if (myIndex == myPackages.length - 1) {
    return myDirectory.processChildren(processor);
  }
  else {
    return processor.execute(new PackagePrefixFileSystemItemImpl(myDirectory, myIndex+1, myPackages));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PackagePrefixFileSystemItemImpl.java

示例3: processFileSystemItem

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
protected static boolean processFileSystemItem(PsiElementProcessor<PsiFileSystemItem> processor, PsiFileSystemItem element) {
  if (processor instanceof PsiFileSystemItemProcessor && !((PsiFileSystemItemProcessor)processor).acceptItem(element.getName(), true)) {
    return true;
  }

  return processor.execute(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SyntheticFileSystemItem.java

示例4: _processXmlElements

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
static boolean _processXmlElements(XmlTag element, PsiElementProcessor<XmlTag> processor) {
  if (!processor.execute(element)) return false;
  final XmlTag[] subTags = element.getSubTags();

  for (XmlTag subTag : subTags) {
    if (!_processXmlElements(subTag, processor)) return false;
  }

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

示例5: processForwardDependencies

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
public static boolean processForwardDependencies(XmlFile file, final PsiElementProcessor<XmlFile> processor) {
  VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) {
    return processor.execute(file);
  }
  final Project project = file.getProject();
  final VirtualFile[] files = FileIncludeManager.getManager(project).getIncludedFiles(virtualFile, true);

  return processRelatedFiles(file, files, processor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RelaxIncludeIndex.java

示例6: processBackwardDependencies

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
public static boolean processBackwardDependencies(@NotNull XmlFile file, PsiElementProcessor<XmlFile> processor) {
  VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) {
    return processor.execute(file);
  }
  final Project project = file.getProject();
  final VirtualFile[] files = FileIncludeManager.getManager(project).getIncludingFiles(virtualFile, true);

  return processRelatedFiles(file, files, processor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RelaxIncludeIndex.java

示例7: processFile

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
private static boolean processFile(PsiFile psiFile, PsiElementProcessor<XmlFile> processor) {
  final FileType type = psiFile.getFileType();
  if (type == XmlFileType.INSTANCE && isRngFile(psiFile)) {
    if (!processor.execute((XmlFile)psiFile)) {
      return false;
    }
  } else if (type == RncFileType.getInstance()) {
    if (!processor.execute((XmlFile)psiFile)) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:RelaxIncludeIndex.java

示例8: checkSuperMethod

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
public static void checkSuperMethod(@NotNull PsiMethod method,
                                    @NotNull String actionString,
                                    @NotNull final PsiElementProcessor<PsiMethod> processor,
                                    @NotNull Editor editor) {
  PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    processor.execute(method);
    return;
  }

  PsiMethod superMethod = method.findDeepestSuperMethod();
  if (superMethod == null) {
    processor.execute(method);
    return;
  }

  final PsiClass containingClass = superMethod.getContainingClass();
  if (containingClass == null) {
    processor.execute(method);
    return;
  }

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    processor.execute(superMethod);
    return;
  }

  final PsiMethod[] methods = {superMethod, method};
  final String renameBase = actionString + " base method";
  final String renameCurrent = actionString + " only current method";
  final JBList list = new JBList(renameBase, renameCurrent);
  JBPopupFactory.getInstance().createListPopupBuilder(list)
    .setTitle(method.getName() + (containingClass.isInterface() && !aClass.isInterface() ? " implements" : " overrides") + " method of " +
              SymbolPresentationUtil.getSymbolPresentableText(containingClass))
    .setMovable(false)
    .setResizable(false)
    .setRequestFocus(true)
    .setItemChoosenCallback(new Runnable() {
      @Override
      public void run() {
        final Object value = list.getSelectedValue();
        if (value instanceof String) {
          processor.execute(methods[value.equals(renameBase) ? 0 : 1]);
        }
      }
    }).createPopup().showInBestPositionFor(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:SuperMethodWarningUtil.java

示例9: getPsiElementPopup

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
@NotNull
public static <T extends PsiElement> JBPopup getPsiElementPopup(@NotNull T[] elements,
                                                                @NotNull final PsiElementListCellRenderer<T> renderer,
                                                                @Nullable final String title,
                                                                @NotNull final PsiElementProcessor<T> processor,
                                                                @Nullable final T selection) {
  final JList list = new JBListWithHintProvider(elements) {
    @Nullable
    @Override
    protected PsiElement getPsiElementForHint(Object selectedValue) {
      return (PsiElement)selectedValue;
    }
  };
  list.setCellRenderer(renderer);

  list.setFont(EditorUtil.getEditorFont());

  if (selection != null) {
    list.setSelectedValue(selection, true);
  }

  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      int[] ids = list.getSelectedIndices();
      if (ids == null || ids.length == 0) return;
      for (Object element : list.getSelectedValues()) {
        if (element != null) {
          processor.execute((T)element);
        }
      }
    }
  };

  PopupChooserBuilder builder = new PopupChooserBuilder(list);
  if (title != null) {
    builder.setTitle(title);
  }
  renderer.installSpeedSearch(builder, true);

  JBPopup popup = builder.setItemChoosenCallback(runnable).createPopup();

  builder.getScrollPane().setBorder(null);
  builder.getScrollPane().setViewportBorder(null);

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

示例10: chooseAmbiguousTarget

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
public static boolean chooseAmbiguousTarget(@NotNull Editor editor,
                                            int offset,
                                            @NotNull PsiElementProcessor<PsiElement> processor,
                                            @NotNull String titlePattern,
                                            @Nullable PsiElement[] elements) {
  if (TargetElementUtil.inVirtualSpace(editor, offset)) {
    return false;
  }

  final PsiReference reference = TargetElementUtil.findReference(editor, offset);

  if (elements == null || elements.length == 0) {
    final Collection<PsiElement> candidates = suggestCandidates(reference);
    elements = PsiUtilCore.toPsiElementArray(candidates);
  }

  if (elements.length == 1) {
    PsiElement element = elements[0];
    LOG.assertTrue(element != null);
    processor.execute(element);
    return true;
  }
  if (elements.length > 1) {
    String title;

    if (reference == null) {
      title = titlePattern;
    }
    else {
      final TextRange range = reference.getRangeInElement();
      final String elementText = reference.getElement().getText();
      LOG.assertTrue(range.getStartOffset() >= 0 && range.getEndOffset() <= elementText.length(), Arrays.toString(elements) + ";" + reference);
      final String refText = range.substring(elementText);
      title = MessageFormat.format(titlePattern, refText);
    }

    NavigationUtil.getPsiElementPopup(elements, new DefaultPsiElementCellRenderer(), title, processor).showInBestPositionFor(editor);
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:GotoDeclarationAction.java

示例11: process

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
public static void process(final PsiElementProcessor<PsiElement> processor, PsiFile file) {
  for (PsiElement e : ourCachedIdsCache.compute(file)) {
    if (!processor.execute(e)) return;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:IdRefReference.java

示例12: processTagsInNamespaceInner

import com.intellij.psi.search.PsiElementProcessor; //导入方法依赖的package包/类
private static boolean processTagsInNamespaceInner(@NotNull final XmlTag rootTag, final String[] tagNames,
                                                   final PsiElementProcessor<XmlTag> processor, Set<XmlTag> visitedTags) {
  if (visitedTags == null) visitedTags = new HashSet<XmlTag>(3);
  else if (visitedTags.contains(rootTag)) return true;

  visitedTags.add(rootTag);
  XmlTag[] tags = rootTag.getSubTags();

  NextTag:
  for (XmlTag tag : tags) {
    for(String tagName:tagNames) {
      if (equalsToSchemaName(tag, tagName)) {
        final String name = tag.getAttributeValue("name");

        if (name != null) {
          if (!processor.execute(tag)) {
            return false;
          }
        }

        continue NextTag;
      }
    }

    if (equalsToSchemaName(tag, INCLUDE_TAG_NAME)) {
      final String schemaLocation = tag.getAttributeValue("schemaLocation");

      if (schemaLocation != null) {
        final XmlFile xmlFile = XmlUtil.findNamespace(rootTag.getContainingFile(), schemaLocation);

        if (xmlFile != null) {
          final XmlDocument includedDocument = xmlFile.getDocument();

          if (includedDocument != null) {
            if (!processTagsInNamespaceInner(includedDocument.getRootTag(), tagNames, processor, visitedTags)) return false;
          }
        }
      }
    }
  }

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


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