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


Java PsiElementListNavigator类代码示例

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


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

示例1: browse

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void browse(MouseEvent e, PsiElement element) {
  PsiElement parent = element.getParent();
  if (!(parent instanceof GrField)) return;
  final GrField field = (GrField)parent;
  final List<GrAccessorMethod> accessors = GroovyPropertyUtils.getFieldAccessors(field);
  final ArrayList<PsiMethod> superMethods = new ArrayList<PsiMethod>();
  for (GrAccessorMethod method : accessors) {
    Collections.addAll(superMethods, method.findSuperMethods(false));
  }
  if (superMethods.isEmpty()) return;
  final PsiMethod[] supers = ContainerUtil.toArray(superMethods, new PsiMethod[superMethods.size()]);
  boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature(supers);
  PsiElementListNavigator.openTargets(e, supers, 
                                      DaemonBundle.message("navigation.title.super.method", field.getName()),
                                      DaemonBundle.message("navigation.findUsages.title.super.method", field.getName()),
                                      new MethodCellRenderer(showMethodNames));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyMarkerTypes.java

示例2: openTargets

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@RequiredReadAction
public static void openTargets(@NotNull Collection<? extends PsiElement> members, @NotNull MouseEvent mouseEvent, @NotNull String text, @NotNull final Function<PsiElement, PsiElement> map)
{
	NavigatablePsiElement[] navigatablePsiElements = members.toArray(new NavigatablePsiElement[members.size()]);
	ContainerUtil.sort(navigatablePsiElements, (o1, o2) ->
	{
		PsiElement map1 = map.fun(o1);
		PsiElement map2 = map.fun(o2);
		if(map1 instanceof PsiNamedElement && map2 instanceof PsiNamedElement)
		{
			return Comparing.compare(((PsiNamedElement) map1).getName(), ((PsiNamedElement) map2).getName());
		}
		return 0;
	});

	PsiElementListNavigator.openTargets(mouseEvent, navigatablePsiElements, text, text, new PsiMappedElementListCellRender(map));
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:18,代码来源:CSharpLineMarkerUtil.java

示例3: tryNavigateToSuperMethod

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
private static void tryNavigateToSuperMethod(Editor editor,
                                             HaxeMethod methodDeclaration,
                                             List<HaxeNamedComponent> superItems) {
  final String methodName = methodDeclaration.getName();
  if (methodName == null) {
    return;
  }
  final List<HaxeNamedComponent> filteredSuperItems = ContainerUtil.filter(superItems, new Condition<HaxeNamedComponent>() {
    @Override
    public boolean value(HaxeNamedComponent component) {
      return methodName.equals(component.getName());
    }
  });
  if (!filteredSuperItems.isEmpty()) {
    PsiElementListNavigator.openTargets(editor, HaxeResolveUtil.getComponentNames(filteredSuperItems)
      .toArray(new NavigatablePsiElement[filteredSuperItems.size()]),
                                        DaemonBundle.message("navigation.title.super.method", methodName),
                                        null,
                                        new DefaultPsiElementCellRenderer());
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:22,代码来源:HaxeGotoSuperHandler.java

示例4: tryNavigateToSuperMethod

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
private static void tryNavigateToSuperMethod(Editor editor,
                                             HaxeComponentWithDeclarationList methodDeclaration,
                                             List<HaxeNamedComponent> superItems) {
  final String methodName = methodDeclaration.getName();
  if (methodName == null) {
    return;
  }
  final List<HaxeNamedComponent> filteredSuperItems = ContainerUtil.filter(superItems, new Condition<HaxeNamedComponent>() {
    @Override
    public boolean value(HaxeNamedComponent component) {
      return methodName.equals(component.getName());
    }
  });
  if (!filteredSuperItems.isEmpty()) {
    PsiElementListNavigator.openTargets(editor, HaxeResolveUtil.getComponentNames(filteredSuperItems)
      .toArray(new NavigatablePsiElement[filteredSuperItems.size()]),
                                        DaemonBundle.message("navigation.title.super.method", methodName),
                                        null,
                                        new DefaultPsiElementCellRenderer());
  }
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:22,代码来源:HaxeGotoSuperHandler.java

示例5: navigate

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void navigate(final MouseEvent e, final T elt)
{
	final List<NavigatablePsiElement> navElements = new ArrayList<NavigatablePsiElement>();
	Query<T> elementQuery = search(elt);
	if(elementQuery == null)
	{
		return;
	}
	elementQuery.forEach(new Processor<T>()
	{
		@Override
		public boolean process(final T psiElement)
		{
			if(psiElement instanceof NavigatablePsiElement)
			{
				navElements.add((NavigatablePsiElement) psiElement);
			}
			return true;
		}
	});
	final NavigatablePsiElement[] methods = navElements.toArray(new NavigatablePsiElement[navElements.size()]);
	PsiElementListNavigator.openTargets(e, methods, getTitle(elt), "", new DefaultPsiElementCellRenderer());
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:25,代码来源:JavaScriptLineMarkerProvider.java

示例6: navigatorToElements

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@NotNull
private LineMarkerNavigator navigatorToElements() {
    return new LineMarkerNavigator() {

        @Override
        public void browse(MouseEvent e, PsiElement element) {
            Optional<PsiField> field = PsiElementUtil.findParentOfTypeOn(element, PsiField.class);
            List<PsiField> references = allReferencingFields(field.orElseThrow(IllegalArgumentException::new));
            PsiElementListNavigator.openTargets(e, Iterables.toArray(references, PsiField.class),
                    "JGiven States", "", new DefaultPsiElementCellRenderer());
        }
    };
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:14,代码来源:LineMarkerProvider.java

示例7: invoke

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
  FeatureUsageTracker.getInstance().triggerFeatureUsed(GotoSuperAction.FEATURE_ID);

  int offset = editor.getCaretModel().getOffset();
  PsiElement[] superElements = findSuperElements(file, offset);
  if (superElements.length == 0) return;
  if (superElements.length == 1) {
    PsiElement superElement = superElements[0].getNavigationElement();
    final PsiFile containingFile = superElement.getContainingFile();
    if (containingFile == null) return;
    final VirtualFile virtualFile = containingFile.getVirtualFile();
    if (virtualFile == null) return;
    OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, superElement.getTextOffset());
    FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
  }
  else if (superElements[0] instanceof PsiMethod) {
    boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature((PsiMethod[])superElements);
    PsiElementListNavigator.openTargets(editor, (PsiMethod[])superElements,
                                        CodeInsightBundle.message("goto.super.method.chooser.title"),
                                        CodeInsightBundle
                                          .message("goto.super.method.findUsages.title", ((PsiMethod)superElements[0]).getName()),
                                        new MethodCellRenderer(showMethodNames));
  }
  else {
    NavigationUtil.getPsiElementPopup(superElements, CodeInsightBundle.message("goto.super.class.chooser.title"))
      .showInBestPositionFor(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:JavaGotoSuperHandler.java

示例8: navigate

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
public void navigate(final MouseEvent e, final T elt) {
  final List<NavigatablePsiElement> navElements = new ArrayList<NavigatablePsiElement>();
  Query<T> elementQuery = search(elt);
  if (elementQuery == null) return;
  elementQuery.forEach(new Processor<T>() {
    public boolean process(final T psiElement) {
      if (psiElement instanceof NavigatablePsiElement) {
        navElements.add((NavigatablePsiElement)psiElement);
      }
      return true;
    }
  });
  final NavigatablePsiElement[] methods = navElements.toArray(new NavigatablePsiElement[navElements.size()]);
  PsiElementListNavigator.openTargets(e, methods, getTitle(elt), null, new DefaultPsiElementCellRenderer());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PyLineMarkerNavigator.java

示例9: invoke

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
  FeatureUsageTracker.getInstance().triggerFeatureUsed(GotoSuperAction.FEATURE_ID);

  int offset = editor.getCaretModel().getOffset();
  PsiElement[] superElements = findSuperElements(file, offset);
  if (superElements == null || superElements.length == 0) return;
  if (superElements.length == 1) {
    PsiElement superElement = superElements[0].getNavigationElement();
    final PsiFile containingFile = superElement.getContainingFile();
    if (containingFile == null) return;
    final VirtualFile virtualFile = containingFile.getVirtualFile();
    if (virtualFile == null) return;
    OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, superElement.getTextOffset());
    FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
  } else {
    if (superElements[0] instanceof PsiMethod) {
      boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature((PsiMethod[])superElements);
      PsiElementListNavigator.openTargets(editor, (PsiMethod[])superElements,
                                          CodeInsightBundle.message("goto.super.method.chooser.title"),
                                          CodeInsightBundle.message("goto.super.method.findUsages.title", ((PsiMethod)superElements[0]).getName()),
                                          new MethodCellRenderer(showMethodNames));
    }
    else {
      NavigationUtil.getPsiElementPopup(superElements, CodeInsightBundle.message("goto.super.class.chooser.title")).showInBestPositionFor(editor);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:JavaGotoSuperHandler.java

示例10: invoke

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
  final PsiElement at = file.findElementAt(editor.getCaretModel().getOffset());
  final HaxeComponentName componentName = PsiTreeUtil.getParentOfType(at, HaxeComponentName.class);

  final HaxeClass haxeClass = PsiTreeUtil.getParentOfType(at, HaxeClass.class);
  final HaxeNamedComponent namedComponent = componentName == null ? haxeClass : (HaxeNamedComponent)componentName.getParent();
  if (at == null || haxeClass == null || namedComponent == null) return;

  final List<HaxeClass> supers = HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getHaxeExtendsList());
  supers.addAll(HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getHaxeImplementsList()));
  final List<HaxeNamedComponent> superItems = HaxeResolveUtil.findNamedSubComponents(false, supers.toArray(new HaxeClass[supers.size()]));

  final HaxeComponentType type = HaxeComponentType.typeOf(namedComponent);
  if (type == HaxeComponentType.METHOD) {
    final HaxeMethod methodDeclaration = (HaxeMethod)namedComponent;
    tryNavigateToSuperMethod(editor, methodDeclaration, superItems);
  }
  else if (!supers.isEmpty() && namedComponent instanceof HaxeClass) {
    PsiElementListNavigator.openTargets(
      editor,
      HaxeResolveUtil.getComponentNames(supers).toArray(new NavigatablePsiElement[supers.size()]),
      DaemonBundle.message("navigation.title.subclass", namedComponent.getName(), supers.size()),
      "Subclasses of " + namedComponent.getName(),
      new DefaultPsiElementCellRenderer()
    );
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:29,代码来源:HaxeGotoSuperHandler.java

示例11: createImplementationMarker

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Nullable
private static LineMarkerInfo createImplementationMarker(final HaxeClass componentWithDeclarationList,
                                                         final List<HaxeClass> items) {
  final HaxeComponentName componentName = componentWithDeclarationList.getComponentName();
  if (componentName == null) {
    return null;
  }
  final PsiElement element = componentName.getIdentifier().getFirstChild();
  return new LineMarkerInfo<>(
    element,
    element.getTextRange(),
    componentWithDeclarationList instanceof HaxeInterfaceDeclaration
    ? AllIcons.Gutter.ImplementedMethod
    : AllIcons.Gutter.OverridenMethod,
    Pass.UPDATE_ALL,
    item -> DaemonBundle.message("method.is.implemented.too.many"),
    new GutterIconNavigationHandler<PsiElement>() {
      @Override
      public void navigate(MouseEvent e, PsiElement elt) {
        PsiElementListNavigator.openTargets(
          e, HaxeResolveUtil.getComponentNames(items).toArray(new NavigatablePsiElement[items.size()]),
          DaemonBundle.message("navigation.title.subclass", componentWithDeclarationList.getName(), items.size()),
          "Subclasses of " + componentWithDeclarationList.getName(),
          new DefaultPsiElementCellRenderer()
        );
      }
    },
    GutterIconRenderer.Alignment.RIGHT
  );
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:31,代码来源:HaxeLineMarkerProvider.java

示例12: invoke

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
  final PsiElement at = file.findElementAt(editor.getCaretModel().getOffset());
  final HaxeComponentName componentName = PsiTreeUtil.getParentOfType(at, HaxeComponentName.class);

  final HaxeClass haxeClass = PsiTreeUtil.getParentOfType(at, HaxeClass.class);
  final HaxeNamedComponent namedComponent = componentName == null ? haxeClass : (HaxeNamedComponent)componentName.getParent();
  if (at == null || haxeClass == null || namedComponent == null) return;

  final List<HaxeClass> supers = HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getExtendsList());
  supers.addAll(HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getImplementsList()));
  final List<HaxeNamedComponent> superItems = HaxeResolveUtil.findNamedSubComponents(false, supers.toArray(new HaxeClass[supers.size()]));

  final HaxeComponentType type = HaxeComponentType.typeOf(namedComponent);
  if (type == HaxeComponentType.METHOD) {
    final HaxeComponentWithDeclarationList methodDeclaration = (HaxeComponentWithDeclarationList)namedComponent;
    tryNavigateToSuperMethod(editor, methodDeclaration, superItems);
  }
  else if (!supers.isEmpty() && namedComponent instanceof HaxeClass) {
    PsiElementListNavigator.openTargets(
      editor,
      HaxeResolveUtil.getComponentNames(supers).toArray(new NavigatablePsiElement[supers.size()]),
      DaemonBundle.message("navigation.title.subclass", namedComponent.getName(), supers.size()),
      "Subclasses of " + namedComponent.getName(),
      new DefaultPsiElementCellRenderer()
    );
  }
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:29,代码来源:HaxeGotoSuperHandler.java

示例13: createImplementationMarker

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Nullable
private static LineMarkerInfo createImplementationMarker(final HaxeClass componentWithDeclarationList,
                                                         final List<HaxeClass> items) {
  final HaxeComponentName componentName = componentWithDeclarationList.getComponentName();
  if (componentName == null) {
    return null;
  }
  return new LineMarkerInfo<PsiElement>(
    componentName,
    componentName.getTextRange(),
    componentWithDeclarationList instanceof HaxeInterfaceDeclaration
    ? AllIcons.Gutter.ImplementedMethod
    : AllIcons.Gutter.OverridenMethod,
    Pass.UPDATE_ALL,
    new Function<PsiElement, String>() {
      @Override
      public String fun(PsiElement element) {
        return DaemonBundle.message("method.is.implemented.too.many");
      }
    },
    new GutterIconNavigationHandler<PsiElement>() {
      @Override
      public void navigate(MouseEvent e, PsiElement elt) {
        PsiElementListNavigator.openTargets(
          e, HaxeResolveUtil.getComponentNames(items).toArray(new NavigatablePsiElement[items.size()]),
          DaemonBundle.message("navigation.title.subclass", componentWithDeclarationList.getName(), items.size()),
          "Subclasses of " + componentWithDeclarationList.getName(),
          new DefaultPsiElementCellRenderer()
        );
      }
    },
    GutterIconRenderer.Alignment.RIGHT
  );
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:35,代码来源:HaxeLineMarkerProvider.java

示例14: findImplementationsAndCreateMarker

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@Nullable
private LineMarkerInfo findImplementationsAndCreateMarker(final ThriftDefinitionName definitionName) {
  final List<NavigatablePsiElement> implementations = ThriftPsiUtil.findImplementations(definitionName);
  if (implementations.isEmpty()) {
    return null;
  }
  return new LineMarkerInfo<PsiElement>(
    definitionName,
    definitionName.getTextRange(),
    AllIcons.Gutter.ImplementedMethod,
    Pass.UPDATE_ALL,
    new Function<PsiElement, String>() {
      @Override
      public String fun(PsiElement element) {
        return DaemonBundle.message("interface.is.implemented.too.many");
      }
    },
    new GutterIconNavigationHandler<PsiElement>() {
      @Override
      public void navigate(MouseEvent e, PsiElement elt) {
        PsiElementListNavigator.openTargets(
          e,
          implementations.toArray(new NavigatablePsiElement[implementations.size()]),
          DaemonBundle.message("navigation.title.implementation.method", definitionName.getText(), implementations.size()),
          "Implementations of " + definitionName.getText(),
          new DefaultPsiElementCellRenderer()
        );
      }
    },
    GutterIconRenderer.Alignment.RIGHT
  );
}
 
开发者ID:consulo,项目名称:consulo-apache-thrift,代码行数:33,代码来源:ThriftLineMarkerProvider.java

示例15: navigate

import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator; //导入依赖的package包/类
@RequiredDispatchThread
@Override
public void navigate(MouseEvent e, T elt) {
  PsiElementListNavigator.openTargets(e,
                                      myReferences.toArray(new NavigatablePsiElement[myReferences.size()]),
                                      myTitle, null, createListCellRenderer());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:DefaultGutterIconNavigationHandler.java


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