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


Java Pass.UPDATE_OVERRIDEN_MARKERS属性代码示例

本文整理汇总了Java中com.intellij.codeHighlighting.Pass.UPDATE_OVERRIDEN_MARKERS属性的典型用法代码示例。如果您正苦于以下问题:Java Pass.UPDATE_OVERRIDEN_MARKERS属性的具体用法?Java Pass.UPDATE_OVERRIDEN_MARKERS怎么用?Java Pass.UPDATE_OVERRIDEN_MARKERS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.codeHighlighting.Pass的用法示例。


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

示例1: collectSiblingInheritedMethods

private static void collectSiblingInheritedMethods(@NotNull final Collection<PsiMethod> methods,
                                                   @NotNull Collection<LineMarkerInfo> result,
                                                   @NotNull Map<PsiClass, PsiClass> subClassCache) {
  for (PsiMethod method : methods) {
    ProgressManager.checkCanceled();
    PsiClass aClass = method.getContainingClass();
    if (aClass == null || aClass.hasModifierProperty(PsiModifier.FINAL) || aClass.isInterface()) continue;

    boolean canHaveSiblingSuper = !method.hasModifierProperty(PsiModifier.ABSTRACT) && !method.hasModifierProperty(PsiModifier.STATIC) && method.hasModifierProperty(PsiModifier.PUBLIC)&& !method.hasModifierProperty(PsiModifier.FINAL)&& !method.hasModifierProperty(PsiModifier.NATIVE);
    if (!canHaveSiblingSuper) continue;

    PsiMethod siblingInheritedViaSubClass = Pair.getFirst(FindSuperElementsHelper.getSiblingInheritedViaSubClass(method, subClassCache));
    if (siblingInheritedViaSubClass == null) {
      continue;
    }
    PsiElement range = getMethodRange(method);
    ArrowUpLineMarkerInfo upInfo = new ArrowUpLineMarkerInfo(range, AllIcons.Gutter.ImplementingMethod, MarkerType.SIBLING_OVERRIDING_METHOD,
                                                            Pass.UPDATE_OVERRIDEN_MARKERS);
    LineMarkerInfo info = NavigateAction.setNavigateAction(upInfo, "Go to super method", IdeActions.ACTION_GOTO_SUPER);
    result.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaLineMarkerProvider.java

示例2: collectInheritingClasses

public static void collectInheritingClasses(@NotNull PsiClass aClass,
                                            @NotNull Collection<LineMarkerInfo> result,
                                            @NotNull Map<PsiClass, PsiClass> subClassCache) {
  if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return; // It's useless to have overridden markers for object.

  PsiClass subClass = subClassCache.get(aClass);
  if (subClass != null || FunctionalExpressionSearch.search(aClass).findFirst() != null) {
    final Icon icon = aClass.isInterface() ? AllIcons.Gutter.ImplementedMethod : AllIcons.Gutter.OverridenMethod;
    PsiElement range = aClass.getNameIdentifier();
    if (range == null) {
      range = aClass;
    }
    MarkerType type = MarkerType.SUBCLASSED_CLASS;
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(),
                                                         icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(),
                                                         type.getNavigationHandler(),
                                                         GutterIconRenderer.Alignment.RIGHT);
    NavigateAction.setNavigateAction(info, aClass.isInterface() ? "Go to implementation(s)" : "Go to subclass(es)", IdeActions.ACTION_GOTO_IMPLEMENTATION);
    result.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaLineMarkerProvider.java

示例3: doHighlighting

@NotNull
protected Collection<HighlightInfo> doHighlighting(final Boolean externalToolPass) {
  final Project project = myTestFixture.getProject();
  PsiDocumentManager.getInstance(project).commitAllDocuments();
  final Editor editor = myTestFixture.getEditor();

  int[] ignore = externalToolPass == null || externalToolPass ? new int[]{
    Pass.LINE_MARKERS,
    Pass.LOCAL_INSPECTIONS,
    Pass.POPUP_HINTS,
    Pass.UPDATE_ALL,
    Pass.UPDATE_FOLDING,
    Pass.UPDATE_OVERRIDEN_MARKERS,
    Pass.VISIBLE_LINE_MARKERS,
  } : new int[]{Pass.EXTERNAL_TOOLS};
  return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HighlightingTestBase.java

示例4: collectInheritingClasses

private static void collectInheritingClasses(PsiClass aClass, Collection<LineMarkerInfo> result) {
  if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return; // It's useless to have overridden markers for object.

  PsiClass inheritor = ClassInheritorsSearch.search(aClass, false).findFirst();
  if (inheritor != null) {
    final Icon icon = aClass.isInterface() ? AllIcons.Gutter.ImplementedMethod : AllIcons.Gutter.OverridenMethod;
    PsiElement range = aClass.getNameIdentifier();
    if (range == null) range = aClass;
    MarkerType type = MarkerType.SUBCLASSED_CLASS;
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(),
                                                         icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(),
                                                         type.getNavigationHandler(),
                                                         GutterIconRenderer.Alignment.RIGHT);
    result.add(info);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaLineMarkerProvider.java

示例5: createLineMarkerInfo

public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @NotNull
    @Override
    protected Collection<? extends GotoRelatedItem> compute() {
      if (myGotoRelatedItemProvider != null) {
        return ContainerUtil.concat(myTargets.getValue(), myGotoRelatedItemProvider);
      }
      return Collections.emptyList();
    }
  };
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:NavigationGutterIconBuilder.java

示例6: RecursiveMethodCallMarkerInfo

private RecursiveMethodCallMarkerInfo(@NotNull PsiMethodCallExpression methodCall) {
  super(methodCall,
        methodCall.getTextRange(),
        AllIcons.Gutter.RecursiveMethod,
        Pass.UPDATE_OVERRIDEN_MARKERS,
        FunctionUtil.<PsiMethodCallExpression, String>constant("Recursive call"),
        null,
        GutterIconRenderer.Alignment.RIGHT
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RecursiveCallLineMarkerProvider.java

示例7: createLineMarkerInfo

public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = createGotoTargetsThunk(myLazy, myGotoRelatedItemProvider,
                                                                                               evaluateAndForget(myTargets));
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NavigationGutterIconBuilder.java

示例8: doGetLineMarkerInfo

private static LineMarkerInfo doGetLineMarkerInfo(PsiElement element) {
  final MyMarkerInfo info = getMarkerInfo(element);

  if (info == null) {
    return null;
  }
  final PsiElement anchor = info.myElement;
  final String tooltip = info.myTooltip;

  return new LineMarkerInfo<PsiElement>(
    anchor, anchor.getTextOffset(), info.myIcon, Pass.UPDATE_OVERRIDEN_MARKERS,
    new ConstantFunction<PsiElement, String>(tooltip), new MyNavigationHandler(info));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidLineMarkerProvider.java

示例9: getPassId

@Override
public int getPassId() {
  return Pass.UPDATE_OVERRIDEN_MARKERS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:SlowLineMarkersPassFactory.java

示例10: collectSlowLineMarkers

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) {
  if (elements.isEmpty()) {
    return;
  }
  PsiElement file = elements.get(0).getContainingFile();
  final RunContextAction runAction = new RunContextAction(DefaultRunExecutor.getRunExecutorInstance());
  final LineMarkerInfo<PsiElement> markerInfo = new LineMarkerInfo<PsiElement>(
    file, file.getTextRange(), AllIcons.Actions.Execute, Pass.UPDATE_OVERRIDEN_MARKERS,
    new Function<PsiElement, String>() {
      @Override
      public String fun(PsiElement e) {
        return "Execute '" + e.getContainingFile().getName() + "'";
      }
    }, null,
    GutterIconRenderer.Alignment.RIGHT) {
    @Nullable
    @Override
    public GutterIconRenderer createGutterRenderer() {
      return new LineMarkerGutterIconRenderer<PsiElement>(this) {
        @Override
        public AnAction getClickAction() {
          return runAction;
        }

        @Nullable
        @Override
        public ActionGroup getPopupMenuActions() {
          final DefaultActionGroup group = new DefaultActionGroup();
          group.add(runAction);
          final PyExecuteFileExtensionPoint[] extensions =
            ApplicationManager.getApplication().getExtensions(PyExecuteFileExtensionPoint.EP_NAME);
          for (PyExecuteFileExtensionPoint extension : extensions) {
            final AnAction action = extension.getRunAction();
            if (action == null) {
              continue;
            }
            group.add(action);
          }
          return group;
        }
      };
    }
  };
  result.add(markerInfo);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:PyExecuteFileLineMarkerProvider.java

示例11: collectOverridingMethods

private static void collectOverridingMethods(@NotNull final Set<PsiMethod> methods, @NotNull Collection<LineMarkerInfo> result) {
  final Set<PsiElement> overridden = new HashSet<PsiElement>();

  Set<PsiClass> classes = new THashSet<PsiClass>();
  for (PsiMethod method : methods) {
    ProgressManager.checkCanceled();
    final PsiClass parentClass = method.getContainingClass();
    if (parentClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(parentClass.getQualifiedName())) {
      classes.add(parentClass);
    }
  }

  for (final PsiClass aClass : classes) {
    AllOverridingMethodsSearch.search(aClass).forEach(new Processor<Pair<PsiMethod, PsiMethod>>() {
      @Override
      public boolean process(final Pair<PsiMethod, PsiMethod> pair) {
        ProgressManager.checkCanceled();

        final PsiMethod superMethod = pair.getFirst();
        if (isCorrectTarget(superMethod) && isCorrectTarget(pair.getSecond())) {
          if (methods.remove(superMethod)) {
            overridden.add(PsiImplUtil.handleMirror(superMethod));
          }
        }
        return !methods.isEmpty();
      }
    });
  }

  for (PsiElement element : overridden) {
    final Icon icon = AllIcons.Gutter.OverridenMethod;

    element = PsiImplUtil.handleMirror(element);

    PsiElement range;
    if (element instanceof GrNamedElement) {
      range = ((GrNamedElement)element).getNameIdentifierGroovy();
    }
    else {
      range = element;
    }

    final MarkerType type = element instanceof GrField ? GroovyMarkerTypes.OVERRIDEN_PROPERTY_TYPE
                                                       : GroovyMarkerTypes.GR_OVERRIDEN_METHOD;
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(), icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(),
                                                         type.getNavigationHandler(), GutterIconRenderer.Alignment.RIGHT);
    result.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:GroovyLineMarkerProvider.java

示例12: collectOverridingMethods

private static void collectOverridingMethods(final Set<PsiMethod> methods, Collection<LineMarkerInfo> result) {
  final Set<PsiElement> overridden = new HashSet<PsiElement>();

  Set<PsiClass> classes = new THashSet<PsiClass>();
  for (PsiMethod method : methods) {
    ProgressManager.checkCanceled();
    final PsiClass parentClass = method.getContainingClass();
    if (parentClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(parentClass.getQualifiedName())) {
      classes.add(parentClass);
    }
  }

  for (final PsiClass aClass : classes) {
    try {
      AllOverridingMethodsSearch.search(aClass).forEach(new Processor<Pair<PsiMethod, PsiMethod>>() {
        @Override
        public boolean process(final Pair<PsiMethod, PsiMethod> pair) {
          ProgressManager.checkCanceled();

          final PsiMethod superMethod = pair.getFirst();
          if (isCorrectTarget(superMethod) && isCorrectTarget(pair.getSecond())) {
            if (methods.remove(superMethod)) {
              if (superMethod instanceof PsiMirrorElement) {
                
              }
              overridden.add(PsiImplUtil.handleMirror(superMethod));
            }
          }
          return !methods.isEmpty();
        }
      });
    }
    catch (IndexNotReadyException ignored) {
    }
  }

  for (PsiElement element : overridden) {
    final Icon icon = AllIcons.Gutter.OverridenMethod;

    element = PsiImplUtil.handleMirror(element);

    PsiElement range;
    if (element instanceof GrNamedElement) {
      range = ((GrNamedElement)element).getNameIdentifierGroovy();
    }
    else {
      range = element;
    }

    final MarkerType type;
    if (element instanceof GrField) {
      type = GroovyMarkerTypes.OVERRIDEN_PROPERTY_TYPE;
    }
    else {
      type = GroovyMarkerTypes.OVERRIDEN_METHOD;
    }
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(), icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(), type.getNavigationHandler(),
                                                         GutterIconRenderer.Alignment.RIGHT);
    result.add(info);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:61,代码来源:GroovyLineMarkerProvider.java


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