本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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();
}
}
);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
});
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}