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


Java UsageViewImpl类代码示例

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


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


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