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

Java UsageViewImpl类代码示例

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

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



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

示例1: isAvailableFor

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView) {
  UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets();
  if (targets.length == 0) return false;
  UsageTarget target = targets[0];
  if (!(target instanceof PsiElementUsageTarget)) return false;
  PsiElement element = ((PsiElementUsageTarget)target).getElement();
  if (element == null || !element.isValid()) return false;

  Project project = element.getProject();
  DataContext context = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.getName(), element,
                                                           SimpleDataContext.getProjectContext(project));
  HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context);
  if (provider == null) return false;
  PsiElement providerTarget = provider.getTarget(context);
  return providerTarget != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UsageContextCallHierarchyPanel.java


示例2: replaceUsagesUnderCommand

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
private void replaceUsagesUnderCommand(@NotNull final ReplaceContext replaceContext, @Nullable final Set<Usage> usagesSet) {
  if (usagesSet == null) {
    return;
  }

  final List<Usage> usages = new ArrayList<Usage>(usagesSet);
  Collections.sort(usages, UsageViewImpl.USAGE_COMPARATOR);

  if (!ensureUsagesWritable(replaceContext, usages)) return;

  CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      final boolean success = replaceUsages(replaceContext, usages);
      final UsageView usageView = replaceContext.getUsageView();

      if (closeUsageViewIfEmpty(usageView, success)) return;
      usageView.getComponent().requestFocus();
    }
  }, FindBundle.message("find.replace.command"), null);

  replaceContext.invalidateExcludedSetCache();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ReplaceInProjectManager.java


示例3: isAvailableFor

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView) {
  UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets();
  if (targets.length == 0) return false;
  UsageTarget target = targets[0];
  if (!(target instanceof PsiElementUsageTarget)) return false;
  PsiElement element = ((PsiElementUsageTarget)target).getElement();
  if (element == null || !element.isValid()) return false;

  Project project = element.getProject();
  DataContext context = SimpleDataContext.getSimpleContext(LangDataKeys.PSI_ELEMENT.getName(), element,
                                                           SimpleDataContext.getProjectContext(project));
  HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context);
  if (provider == null) return false;
  PsiElement providerTarget = provider.getTarget(context);
  return providerTarget != null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:UsageContextCallHierarchyPanel.java


示例4: createSettingsButton

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private InplaceButton createSettingsButton(@NotNull final FindUsagesHandler handler,
    @NotNull final RelativePoint popupPosition, final Editor editor, final int maxUsages,
    @NotNull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings,
      new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
              showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
            }
          });
          cancelAction.run();
        }
      }
  );
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:25,代码来源:ShowUsagesAction.java


示例5: setTableModel

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private static MyModel setTableModel(@NotNull JTable table, @NotNull UsageViewImpl usageView,
    @NotNull final List<UsageNode> data) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  final int columnCount = calcColumnCount(data);
  MyModel model = table.getModel() instanceof MyModel ? (MyModel) table.getModel() : null;
  if (model == null || model.getColumnCount() != columnCount) {
    model = new MyModel(data, columnCount);
    table.setModel(model);

    ShowUsagesTableCellRenderer renderer = new ShowUsagesTableCellRenderer(usageView);
    for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
      TableColumn column = table.getColumnModel().getColumn(i);
      column.setCellRenderer(renderer);
    }
  }
  return model;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:19,代码来源:ShowUsagesAction.java


示例6: collectData

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private static List<UsageNode> collectData(@NotNull List<Usage> usages,
    @NotNull Collection<UsageNode> visibleNodes, @NotNull UsageViewImpl usageView,
    @NotNull UsageViewPresentation presentation) {
  @NotNull List<UsageNode> data = new ArrayList<UsageNode>();
  int filtered = filtered(usages, usageView);
  if (filtered != 0) {
    data.add(createStringNode(UsageViewBundle.message("usages.were.filtered.out", filtered)));
  }
  data.addAll(visibleNodes);
  if (data.isEmpty()) {
    String progressText = UsageViewManagerImpl.getProgressTitle(presentation);
    data.add(createStringNode(progressText));
  }
  Collections.sort(data, USAGE_NODE_COMPARATOR);
  return data;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:18,代码来源:ShowUsagesAction.java


示例7: isAvailableFor

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@Nonnull UsageView usageView) {
  UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets();
  if (targets.length == 0) return false;
  UsageTarget target = targets[0];
  if (!(target instanceof PsiElementUsageTarget)) return false;
  PsiElement element = ((PsiElementUsageTarget)target).getElement();
  if (element == null || !element.isValid()) return false;

  Project project = element.getProject();
  DataContext context = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT, element,
                                                           SimpleDataContext.getProjectContext(project));
  HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context);
  if (provider == null) return false;
  PsiElement providerTarget = provider.getTarget(context);
  return providerTarget != null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:UsageContextCallHierarchyPanel.java


示例8: replaceUsagesUnderCommand

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
private void replaceUsagesUnderCommand(@Nonnull final ReplaceContext replaceContext, @Nullable final Set<Usage> usagesSet) {
  if (usagesSet == null) {
    return;
  }

  final List<Usage> usages = new ArrayList<>(usagesSet);
  Collections.sort(usages, UsageViewImpl.USAGE_COMPARATOR);

  if (!ensureUsagesWritable(replaceContext, usages)) return;

  CommandProcessor.getInstance().executeCommand(myProject, () -> {
    final boolean success = replaceUsages(replaceContext, usages);
    final UsageView usageView = replaceContext.getUsageView();

    if (closeUsageViewIfEmpty(usageView, success)) return;
    IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
      IdeFocusManager.getGlobalInstance().requestFocus(usageView.getComponent(), true);
    });
  }, FindBundle.message("find.replace.command"), null);

  replaceContext.invalidateExcludedSetCache();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ReplaceInProjectManager.java


示例9: isAvailableFor

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView)
{
	UsageTarget[] targets = ((UsageViewImpl) usageView).getTargets();
	if(targets.length == 0)
	{
		return false;
	}
	UsageTarget target = targets[0];
	if(!(target instanceof PsiElementUsageTarget))
	{
		return false;
	}
	PsiElement element = ((PsiElementUsageTarget) target).getElement();
	if(element == null || !element.isValid())
	{
		return false;
	}
	if(!(element instanceof PsiVariable))
	{
		return false;
	}
	PsiFile file = element.getContainingFile();
	return file instanceof PsiJavaFile;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:UsageContextDataflowToPanel.java


示例10: createSettingsButton

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private InplaceButton createSettingsButton(@NotNull final FindUsagesHandler handler,
    @NotNull final RelativePoint popupPosition,
    final Editor editor,
    final int maxUsages,
    @NotNull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
        }
      });
      cancelAction.run();
    }
  });
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:25,代码来源:ShowUsagesAction.java


示例11: setTableModel

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private static MyModel setTableModel(@NotNull JTable table,
    @NotNull UsageViewImpl usageView,
    @NotNull final List<UsageNode> data) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  final int columnCount = calcColumnCount(data);
  MyModel model = table.getModel() instanceof MyModel ? (MyModel)table.getModel() : null;
  if (model == null || model.getColumnCount() != columnCount) {
    model = new MyModel(data, columnCount);
    table.setModel(model);

    ShowUsagesTableCellRenderer renderer = new ShowUsagesTableCellRenderer(usageView);
    for (int i=0;i<table.getColumnModel().getColumnCount();i++) {
      TableColumn column = table.getColumnModel().getColumn(i);
      column.setCellRenderer(renderer);
    }
  }
  return model;
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:20,代码来源:ShowUsagesAction.java


示例12: collectData

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@NotNull
private static List<UsageNode> collectData(@NotNull List<Usage> usages,
    @NotNull Collection<UsageNode> visibleNodes,
    @NotNull UsageViewImpl usageView,
    @NotNull UsageViewPresentation presentation) {
  @NotNull List<UsageNode> data = new ArrayList<UsageNode>();
  int filtered = filtered(usages, usageView);
  if (filtered != 0) {
    data.add(createStringNode(UsageViewBundle.message("usages.were.filtered.out", filtered)));
  }
  data.addAll(visibleNodes);
  if (data.isEmpty()) {
    String progressText = UsageViewManagerImpl.getProgressTitle(presentation);
    data.add(createStringNode(progressText));
  }
  Collections.sort(data, USAGE_NODE_COMPARATOR);
  return data;
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:19,代码来源:ShowUsagesAction.java


示例13: canShowSettings

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
private boolean canShowSettings(UsageView usageView) {
    if (!(usageView instanceof UsageViewImpl)) {
        return false;
    }
    UsageViewImpl usageViewImpl = (UsageViewImpl) usageView;
    return stream(usageViewImpl.getTargets())
            .anyMatch(t -> t instanceof ConfigurableUsageTarget);
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:9,代码来源:ScenarioStateFilteringRuleProvider.java


示例14: isAvailableFor

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public boolean isAvailableFor(@NotNull UsageView usageView) {
  UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets();
  if (targets.length == 0) return false;
  UsageTarget target = targets[0];
  if (!(target instanceof PsiElementUsageTarget)) return false;
  PsiElement element = ((PsiElementUsageTarget)target).getElement();
  if (element == null || !element.isValid()) return false;
  if (!(element instanceof PsiVariable)) return false;
  PsiFile file = element.getContainingFile();
  return file instanceof PsiJavaFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:UsageContextDataflowToPanel.java


示例15: actionPerformed

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  UsageView usageView = UsageView.USAGE_VIEW_KEY.getData(e.getDataContext());
  if (usageView instanceof UsageViewImpl) {
    ((UsageViewImpl)usageView).refreshUsages();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RerunSearchAction.java


示例16: dispose

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
public void dispose() {
  //myPresentation = null;
  myComponent.removeAll();
  for (UsageViewImpl view : myViews) {
    Disposer.dispose(view);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UsagesPreviewPanelProvider.java


示例17: initComponent

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Override
protected Boolean initComponent(final Pair<UsageViewImpl, ? extends JTable> content, boolean requestFocus) {
  myComponent.removeAll();
  myComponent.add(content.second);
  myViews.add(content.first);
  return Boolean.TRUE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:UsagesPreviewPanelProvider.java


示例18: updateComponent

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
public boolean updateComponent(final PsiElement element, @Nullable final Comparator comparator) {
  final UsageView view = myUsageView.get();
  if (view != null && !((UsageViewImpl)view).isDisposed()) {
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      @Override
      public void run() {
        view.appendUsage(new UsageInfo2UsageAdapter(new UsageInfo(element)));
      }
    });
    return true;
  }

  if (myCanceled) return false;
  if (myPopup.isDisposed()) return false;

  synchronized (lock) {
    if (myData.contains(element)) return true;
    myData.add(element);
  }

  myAlarm.addRequest(new Runnable() {
    @Override
    public void run() {
      myAlarm.cancelAllRequests();
      if (myCanceled) return;
      if (myPopup.isDisposed()) return;
      ArrayList<PsiElement> data = new ArrayList<PsiElement>();
      synchronized (lock) {
        if (comparator != null) {
          Collections.sort(myData, comparator);
        }
        data.addAll(myData);
      }
      replaceModel(data);
      myPopup.setCaption(getCaption(getCurrentSize()));
      myPopup.pack(true, true);
    }
  }, 200, ModalityState.stateForComponent(myPopup.getContent()));
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:BackgroundUpdaterTask.java


示例19: showInUsageView

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
@Nullable
public static UsageView showInUsageView(PsiElement sourceElement, @NotNull final PsiElement[] targets, String title, Project project) {
  if (targets.length == 0) return null;
  final UsageViewPresentation presentation = new UsageViewPresentation();
  presentation.setCodeUsagesString(title);
  presentation.setTabName(title);
  presentation.setTabText(title);
  final UsageTarget[] usageTargets =
    sourceElement == null ? UsageTarget.EMPTY_ARRAY : new UsageTarget[]{new PsiElement2UsageTargetAdapter(sourceElement)};

  final UsageInfoToUsageConverter.TargetElementsDescriptor targetElementsDescriptor =
    sourceElement != null ? new UsageInfoToUsageConverter.TargetElementsDescriptor(sourceElement)
                          : new UsageInfoToUsageConverter.TargetElementsDescriptor(PsiElement.EMPTY_ARRAY);
  final Usage[] usages = {UsageInfoToUsageConverter.convert(targetElementsDescriptor, new UsageInfo(targets[0]))};
  final UsageView view =
    UsageViewManager.getInstance(project).showUsages(usageTargets, usages, presentation);
  ProgressManager.getInstance().run(new Task.Backgroundable(project, "Updating Usage View ...") {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {

      for (int i = 1; i < targets.length; i++) {
        if (((UsageViewImpl)view).isDisposed()) break;
        final PsiElement target = targets[i];
        ApplicationManager.getApplication().runReadAction(new Runnable() {
          @Override
          public void run() {
            final Usage usage = UsageInfoToUsageConverter.convert(targetElementsDescriptor, new UsageInfo(target));
            view.appendUsage(usage);
          }
        });
      }
    }
  });
  return view;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:FindUtil.java


示例20: filtered

import com.intellij.usages.impl.UsageViewImpl; //导入依赖的package包/类
private static int filtered(@NotNull List<Usage> usages, @NotNull UsageViewImpl usageView) {
  int count = 0;
  for (Usage usage : usages) {
    if (!usageView.isVisible(usage)) count++;
  }
  return count;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:8,代码来源:ShowUsagesAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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