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

Java FindManagerImpl类代码示例

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

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



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

示例1: findUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@NotNull
public Collection<UsageInfo> findUsages(@NotNull final PsiElement targetElement, @Nullable SearchScope scope) {
  final Project project = getProject();
  final FindUsagesHandler handler =
    ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager().getFindUsagesHandler(targetElement, false);

  final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
  Assert.assertNotNull("Cannot find handler for: " + targetElement, handler);
  final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements());
  final FindUsagesOptions options = handler.getFindUsagesOptions(null);
  if (scope != null) options.searchScope = scope; 
  for (PsiElement psiElement : psiElements) {
    handler.processElementUsages(psiElement, processor, options);
  }
  return processor.getResults();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CodeInsightTestFixtureImpl.java


示例2: highlightUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Override
public void highlightUsages(@NotNull PsiFile file, @NotNull Editor editor, boolean clearHighlights) {
  PsiElement target = getElement();

  if (file instanceof PsiCompiledFile) file = ((PsiCompiledFile)file).getDecompiledPsiFile();

  Project project = target.getProject();
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  final FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(target, true);

  // in case of injected file, use host file to highlight all occurrences of the target in each injected file
  PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
  SearchScope searchScope = new LocalSearchScope(context);
  Collection<PsiReference> refs = handler == null
                                  ? ReferencesSearch.search(target, searchScope, false).findAll()
                                  : handler.findReferencesToHighlight(target, searchScope);

  new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<PsiReference>(refs), project, target,
                                                 editor, context, clearHighlights).run();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PsiElement2UsageTargetAdapter.java


示例3: highlightUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Override
public void highlightUsages(@Nonnull PsiFile file, @Nonnull Editor editor, boolean clearHighlights) {
  PsiElement target = getElement();

  if (file instanceof PsiCompiledFile) file = ((PsiCompiledFile)file).getDecompiledPsiFile();

  Project project = target.getProject();
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  final FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(target, true);

  // in case of injected file, use host file to highlight all occurrences of the target in each injected file
  PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
  SearchScope searchScope = new LocalSearchScope(context);
  Collection<PsiReference> refs = handler == null ? ReferencesSearch.search(target, searchScope, false).findAll() : handler.findReferencesToHighlight(target, searchScope);

  new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<>(refs), project, target, editor, context, clearHighlights).run();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PsiElement2UsageTargetAdapter.java


示例4: getHighlightUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
/**
 * Returns read and write usages of psi element inside a single element
 *
 * @param target target psi element
 * @param psiElement psi element to search in
 * @return a pair where first element is read usages and second is write usages
 */
public static Couple<Collection<TextRange>> getHighlightUsages(@NotNull PsiElement target, PsiElement psiElement, boolean withDeclarations) {
  Collection<TextRange> readRanges = new ArrayList<TextRange>();
  Collection<TextRange> writeRanges = new ArrayList<TextRange>();
  final ReadWriteAccessDetector detector = ReadWriteAccessDetector.findDetector(target);
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(target.getProject())).getFindUsagesManager();
  final FindUsagesHandler findUsagesHandler = findUsagesManager.getFindUsagesHandler(target, true);
  final LocalSearchScope scope = new LocalSearchScope(psiElement);
  Collection<PsiReference> refs = findUsagesHandler != null
                            ? findUsagesHandler.findReferencesToHighlight(target, scope)
                            : ReferencesSearch.search(target, scope).findAll();
  for (PsiReference psiReference : refs) {
    if (psiReference == null) {
      LOG.error("Null reference returned, findUsagesHandler=" + findUsagesHandler + "; target=" + target + " of " + target.getClass());
      continue;
    }
    final List<TextRange> textRanges = HighlightUsagesHandler.getRangesToHighlight(psiReference);
    if (detector == null || detector.getReferenceAccess(target, psiReference) == ReadWriteAccessDetector.Access.Read) {
      readRanges.addAll(textRanges);
    }
    else {
      writeRanges.addAll(textRanges);
    }
  }

  if (withDeclarations) {
    final TextRange declRange = HighlightUsagesHandler.getNameIdentifierRange(psiElement.getContainingFile(), target);
    if (declRange != null) {
      if (detector != null && detector.isDeclarationWriteAccess(target)) {
        writeRanges.add(declRange);
      }
      else {
        readRanges.add(declRange);
      }
    }
  }

  return Couple.of(readRanges, writeRanges);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:IdentifierHighlighterPass.java


示例5: startFindUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
public void startFindUsages(@NotNull PsiElement element, @NotNull RelativePoint popupPosition, Editor editor, int maxUsages) {
  Project project = element.getProject();
  FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(element, false);
  if (handler == null) return;
  if (myShowSettingsDialogBefore) {
    showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
    return;
  }
  showElementUsages(editor, popupPosition, handler, maxUsages, handler.getFindUsagesOptions(DataManager.getInstance().getDataContext()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ShowUsagesAction.java


示例6: createPinButton

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
private ActiveComponent createPinButton(@NotNull final FindUsagesHandler handler,
                                        @NotNull final UsageViewImpl usageView,
                                        @NotNull final FindUsagesOptions options,
                                        @NotNull final JBPopup[] popup,
                                        @NotNull DefaultActionGroup pinGroup) {
  final AnAction pinAction =
    new AnAction("Open Find Usages Toolwindow", "Show all usages in a separate toolwindow", AllIcons.General.AutohideOff) {
      {
        AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_USAGES);
        setShortcutSet(action.getShortcutSet());
      }

      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        hideHints();
        cancel(popup);
        FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(usageView.getProject())).getFindUsagesManager();
        findUsagesManager.findUsages(handler.getPrimaryElements(), handler.getSecondaryElements(), handler, options,
                                     FindSettings.getInstance().isSkipResultsWithOneUsage());
      }
    };
  pinGroup.add(pinAction);
  final ActionToolbar pinToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, pinGroup, true);
  pinToolbar.setReservePlaceAutoPopupIcon(false);
  final JComponent pinToolBar = pinToolbar.getComponent();
  pinToolBar.setBorder(null);
  pinToolBar.setOpaque(false);

  return new ActiveComponent.Adapter() {
    @Override
    public JComponent getComponent() {
      return pinToolBar;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:ShowUsagesAction.java


示例7: showSettings

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Override
public void showSettings() {
  PsiElement element = getElement();
  if (element != null) {
    FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(myPointer.getProject())).getFindUsagesManager();
    findUsagesManager.findUsages(element, null, null, true, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PsiElement2UsageTargetAdapter.java


示例8: findUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Override
public void findUsages() {
  PsiElement element = getElement();
  if (element == null) return;
  FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(element.getProject())).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(element, false);
  boolean skipResultsWithOneUsage = FindSettings.getInstance().isSkipResultsWithOneUsage();
  findUsagesManager.findUsages(myDescriptor.getPrimaryElements(), myDescriptor.getAdditionalElements(), handler, myOptions, skipResultsWithOneUsage);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiElement2UsageTargetComposite.java


示例9: highlightTargetUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
private void highlightTargetUsages(@NotNull PsiElement target) {
  final ReadWriteAccessDetector detector = ReadWriteAccessDetector.findDetector(target);
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(target.getProject())).getFindUsagesManager();
  final FindUsagesHandler findUsagesHandler = findUsagesManager.getFindUsagesHandler(target, true);
  final LocalSearchScope scope = new LocalSearchScope(myFile);
  Collection<PsiReference> refs = findUsagesHandler != null
                            ? findUsagesHandler.findReferencesToHighlight(target, scope)
                            : ReferencesSearch.search(target, scope).findAll();
  for (PsiReference psiReference : refs) {
    final List<TextRange> textRanges = HighlightUsagesHandler.getRangesToHighlight(psiReference);
    if (detector == null || detector.getReferenceAccess(target, psiReference) == ReadWriteAccessDetector.Access.Read) {
      myReadAccessRanges.addAll(textRanges);
    }
    else {
      myWriteAccessRanges.addAll(textRanges);
    }
  }

  final TextRange declRange = HighlightUsagesHandler.getNameIdentifierRange(myFile, target);
  if (declRange != null) {
    if (detector != null && detector.isDeclarationWriteAccess(target)) {
      myWriteAccessRanges.add(declRange);
    }
    else {
      myReadAccessRanges.add(declRange);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:IdentifierHighlighterPass.java


示例10: startFindUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
private void startFindUsages(@NotNull PsiElement element, @NotNull RelativePoint popupPosition, Editor editor, int maxUsages) {
  Project project = element.getProject();
  FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getNewFindUsagesHandler(element, false);
  if (handler == null) return;
  if (showSettingsDialogBefore) {
    showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
    return;
  }
  showElementUsages(handler, editor, popupPosition, maxUsages, getDefaultOptions(handler));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ShowUsagesAction.java


示例11: startFindUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
public void startFindUsages(@NotNull PsiElement element, @NotNull RelativePoint popupPosition,
    Editor editor, int maxUsages) {
  Project project = element.getProject();
  FindUsagesManager findUsagesManager =
      ((FindManagerImpl) FindManager.getInstance(project)).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getNewFindUsagesHandler(element, false);
  if (handler == null) return;
  if (showSettingsDialogBefore) {
    showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
    return;
  }
  showElementUsages(handler, editor, popupPosition, maxUsages, getDefaultOptions(handler));
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:14,代码来源:ShowUsagesAction.java


示例12: getUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Nonnull
private static Couple<Collection<TextRange>> getUsages(@Nonnull PsiElement target, PsiElement psiElement, boolean withDeclarations, boolean detectAccess) {
  List<TextRange> readRanges = new ArrayList<>();
  List<TextRange> writeRanges = new ArrayList<>();
  final ReadWriteAccessDetector detector = detectAccess ? ReadWriteAccessDetector.findDetector(target) : null;
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(target.getProject())).getFindUsagesManager();
  final FindUsagesHandler findUsagesHandler = findUsagesManager.getFindUsagesHandler(target, true);
  final LocalSearchScope scope = new LocalSearchScope(psiElement);
  Collection<PsiReference> refs = findUsagesHandler != null
                                  ? findUsagesHandler.findReferencesToHighlight(target, scope)
                                  : ReferencesSearch.search(target, scope).findAll();
  for (PsiReference psiReference : refs) {
    if (psiReference == null) {
      LOG.error("Null reference returned, findUsagesHandler=" + findUsagesHandler + "; target=" + target + " of " + target.getClass());
      continue;
    }
    List<TextRange> destination;
    if (detector == null || detector.getReferenceAccess(target, psiReference) == ReadWriteAccessDetector.Access.Read) {
      destination = readRanges;
    }
    else {
      destination = writeRanges;
    }
    HighlightUsagesHandler.collectRangesToHighlight(psiReference, destination);
  }

  if (withDeclarations) {
    final TextRange declRange = HighlightUsagesHandler.getNameIdentifierRange(psiElement.getContainingFile(), target);
    if (declRange != null) {
      if (detector != null && detector.isDeclarationWriteAccess(target)) {
        writeRanges.add(declRange);
      }
      else {
        readRanges.add(declRange);
      }
    }
  }

  return Couple.<Collection<TextRange>>of(readRanges, writeRanges);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:IdentifierHighlighterPass.java


示例13: startFindInProject

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
public void startFindInProject(@Nonnull FindModel findModel) {
  if (findModel.getDirectoryName() != null && FindInProjectUtil.getDirectory(findModel) == null) {
    return;
  }

  com.intellij.usages.UsageViewManager manager = com.intellij.usages.UsageViewManager.getInstance(myProject);

  if (manager == null) return;
  final FindManager findManager = FindManager.getInstance(myProject);
  findManager.getFindInProjectModel().copyFrom(findModel);
  final FindModel findModelCopy = findModel.clone();
  final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(FindSettings.getInstance().isShowResultsInSeparateView(), findModelCopy);
  final boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();

  final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
  ConfigurableUsageTarget usageTarget = new FindInProjectUtil.StringUsageTarget(myProject, findModel);

  ((FindManagerImpl)FindManager.getInstance(myProject)).getFindUsagesManager().addToHistory(usageTarget);

  manager.searchAndShowUsages(new UsageTarget[]{usageTarget}, () -> processor -> {
    myIsFindInProgress = true;

    try {
      Processor<UsageInfo> consumer = info -> {
        Usage usage = UsageInfo2UsageAdapter.CONVERTER.fun(info);
        usage.getPresentation().getIcon(); // cache icon
        return processor.process(usage);
      };
      FindInProjectUtil.findUsages(findModelCopy, myProject, consumer, processPresentation);
    }
    finally {
      myIsFindInProgress = false;
    }
  }, processPresentation, presentation, null);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:FindInProjectManager.java


示例14: startFindUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
public void startFindUsages(@Nonnull PsiElement element, @Nonnull RelativePoint popupPosition, Editor editor, int maxUsages) {
  Project project = element.getProject();
  FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(element, false);
  if (handler == null) return;
  if (myShowSettingsDialogBefore) {
    showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
    return;
  }
  showElementUsages(editor, popupPosition, handler, maxUsages, handler.getFindUsagesOptions(DataManager.getInstance().getDataContext()));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ShowUsagesAction.java


示例15: createPinButton

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
private ActiveComponent createPinButton(@Nonnull final FindUsagesHandler handler,
                                        @Nonnull final UsageViewImpl usageView,
                                        @Nonnull final FindUsagesOptions options,
                                        @Nonnull final JBPopup[] popup,
                                        @Nonnull DefaultActionGroup pinGroup) {
  final AnAction pinAction = new AnAction("Open Find Usages Toolwindow", "Show all usages in a separate toolwindow", AllIcons.General.AutohideOff) {
    {
      AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_USAGES);
      setShortcutSet(action.getShortcutSet());
    }

    @Override
    public boolean startInTransaction() {
      return true;
    }

    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      hideHints();
      cancel(popup[0]);
      FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(usageView.getProject())).getFindUsagesManager();
      findUsagesManager.findUsages(handler.getPrimaryElements(), handler.getSecondaryElements(), handler, options,
                                   FindSettings.getInstance().isSkipResultsWithOneUsage());
    }
  };
  pinGroup.add(pinAction);
  final ActionToolbar pinToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, pinGroup, true);
  pinToolbar.setReservePlaceAutoPopupIcon(false);
  final JComponent pinToolBar = pinToolbar.getComponent();
  pinToolBar.setBorder(null);
  pinToolBar.setOpaque(false);

  return new ActiveComponent.Adapter() {
    @Override
    public JComponent getComponent() {
      return pinToolBar;
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:40,代码来源:ShowUsagesAction.java


示例16: OttoProjectHandler

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
protected OttoProjectHandler(Project project, PsiManager psiManager) {
  super(project);
  this.findUsagesManager =
      ((FindManagerImpl) FindManager.getInstance(project)).getFindUsagesManager();
  this.psiManager = psiManager;
  project.putUserData(KEY, this);
  //System.out.println("OttoProjectHandler initialized");
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:9,代码来源:OttoProjectHandler.java


示例17: startFindUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
void startFindUsages(@NotNull PsiElement element, @NotNull RelativePoint popupPosition, Editor editor, int maxUsages) {
  Project project = element.getProject();
  FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
  FindUsagesHandler handler = findUsagesManager.getNewFindUsagesHandler(element, false);
  if (handler == null) return;
  if (showSettingsDialogBefore) {
    showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
    return;
  }
  showElementUsages(handler, editor, popupPosition, maxUsages, getDefaultOptions(handler));
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:12,代码来源:ShowUsagesAction.java


示例18: getUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@NotNull
private static Couple<List<TextRange>> getUsages(@NotNull PsiElement target,
        @NotNull PsiElement psiElement) {
    List<TextRange> readRanges = new ArrayList<>();
    List<TextRange> writeRanges = new ArrayList<>();
    final ReadWriteAccessDetector detector = ReadWriteAccessDetector.findDetector(target);
    final FindUsagesManager findUsagesManager = ((FindManagerImpl) FindManager.getInstance(
            target.getProject())).getFindUsagesManager();
    final FindUsagesHandler findUsagesHandler =
            findUsagesManager.getFindUsagesHandler(target, true);
    final LocalSearchScope scope = new LocalSearchScope(psiElement);
    Collection<PsiReference> refs =
            findUsagesHandler != null ? findUsagesHandler.findReferencesToHighlight(target,
                    scope) : ReferencesSearch.search(target, scope).findAll();
    for (PsiReference psiReference : refs) {
        if (psiReference == null) {
            Log.error("Null reference returned, findUsagesHandler=" + findUsagesHandler
                    + "; target=" + target + " of " + target.getClass());
            continue;
        }
        List<TextRange> destination;
        if (detector == null || detector.getReferenceAccess(target, psiReference)
                == ReadWriteAccessDetector.Access.Read) {
            destination = readRanges;
        } else {
            destination = writeRanges;
        }
        HighlightUsagesHandler.collectRangesToHighlight(psiReference, destination);
    }
    
    final TextRange declareRange =
            HighlightUsagesHandler.getNameIdentifierRange(psiElement.getContainingFile(),
                    target);
    if (declareRange != null) {
        if (detector != null && detector.isDeclarationWriteAccess(target)) {
            writeRanges.add(declareRange);
        } else {
            readRanges.add(declareRange);
        }
    }
    
    return Couple.of(readRanges, writeRanges);
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:44,代码来源:MultiHighlightHandler.java


示例19: startFindInProject

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
public void startFindInProject(@NotNull FindModel findModel) {
  if (findModel.getDirectoryName() != null && FindInProjectUtil.getDirectory(findModel) == null) {
    return;
  }

  com.intellij.usages.UsageViewManager manager = com.intellij.usages.UsageViewManager.getInstance(myProject);

  if (manager == null) return;
  final FindManager findManager = FindManager.getInstance(myProject);
  findManager.getFindInProjectModel().copyFrom(findModel);
  final FindModel findModelCopy = findModel.clone();
  final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(FindSettings.getInstance().isShowResultsInSeparateView(), findModelCopy);
  final boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();

  final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
  ConfigurableUsageTarget usageTarget = new FindInProjectUtil.StringUsageTarget(myProject, findModel);

  ((FindManagerImpl)FindManager.getInstance(myProject)).getFindUsagesManager().addToHistory(usageTarget);

  manager.searchAndShowUsages(new UsageTarget[] {usageTarget},
    new Factory<UsageSearcher>() {
      @Override
      public UsageSearcher create() {
        return new UsageSearcher() {
          @Override
          public void generate(@NotNull final Processor<Usage> processor) {
            myIsFindInProgress = true;

            try {
              Processor<UsageInfo> consumer = new Processor<UsageInfo>() {
                @Override
                public boolean process(UsageInfo info) {
                  Usage usage = UsageInfo2UsageAdapter.CONVERTER.fun(info);
                  usage.getPresentation().getIcon(); // cache icon
                  return processor.process(usage);
                }
              };
              FindInProjectUtil.findUsages(findModelCopy, myProject, consumer, processPresentation);
            }
            finally {
              myIsFindInProgress = false;
            }
          }
        };
      }
    },
    processPresentation,
    presentation,
    null
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:FindInProjectManager.java


示例20: findUsages

import com.intellij.find.impl.FindManagerImpl; //导入依赖的package包/类
@Override
public void findUsages() {
  PsiElement element = getElement();
  if (element == null) return;
  ((FindManagerImpl)FindManager.getInstance(element.getProject())).getFindUsagesManager().startFindUsages(element, myOptions, null, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PsiElement2UsageTargetAdapter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ICommonViewerSite类代码示例发布时间:2022-05-23
下一篇:
Java OnEmojiPopupDismissListener类代码示例发布时间: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