微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

com.intellij.psi.NavigatablePsiElement的实例源码

项目:intellij-swagger    文件pathfinder.java   
private List<? extends PsiNamedElement> getNamedChildren(final PsiElement psiElement) {
    List<PsiNamedElement> children = Arrays.stream(psiElement.getChildren())
            .filter(child -> child instanceof PsiNamedElement)
            .map(child -> (PsiNamedElement) child)
            .collect(Collectors.toList());

    if (children.isEmpty()) {
        Optional<PsiElement> navigatablePsiElement = Arrays.stream(psiElement.getChildren())
                .filter(child -> child instanceof NavigatablePsiElement)
                .filter(child -> !(child instanceof JsonStringLiteral))
                .findFirst();

        return navigatablePsiElement.isPresent() ? getNamedChildren(navigatablePsiElement.get()) : new ArrayList<>();
    }

    return new ArrayList<>(children);
}
项目:intellij-swagger    文件pathfinder.java   
private Optional<? extends PsiElement> getChildByName(final PsiElement psiElement,final String name) {
    if (ROOT_PATH.equals(name)) {
        return Optional.of(psiElement);
    }

    List<PsiNamedElement> children = Arrays.stream(psiElement.getChildren())
            .filter(child -> child instanceof PsiNamedElement)
            .map(child -> (PsiNamedElement) child)
            .collect(Collectors.toList());

    if (children.isEmpty()) {
        Optional<PsiElement> navigatablePsiElement = Arrays.stream(psiElement.getChildren())
                .filter(child -> child instanceof NavigatablePsiElement)
                .filter(child -> !(child instanceof JsonStringLiteral))
                .findFirst();

        return navigatablePsiElement.isPresent() ? getChildByName(navigatablePsiElement.get(),name) : Optional.empty();
    }

    return children.stream()
            .filter(child -> name.equals(child.getName()))
            .findFirst();
}
项目:intellij-ce-playground    文件PsiElementListNavigator.java   
@Nullable
private static JBPopup navigateOrCreatePopup(final NavigatablePsiElement[] targets,final String title,final String findUsagesTitle,final ListCellRenderer listRenderer,@Nullable final ListBackgroundUpdaterTask listUpdaterTask) {
  return navigateOrCreatePopup(targets,title,findUsagesTitle,listRenderer,listUpdaterTask,new Consumer<Object[]>() {
    @Override
    public void consume(Object[] selectedElements) {
      for (Object element : selectedElements) {
        PsiElement selected = (PsiElement)element;
        LOG.assertTrue(selected.isValid());
        ((NavigatablePsiElement)selected).navigate(true);
      }
    }
  });
}
项目:tools-idea    文件PsiElementListNavigator.java   
@Nullable
private static JBPopup navigateOrCreatePopup(final NavigatablePsiElement[] targets,final @Nullable ListBackgroundUpdaterTask listUpdaterTask) {
  return navigateOrCreatePopup(targets,new Consumer<Object[]>() {
    @Override
    public void consume(Object[] selectedElements) {
      for (Object element : selectedElements) {
        PsiElement selected = (PsiElement)element;
        LOG.assertTrue(selected.isValid());
        ((NavigatablePsiElement)selected).navigate(true);
      }
    }
  });
}
项目:consulo-csharp    文件CSharpLineMarkerUtil.java   
@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,new PsiMappedElementListCellRender(map));
}
项目:intellij-haxe    文件HaxeGotoSuperHandler.java   
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());
  }
}
项目:consulo-haxe    文件HaxeGotoSuperHandler.java   
private static void tryNavigatetoSuperMethod(Editor editor,HaxeComponentWithDeclarationList methodDeclaration,new DefaultPsiElementCellRenderer());
  }
}
项目:consulo    文件PsiElementListNavigator.java   
public static void openTargets(MouseEvent e,NavigatablePsiElement[] targets,String title,ListCellRenderer listRenderer,@Nullable ListBackgroundUpdaterTask listUpdaterTask) {
  JBPopup popup = navigateOrCreatePopup(targets,listUpdaterTask);
  if (popup != null) {
    if (listUpdaterTask != null) {
      Alarm alarm = new Alarm(popup);
      alarm.addRequest(() -> popup.show(new RelativePoint(e)),300);
      ProgressManager.getInstance().run(listUpdaterTask);
    }
    else {
      popup.show(new RelativePoint(e));
    }
  }
}
项目:consulo-javascript    文件JavaScriptLineMarkerProvider.java   
@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());
}
项目:AppleScript-IDEA    文件AppleScriptStructureViewElement.java   
@Nullable
@Override
public String getPresentableText() {
  final NavigatablePsiElement element = getElement();
  final ItemPresentation presentation = element == null ? null : element.getPresentation();
  return presentation == null ? null : presentation.getPresentableText();
}
项目:intellij-ce-playground    文件PsiElementListNavigator.java   
public static void openTargets(MouseEvent e,listUpdaterTask);
  if (popup != null) popup.show(new RelativePoint(e));
}
项目:intellij-ce-playground    文件HierarchybrowserBase.java   
private Navigatable getNavigatable(HierarchyNodeDescriptor descriptor) {
  if (descriptor instanceof Navigatable && descriptor.isValid()) {
    return (Navigatable)descriptor;
  }

  PsiElement element = getElementFromDescriptor(descriptor);
  if (element instanceof NavigatablePsiElement && element.isValid()) {
    return (NavigatablePsiElement)element;
  }
  return null;
}
项目:intellij-ce-playground    文件PyLineMarkerNavigator.java   
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,new DefaultPsiElementCellRenderer());
}
项目:intellij-ce-playground    文件PyGotoSuperHandler.java   
private static void navigateOrChoose(Editor editor,Collection<? extends NavigatablePsiElement> superElements,final String title) {
  if (!superElements.isEmpty()) {
    NavigatablePsiElement[] superElementArray = superElements.toArray(new NavigatablePsiElement[superElements.size()]);
    if (superElementArray.length == 1) {
      superElementArray[0].navigate(true);
    }
    else {
      NavigationUtil.getPsiElementPopup(superElementArray,title).showInBestPositionFor(editor);
    }
  }
}
项目:intellij    文件OpenCorrespondingBuildFile.java   
/** Returns true if a target or BUILD file Could be found and navigated to. */
private static void navigatetoTargetorFile(Project project,VirtualFile vf) {
  // First,find the parent BUILD file. We don't want to navigate to labels in other packages
  BlazePackage parentPackage = getBuildFile(project,vf);
  if (parentPackage == null) {
    return;
  }
  // first,look for a specific target which includes this source file
  PsiElement target = findBuildTarget(project,parentPackage,new File(vf.getPath()));
  if (target instanceof NavigatablePsiElement) {
    ((NavigatablePsiElement) target).navigate(true);
    return;
  }
  OpenFileAction.openFile(parentPackage.buildFile.getFile().getPath(),project);
}
项目:intellij    文件BlazeTargetFilter.java   
@Nullable
@Override
public Result applyFilter(String line,int entireLength) {
  Matcher matcher = TARGET_PATTERN.matcher(line);
  List<ResultItem> results = new ArrayList<>();
  while (matcher.find()) {
    String labelString = matcher.group();
    String prefix = matcher.group(1);
    if (prefix != null) {
      labelString = labelString.substring(prefix.length());
    }
    Label label = LabelUtils.createLabelFromString(null,labelString);
    if (label == null) {
      continue;
    }
    PsiElement psi = buildreferenceManager.getInstance(project).resolveLabel(label);
    if (!(psi instanceof NavigatablePsiElement)) {
      continue;
    }
    HyperlinkInfo link = project -> ((NavigatablePsiElement) psi).navigate(true);
    int offset = entireLength - line.length();
    results.add(
        new ResultItem(
            matcher.start() + offset,matcher.end() + offset,link,highlightAttributes));
  }
  return results.isEmpty() ? null : new Result(results);
}
项目:tools-idea    文件PsiElementListNavigator.java   
public static void openTargets(MouseEvent e,listUpdaterTask);
  if (popup != null) popup.show(new RelativePoint(e));
}
项目:tools-idea    文件HierarchybrowserBase.java   
private Navigatable getNavigatable(HierarchyNodeDescriptor descriptor) {
  if (descriptor instanceof Navigatable && descriptor.isValid()) {
    return (Navigatable)descriptor;
  }

  PsiElement element = getElementFromDescriptor(descriptor);
  if (element instanceof NavigatablePsiElement && element.isValid()) {
    return (NavigatablePsiElement)element;
  }
  return null;
}
项目:intellij-haxe    文件HaxeGotoSuperHandler.java   
@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()
    );
  }
}
项目:intellij-haxe    文件HaxeLineMarkerProvider.java   
@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()]),componentWithDeclarationList.getName(),items.size()),"Subclasses of " + componentWithDeclarationList.getName(),new DefaultPsiElementCellRenderer()
        );
      }
    },GutterIconRenderer.Alignment.RIGHT
  );
}
项目:consulo-haxe    文件HaxeGotoSuperHandler.java   
@Override
public void invoke(@NotNull Project project,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,new DefaultPsiElementCellRenderer()
    );
  }
}
项目:consulo-haxe    文件HaxeLineMarkerProvider.java   
@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(),new Function<PsiElement,String>() {
      @Override
      public String fun(PsiElement element) {
        return DaemonBundle.message("method.is.implemented.too.many");
      }
    },GutterIconRenderer.Alignment.RIGHT
  );
}
项目:consulo-apache-thrift    文件ThriftPsiUtil.java   
@NotNull
public static List<NavigatablePsiElement> findImplementations(ThriftDeFinitionName deFinitionName) {
  final List<NavigatablePsiElement> implementations = new ArrayList<NavigatablePsiElement>();
  processImplementations(deFinitionName,new Processor<NavigatablePsiElement>() {
    @Override
    public boolean process(NavigatablePsiElement element) {
      implementations.add(element);
      return true;
    }
  });
  return implementations;
}
项目:consulo-apache-thrift    文件ThriftPsiUtil.java   
public static void processImplementations(ThriftDeFinitionName deFinitionName,@NotNull Processor<NavigatablePsiElement> processor) {
  String name = deFinitionName.getText();
  for (ChooseByNameContributor contributor : ChooseByNameRegistry.getInstance().getClassModelContributors()) {
    if (!(contributor instanceof ThriftClassContributor)) {
      for (NavigationItem navigationItem : contributor.getItemsByName(name,name,deFinitionName.getProject(),false)) {
        if (navigationItem instanceof NavigatablePsiElement && !processor.process((NavigatablePsiElement)navigationItem)) {
          return;
        }
      }
    }
  }
}
项目:consulo-apache-thrift    文件ThriftLineMarkerProvider.java   
@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,String>() {
      @Override
      public String fun(PsiElement element) {
        return DaemonBundle.message("interface.is.implemented.too.many");
      }
    },implementations.toArray(new NavigatablePsiElement[implementations.size()]),DaemonBundle.message("navigation.title.implementation.method",deFinitionName.getText(),implementations.size()),"Implementations of " + deFinitionName.getText(),GutterIconRenderer.Alignment.RIGHT
  );
}
项目:intellij-thrift    文件ThriftLineMarkerProvider.java   
@Nullable
private LineMarkerInfo findImplementationsAndCreateMarker(final ThriftDeFinitionName deFinitionName) {
  final List<NavigatablePsiElement> implementations = ThriftPsiUtil.findImplementations(deFinitionName);
  if (implementations.isEmpty()) {
    return null;
  }
  return new LineMarkerInfo<PsiElement>(
    deFinitionName,GutterIconRenderer.Alignment.RIGHT
  );
}
项目:consulo    文件DefaultGutterIconNavigationHandler.java   
@requireddispatchThread
@Override
public void navigate(MouseEvent e,T elt) {
  PsiElementListNavigator.openTargets(e,myReferences.toArray(new NavigatablePsiElement[myReferences.size()]),myTitle,createListCellRenderer());
}
项目:consulo    文件PsiElementListNavigator.java   
@Nullable
private static JBPopup navigateOrCreatePopup(final NavigatablePsiElement[] targets,selectedElements -> {
    for (Object element : selectedElements) {
      PsiElement selected = (PsiElement)element;
      LOG.assertTrue(selected.isValid());
      ((NavigatablePsiElement)selected).navigate(true);
    }
  });
}
项目:consulo    文件HierarchybrowserBase.java   
private Navigatable getNavigatable(HierarchyNodeDescriptor descriptor) {
  if (descriptor instanceof Navigatable && descriptor.isValid()) {
    return (Navigatable)descriptor;
  }

  PsiElement element = getElementFromDescriptor(descriptor);
  if (element instanceof NavigatablePsiElement && element.isValid()) {
    return (NavigatablePsiElement)element;
  }
  return null;
}
项目:consulo-java    文件GoToSymbolFix.java   
@Override
public void invoke(@NotNull Project project,Editor editor,PsiFile file) throws IncorrectOperationException
{
    NavigatablePsiElement e = myPointer.getElement();
    if(e != null && e.isValid())
    {
        e.navigate(true);
    }
}
项目:consulo-java    文件MarkerType.java   
private static void navigatetoSiblingOverridingMethod(MouseEvent e,@NotNull PsiMethod method)
{
    PsiMethod superMethod = FindSuperElementsHelper.getSiblingInheritedViaSubClass(method);
    if(superMethod == null)
    {
        return;
    }
    PsiElementListNavigator.openTargets(e,new NavigatablePsiElement[]{superMethod},method.getName()),DaemonBundle.message("navigation" +
            ".findUsages.title.super.method",new MethodCellRenderer(false));
}
项目:consulo-java    文件MarkerType.java   
public static void navigatetoSubclassedClass(MouseEvent e,@NotNull final PsiClass aClass)
{
    if(DumbService.isDumb(aClass.getProject()))
    {
        DumbService.getInstance(aClass.getProject()).showDumbModeNotification("Navigation to overriding methods is not possible during index update");
        return;
    }

    final PsiElementProcessor.FindElement<PsiClass> collectProcessor = new PsiElementProcessor.FindElement<>();
    final PsiElementProcessor.FindElement<PsiFunctionalExpression> collectExprProcessor = new PsiElementProcessor.FindElement<>();
    if(!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
        ClassInheritoRSSearch.search(aClass).forEach(new PsiElementProcessorAdapter<>(collectProcessor));
        if(collectProcessor.getFoundElement() == null)
        {
            FunctionalExpressionSearch.search(aClass).forEach(new PsiElementProcessorAdapter<>(collectExprProcessor));
        }
    },SEARCHING_FOR_OVERRIDDEN_METHODS,true,aClass.getProject(),(JComponent) e.getComponent()))
    {
        return;
    }

    final List<NavigatablePsiElement> inheritors = new ArrayList<>();
    ContainerUtil.addIfNotNull(inheritors,collectProcessor.getFoundElement());
    ContainerUtil.addIfNotNull(inheritors,collectExprProcessor.getFoundElement());
    if(inheritors.isEmpty())
    {
        return;
    }
    final PsiClassOrFunctionalExpressionListCellRenderer renderer = new PsiClassOrFunctionalExpressionListCellRenderer();
    final SubclassUpdater subclassUpdater = new SubclassUpdater(aClass,renderer);
    Collections.sort(inheritors,renderer.getComparator());
    PsiElementListNavigator.openTargets(e,inheritors.toArray(new NavigatablePsiElement[inheritors.size()]),subclassUpdater.getCaption(inheritors.size()),CodeInsightBundle.message("goto" +
            ".implementation.findUsages.title",aClass.getName()),renderer,subclassUpdater);
}
项目:consulo-java    文件MarkerType.java   
@Override
public void onFinished()
{
    super.onFinished();
    PsiElement oneElement = getTheOnlyOneElement();
    if(oneElement instanceof NavigatablePsiElement)
    {
        ((NavigatablePsiElement) oneElement).navigate(true);
        myPopup.cancel();
    }
}
项目:AppleScript-IDEA    文件AppleScriptStructureViewElement.java   
AppleScriptStructureViewElement(@NotNull final NavigatablePsiElement element) {
  super(element);
  isRoot = false;
}
项目:AppleScript-IDEA    文件AppleScriptStructureViewElement.java   
private AppleScriptStructureViewElement(NavigatablePsiElement element,boolean isRootElement) {
  super(element);
  this.isRoot = isRootElement;
}
项目:AppleScript-IDEA    文件AppleScriptStructureViewElement.java   
@NotNull
@Override
public Collection<StructureViewTreeElement> getChildrenBase() {
  final NavigatablePsiElement element = getElement();
  final List<StructureViewTreeElement> result = new ArrayList<>();
  THashSet<AppleScriptComponent> myComponents = new THashSet<>();
  if (element != null && element instanceof AppleScriptFile) {
    if (!isRoot) {
      result.add(new AppleScriptStructureViewElement(element,true));
    }
    AppleScriptPsiElementImpl
        .processDeclarationsImpl(element,new AppleScriptComponentScopeProcessor(myComponents),ResolveState.initial(),null);
  } else if (element instanceof AppleScriptScriptObject) {
    List<AppleScriptComponent> myScriptComponents = AppleScriptResolveUtil.getNamedSubComponentsFor((AppleScriptScriptObject) element);
    myComponents.addAll(myScriptComponents);
  }

  for (AppleScriptComponent component : myComponents) {
    if (component instanceof AppleScriptHandlerPositionalParametersDeFinition) {
      result.add(new AppleScriptStructureViewElement(component));
    } else if (component instanceof AppleScriptScriptPropertyDeclaration) {
      result.add(new AppleScriptStructureViewElement(component));
    } else if (component instanceof AppleScriptvarAccessDeclaration || component instanceof AppleScriptvarDeclarationListPart) {
      result.add(new AppleScriptStructureViewElement(component));
    } else if (component instanceof AppleScriptScriptObject && component != element) {
      result.add(new AppleScriptStructureViewElement(component,true));
    } else if (component instanceof AppleScriptHandler) {
      result.add(new AppleScriptStructureViewElement(component));
    } else if (component.getName() != null
        && !(component instanceof AppleScriptHandlerInterleavedParameteRSSelectorPart)//todo remove
        && component != element) {
      result.add(new AppleScriptStructureViewElement(component));
    }
  }

  result.sort((o1,o2) -> {
    PsiElement element1,element2;
    if (o1 instanceof AppleScriptStructureViewElement && o2 instanceof AppleScriptStructureViewElement) {
      element1 = ((AppleScriptStructureViewElement) o1).getElement();
      element2 = ((AppleScriptStructureViewElement) o2).getElement();
      if (element1 != null && element2 != null) {
        return element1.getTextOffset() - element2.getTextOffset();
      }
    }
    return 0;
  });

  return result;
}
项目:mule-intellij-plugins    文件weaveVisitor.java   
public void visitNavigatablePsiElement(@NotNull NavigatablePsiElement o) {
  visitElement(o);
}
项目:intellij-ce-playground    文件PsiClassOrFunctionalExpressionListCellRenderer.java   
@Override
public String getElementText(NavigatablePsiElement element) {
  return element instanceof PsiClass ? ClasspresentationUtil.getNameForClass((PsiClass)element,false) 
                                     : PsiExpressionTrimRenderer.render((PsiExpression)element);
}
项目:intellij-ce-playground    文件PsiClassOrFunctionalExpressionListCellRenderer.java   
@Override
protected String getContainerText(NavigatablePsiElement element,final String name) {
  return PsiClassListCellRenderer.getContainerTextStatic(element);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。