com.intellij.usages.UsageViewManager Java Examples

The following examples show how to use com.intellij.usages.UsageViewManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FindManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Inject
public FindManagerImpl(Project project, FindSettings findSettings, UsageViewManager anotherManager) {
  myProject = project;
  myBus = project.getMessageBus();
  findSettings.initModelBySetings(myFindInProjectModel);

  myFindInFileModel.setCaseSensitive(findSettings.isLocalCaseSensitive());
  myFindInFileModel.setWholeWordsOnly(findSettings.isLocalWholeWordsOnly());
  myFindInFileModel.setRegularExpressions(findSettings.isLocalRegularExpressions());

  myFindUsagesManager = new FindUsagesManager(myProject, anotherManager);
  myFindInProjectModel.setMultipleFiles(true);

  NotificationsConfigurationImpl.remove("FindInPath");
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      if (myHelper != null) {
        Disposer.dispose(myHelper);
      }
    }
  });
}
 
Example #2
Source File: LSPReferencesAction.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
private void showReferences(Editor editor, List<PsiElement2UsageTargetAdapter> targets, LogicalPosition position) {
    if (targets.isEmpty()) {
        short constraint = HintManager.ABOVE;
        int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
        JLabel label = new JLabel("No references found");
        label.setBackground(new JBColor(new Color(150, 0, 0), new Color(150, 0, 0)));
        LightweightHint hint = new LightweightHint(label);
        Point p = HintManagerImpl.getHintPosition(hint, editor, position, constraint);
        HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, p, flags, 0, false,
                HintManagerImpl.createHintHint(editor, p, hint, constraint).setContentActive(false));
    } else {
        List<Usage> usages = new ArrayList<>();
        targets.forEach(ut -> {
            PsiElement elem = ut.getElement();
            usages.add(new UsageInfo2UsageAdapter(new UsageInfo(elem, -1, -1, false)));
        });

        if (editor == null) {
            return;
        }
        Project project = editor.getProject();
        if (project == null) {
            return;
        }
        UsageViewPresentation presentation = createPresentation(targets.get(0).getElement(),
                new FindUsagesOptions(editor.getProject()), false);
        UsageViewManager.getInstance(project)
                .showUsages(new UsageTarget[] { targets.get(0) }, usages.toArray(new Usage[usages.size()]),
                        presentation);
    }
}
 
Example #3
Source File: SafeDeleteProcessorDelegateBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public UsageView showUsages(UsageInfo[] usages, UsageViewPresentation presentation, UsageViewManager manager, PsiElement[] elements) {
  return null;
}