本文整理汇总了Java中com.intellij.usages.UsageView类的典型用法代码示例。如果您正苦于以下问题:Java UsageView类的具体用法?Java UsageView怎么用?Java UsageView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsageView类属于com.intellij.usages包,在下文中一共展示了UsageView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFilteringActions
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] createFilteringActions(@NotNull UsageView view) {
final UsageViewImpl impl = (UsageViewImpl)view;
if (!view.getPresentation().isCodeUsages()) {
return AnAction.EMPTY_ARRAY;
}
final JComponent component = view.getComponent();
final ShowReadAccessUsagesAction read = new ShowReadAccessUsagesAction();
read.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)), component, impl);
final ShowWriteAccessUsagesAction write = new ShowWriteAccessUsagesAction();
write.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)), component, impl);
return new AnAction[] {read, write};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:UsageFilteringRuleProviderImpl.java
示例2: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
public final void update(@NotNull UsageView view) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
boolean isExcluded = isDataExcluded();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(READ_ONLY_MASK);
boolean cachedExcluded = isFlagSet(EXCLUDED_MASK);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || isExcluded != cachedExcluded || !Comparing.equal(myCachedText, text)) {
setFlag(INVALID_MASK, !isDataValid);
setFlag(READ_ONLY_MASK, isReadOnly);
setFlag(EXCLUDED_MASK, isExcluded);
myCachedText = text;
updateNotify();
myTreeModel.nodeChanged(this);
}
setFlag(UPDATED_MASK, true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:Node.java
示例3: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
@NotNull ImplementationViewComponent component,
String title,
@NotNull AbstractPopup popup,
@NotNull Ref<UsageView> usageView) {
final ImplementationsUpdaterTask updaterTask = SoftReference.dereference(myTaskRef);
cancelTask(updaterTask);
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<ImplementationsUpdaterTask>(task);
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ShowImplementationsAction.java
示例4: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return false;
}
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
UsageTarget[] target = UsageView.USAGE_TARGETS_KEY.getData(dataContext);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FindUsagesInFileAction.java
示例5: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
public final void update(@NotNull UsageView view) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
boolean isExcluded = isDataExcluded();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(READ_ONLY_FLAG);
boolean cachedExcluded = isFlagSet(EXCLUDED_FLAG);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || isExcluded != cachedExcluded || !Comparing.equal(myCachedText, text)) {
setFlag(INVALID_FLAG, !isDataValid);
setFlag(READ_ONLY_FLAG, isReadOnly);
setFlag(EXCLUDED_FLAG, isExcluded);
myCachedText = text;
updateNotify();
myTreeModel.nodeChanged(this);
}
setFlag(UPDATED_FLAG, true);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:Node.java
示例6: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
ImplementationViewComponent component,
String title,
AbstractPopup popup, Ref<UsageView> usageView) {
if (myTaskRef != null) {
final BackgroundUpdaterTask updaterTask = myTaskRef.get();
if (updaterTask != null) {
updaterTask.setCanceled();
}
}
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<BackgroundUpdaterTask>(task);
ProgressManager.getInstance().run(task);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ShowImplementationsAction.java
示例7: isAvailableFor
import com.intellij.usages.UsageView; //导入依赖的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
示例8: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return false;
}
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
UsageTarget[] target = UsageView.USAGE_TARGETS_KEY.getData(dataContext);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:FindUsagesInFileAction.java
示例9: calcData
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public void calcData(final Key<?> key, final DataSink sink)
{
T element = myPointer.getElement();
if(element == null)
{
return;
}
if(LangDataKeys.PSI_ELEMENT == key)
{
sink.put(LangDataKeys.PSI_ELEMENT, element);
}
if(UsageView.USAGE_INFO_KEY == key)
{
sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
}
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:18,代码来源:CSharpBaseGroupingRule.java
示例10: createFilteringActions
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
@Nonnull
public AnAction[] createFilteringActions(@Nonnull UsageView view) {
final UsageViewImpl impl = (UsageViewImpl)view;
if (!view.getPresentation().isCodeUsages()) {
return AnAction.EMPTY_ARRAY;
}
final JComponent component = view.getComponent();
final ShowReadAccessUsagesAction read = new ShowReadAccessUsagesAction();
read.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)), component, impl);
final ShowWriteAccessUsagesAction write = new ShowWriteAccessUsagesAction();
write.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)), component, impl);
return new AnAction[] {read, write};
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:UsageFilteringRuleProviderImpl.java
示例11: update
import com.intellij.usages.UsageView; //导入依赖的package包/类
final synchronized void update(@Nonnull UsageView view, @Nonnull Consumer<Node> edtNodeChangedQueue) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
String text = getText(view);
boolean cachedValid = isValid();
boolean cachedReadOnly = isFlagSet(CACHED_READ_ONLY_MASK);
if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || myCachedTextHash != text.hashCode()) {
setFlag(CACHED_INVALID_MASK, !isDataValid);
setFlag(CACHED_READ_ONLY_MASK, isReadOnly);
myCachedTextHash = text.hashCode();
updateNotify();
edtNodeChangedQueue.consume(this);
}
setFlag(UPDATED_MASK, true);
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:Node.java
示例12: updateInBackground
import com.intellij.usages.UsageView; //导入依赖的package包/类
private void updateInBackground(Editor editor,
@Nullable PsiElement element,
@Nonnull ImplementationViewComponent component,
String title,
@Nonnull AbstractPopup popup,
@Nonnull Ref<UsageView> usageView) {
final ImplementationsUpdaterTask updaterTask = SoftReference.dereference(myTaskRef);
if (updaterTask != null) {
updaterTask.cancelTask();
}
if (element == null) return; //already found
final ImplementationsUpdaterTask task = new ImplementationsUpdaterTask(element, editor, title, isIncludeAlwaysSelf());
task.init(popup, component, usageView);
myTaskRef = new WeakReference<>(task);
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task));
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ShowImplementationsAction.java
示例13: isEnabled
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static boolean isEnabled(DataContext dataContext) {
Project project = dataContext.getData(CommonDataKeys.PROJECT);
if (project == null) {
return false;
}
Editor editor = dataContext.getData(PlatformDataKeys.EDITOR);
if (editor == null) {
UsageTarget[] target = dataContext.getData(UsageView.USAGE_TARGETS_KEY);
return target != null && target.length > 0;
}
else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:FindUsagesInFileAction.java
示例14: calcData
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public void calcData(final Key<?> key, final DataSink sink)
{
if(!isValid())
{
return;
}
if(LangDataKeys.PSI_ELEMENT == key)
{
sink.put(LangDataKeys.PSI_ELEMENT, getElement());
}
if(UsageView.USAGE_INFO_KEY == key)
{
T element = getElement();
if(element != null)
{
sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));
}
}
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:21,代码来源:JavaScriptGroupRuleProviderBase.java
示例15: isAvailableFor
import com.intellij.usages.UsageView; //导入依赖的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
示例16: actionPerformed
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTabName("Statics");
presentation.setTabText("Statitcs");
final UsageView view = UsageViewManager.getInstance(project).showUsages(UsageTarget.EMPTY_ARRAY, new Usage[0], presentation);
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Searching icons usages") {
@Override
public void run(@NotNull ProgressIndicator indicator) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
GlobalSearchScope all = GlobalSearchScope.allScope(project);
PsiClass allIcons = facade.findClass("com.intellij.icons.AllIcons", all);
searchFields(allIcons, view, indicator);
for (PsiClass iconsClass : facade.findPackage("icons").getClasses(all)) {
searchFields(iconsClass, view, indicator);
}
}
});
}
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:StaticIconFieldsAction.java
示例17: searchFields
import com.intellij.usages.UsageView; //导入依赖的package包/类
private static void searchFields(PsiClass allIcons, final UsageView view, ProgressIndicator indicator) {
indicator.setText("Searching for: " + allIcons.getQualifiedName());
ReferencesSearch.search(allIcons).forEach(new Processor<PsiReference>() {
@Override
public boolean process(PsiReference reference) {
PsiElement elt = reference.getElement();
while (elt instanceof PsiExpression) elt = elt.getParent();
if (elt instanceof PsiField) {
UsageInfo info = new UsageInfo(elt, false);
view.appendUsage(new UsageInfo2UsageAdapter(info));
}
return true;
}
});
}
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:StaticIconFieldsAction.java
示例18: createFilteringActions
import com.intellij.usages.UsageView; //导入依赖的package包/类
@NotNull
@Override
public AnAction[] createFilteringActions(@NotNull UsageView view) {
if (isNormalFindUsagesDialogAndNotShowUsages(view)) {
return new AnAction[]{
new FilterByJGivenStateAction(scenarioStateAnnotationProvider, view)
};
}
return new AnAction[0];
}
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:11,代码来源:ScenarioStateFilteringRuleProvider.java
示例19: canShowSettings
import com.intellij.usages.UsageView; //导入依赖的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
示例20: calcData
import com.intellij.usages.UsageView; //导入依赖的package包/类
@Override
public void calcData(final DataKey key, final DataSink sink) {
if (!isValid()) return;
if (CommonDataKeys.PSI_ELEMENT == key) {
sink.put(CommonDataKeys.PSI_ELEMENT, getPsiClass());
}
if (UsageView.USAGE_INFO_KEY == key) {
PsiClass psiClass = getPsiClass();
if (psiClass != null) {
sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(psiClass));
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ClassGroupingRule.java
注:本文中的com.intellij.usages.UsageView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论