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


Java Pass.LINE_MARKERS属性代码示例

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


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

示例1: 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

示例2: createMarker

@Nullable
@RequiredReadAction
private static LineMarkerInfo createMarker(final PsiElement element)
{
	CSharpMethodDeclaration methodDeclaration = CSharpLineMarkerUtil.getNameIdentifierAs(element, CSharpMethodDeclaration.class);
	if(methodDeclaration != null)
	{
		Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
		if(extension == null)
		{
			return null;
		}

		UnityFunctionManager.FunctionInfo magicMethod = findMagicMethod(methodDeclaration);
		if(magicMethod != null)
		{
			return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(magicMethod.getDescription()), null,
					GutterIconRenderer.Alignment.LEFT);
		}
	}

	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:23,代码来源:UnityEventCSharpMethodLineMarkerProvider.java

示例3: collect

@RequiredReadAction
@Override
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> consumer)
{
	if(psiElement.getNode().getElementType() == CSharpTokens.IDENTIFIER && psiElement.getParent() instanceof CSharpReferenceExpression &&
			psiElement.getParent().getParent() instanceof CSharpMethodCallExpressionImpl)
	{
		PsiElement resolvedElement = ((CSharpReferenceExpression) psiElement.getParent()).resolve();
		if(resolvedElement instanceof CSharpMethodDeclaration)
		{
			CSharpMethodDeclaration methodDeclaration = PsiTreeUtil.getParentOfType(psiElement, CSharpMethodDeclaration.class);
			if(resolvedElement.isEquivalentTo(methodDeclaration))
			{
				LineMarkerInfo<PsiElement> lineMarkerInfo = new LineMarkerInfo<PsiElement>(psiElement, psiElement.getTextRange(), AllIcons.Gutter.RecursiveMethod, Pass.LINE_MARKERS,
						FunctionUtil.constant("Recursive call"), null, GutterIconRenderer.Alignment.CENTER);
				consumer.consume(lineMarkerInfo);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:20,代码来源:RecursiveCallCollector.java

示例4: createLineMarkerInfo

public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@Nonnull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @Nonnull
    @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.LINE_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:NavigationGutterIconBuilder.java

示例5: createMethodSeparatorLineMarker

@Nonnull
public static LineMarkerInfo createMethodSeparatorLineMarker(@Nonnull PsiElement startFrom, @Nonnull EditorColorsManager colorsManager) {
  LineMarkerInfo info = new LineMarkerInfo<>(
          startFrom,
          startFrom.getTextRange(),
          null,
          Pass.LINE_MARKERS,
          FunctionUtil.<Object, String>nullConstant(),
          null,
          GutterIconRenderer.Alignment.RIGHT
  );
  EditorColorsScheme scheme = colorsManager.getGlobalScheme();
  info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
  info.separatorPlacement = SeparatorPlacement.TOP;
  return info;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:LineMarkersPass.java

示例6: getLineMarkerInfo

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element)
{
	PsiModifierListOwner owner = getAnnotationOwner(element);
	if(owner == null)
	{
		return null;
	}

	boolean includeSourceInferred = JavaCodeInsightSettings.getInstance().SHOW_SOURCE_INFERRED_ANNOTATIONS;
	boolean hasAnnotationsToShow = ContainerUtil.exists(NonCodeAnnotationGenerator.getSignatureNonCodeAnnotations(owner).values(), a -> includeSourceInferred || !a.isInferredFromSource());
	if(!hasAnnotationsToShow)
	{
		return null;
	}

	return new LineMarkerInfo<>(element, element.getTextRange(), JavaIcons.Gutter.ExtAnnotation, Pass.LINE_MARKERS, ourTooltipProvider, MyIconGutterHandler.INSTANCE, GutterIconRenderer.Alignment
			.RIGHT);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:ExternalAnnotationsLineMarkerProvider.java

示例7: extractExpectedLineMarkerSet

private void extractExpectedLineMarkerSet(Document document) {
  String text = document.getText();

  @NonNls String pat = ".*?((<" + LINE_MARKER + ")(?: descr=\"((?:[^\"\\\\]|\\\\\")*)\")?>)(.*)";
  final Pattern p = Pattern.compile(pat, Pattern.DOTALL);
  final Pattern pat2 = Pattern.compile("(.*?)(</" + LINE_MARKER + ">)(.*)", Pattern.DOTALL);

  while (true) {
    Matcher m = p.matcher(text);
    if (!m.matches()) break;
    int startOffset = m.start(1);
    final String descr = m.group(3) != null ? m.group(3) : ANY_TEXT;
    String rest = m.group(4);

    document.replaceString(startOffset, m.end(1), "");

    final Matcher matcher2 = pat2.matcher(rest);
    LOG.assertTrue(matcher2.matches(), "Cannot find closing </" + LINE_MARKER + ">");
    String content = matcher2.group(1);
    int endOffset = startOffset + matcher2.start(3);
    String endTag = matcher2.group(2);

    document.replaceString(startOffset, endOffset, content);
    endOffset -= endTag.length();

    LineMarkerInfo markerInfo = new LineMarkerInfo<PsiElement>(myFile, new TextRange(startOffset, endOffset), null, Pass.LINE_MARKERS,
                                                               new ConstantFunction<PsiElement, String>(descr), null,
                                                               GutterIconRenderer.Alignment.RIGHT);

    lineMarkerInfos.put(document.createRangeMarker(startOffset, endOffset), markerInfo);
    text = document.getText();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ExpectedHighlightingData.java

示例8: getLineMarkerInfo

@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
	if(element.getNode().getElementType() == JSTokenTypes.IDENTIFIER && element.getParent() instanceof JSReferenceExpression && element.getParent().getParent() instanceof JSFunction)
	{
		UnityFunctionManager functionManager = UnityFunctionManager.getInstance();
		Map<String, UnityFunctionManager.FunctionInfo> map = functionManager.getFunctionsByType().get(Unity3dTypes.UnityEngine.MonoBehaviour);
		if(map == null)
		{
			return null;
		}
		UnityFunctionManager.FunctionInfo functionInfo = map.get(element.getText());
		if(functionInfo == null)
		{
			return null;
		}
		Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
		if(extension == null)
		{
			return null;
		}
		JSFunction jsFunction = (JSFunction) element.getParent().getParent();
		if(jsFunction.getParent() instanceof JSFile)
		{
			if(!isEqualParameters(functionInfo.getParameters(), jsFunction))
			{
				return null;
			}

			return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(functionInfo.getDescription()), null,
					GutterIconRenderer.Alignment.LEFT);
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:37,代码来源:UnityScriptEventFunctionLineMarkerProvider.java

示例9: getLineMarkerInfo

@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
	for(Unity3dAssetCSharpLineMarker marker : Unity3dAssetCSharpLineMarker.values())
	{
		Class<? extends PsiElement> clazz = marker.getElementClass();

		PsiElement declaration = CSharpLineMarkerUtil.getNameIdentifierAs(element, clazz);
		if(declaration != null)
		{
			String uuid = Unity3dAssetUtil.getGUID(element.getProject(), PsiUtilCore.getVirtualFile(declaration));
			if(uuid == null )
			{
				return null;
			}

			if(marker.isAvailable(declaration))
			{
				return new LineMarkerInfo<>(element, element.getTextRange(), marker.getIcon(), Pass.LINE_MARKERS, marker.createTooltipFunction(), marker.createNavigationHandler(),
						GutterIconRenderer.Alignment.LEFT);
			}
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:27,代码来源:UnitySceneCSharpTypeLineMarkerProvider.java

示例10: getLineMarkerInfo

@RequiredReadAction
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element)
{
	if(element instanceof LuaReturnStatement)
	{
		LuaReturnStatement e = (LuaReturnStatement) element;

		if(e.isTailCall())
		{
			return new LineMarkerInfo<>(element, element.getTextRange(), AllIcons.Gutter.RecursiveMethod, Pass.LINE_MARKERS, tailCallTooltip, null, GutterIconRenderer.Alignment.LEFT);
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:15,代码来源:LuaTailCallLineMarkerProvider.java

示例11: getLineMarkerInfo

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement)
{
	PlayBaseTemplateFile templateFile = findTemplateFile(psiElement);
	if(templateFile != null)
	{

		return new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), PlayJavaIcons.PlayLineMarker, Pass.LINE_MARKERS,
				new ConstantFunction<>("Navigate to template"), GUTTER_ICON_NAVIGATION_HANDLER, GutterIconRenderer.Alignment.LEFT);
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-play,代码行数:13,代码来源:PlayBaseTemplateLineMarkerProvider.java

示例12: 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,
  } : new int[]{Pass.EXTERNAL_TOOLS};
  return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:15,代码来源:HighlightingTestBase.java

示例13: collect

@RequiredReadAction
@Override
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> consumer)
{
	DotNetVirtualImplementOwner virtualImplementOwner = CSharpLineMarkerUtil.findElementForLineMarker(psiElement);
	if(virtualImplementOwner != null)
	{
		PsiElement parentParent = virtualImplementOwner.getParent();
		if(!(parentParent instanceof DotNetTypeDeclaration))
		{
			return;
		}

		Collection<DotNetVirtualImplementOwner> overrideElements = OverrideUtil.collectOverridingMembers(virtualImplementOwner);

		if(overrideElements.isEmpty())
		{
			return;
		}

		Icon icon = null;
		if(virtualImplementOwner.getTypeForImplement() != null)
		{
			icon = CSharpIcons.Gutter.HidingMethod;
		}
		else
		{
			icon = AllIcons.Gutter.ImplementingMethod;
			for(DotNetVirtualImplementOwner overrideElement : overrideElements)
			{
				if(!((DotNetModifierListOwner) overrideElement).hasModifier(DotNetModifier.ABSTRACT))
				{
					icon = AllIcons.Gutter.OverridingMethod;
					break;
				}
			}
		}

		LineMarkerInfo<PsiElement> lineMarkerInfo = new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), icon, Pass.LINE_MARKERS, new ConstantFunction<>("Searching for overriding"), OurHandler.INSTANCE, GutterIconRenderer.Alignment.RIGHT);

		consumer.consume(lineMarkerInfo);
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:43,代码来源:HidingOrOverridingElementCollector.java

示例14: collectInheritingClasses

protected List<LineMarkerInfo> collectInheritingClasses(@NotNull PsiClass aClass)
{
	if(aClass.hasModifierProperty(PsiModifier.FINAL))
	{
		return Collections.emptyList();
	}
	if(CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName()))
	{
		return Collections.emptyList(); // It's useless to have overridden markers for object.
	}

	PsiClass subClass = DirectClassInheritorsSearch.search(aClass).findFirst();
	if(subClass != null || FunctionalExpressionSearch.search(aClass).findFirst() != null)
	{
		final Icon icon;
		if(aClass.isInterface())
		{
			if(!myImplementedOption.isEnabled())
			{
				return Collections.emptyList();
			}
			icon = AllIcons.Gutter.ImplementedMethod;
		}
		else
		{
			if(!myOverriddenOption.isEnabled())
			{
				return Collections.emptyList();
			}
			icon = AllIcons.Gutter.OverridenMethod;
		}
		PsiElement range = aClass.getNameIdentifier();
		if(range == null)
		{
			range = aClass;
		}
		MarkerType type = MarkerType.SUBCLASSED_CLASS;
		LineMarkerInfo info = new LineMarkerInfo<>(range, range.getTextRange(), icon, Pass.LINE_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);
		return Collections.singletonList(info);
	}
	return Collections.emptyList();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:43,代码来源:JavaLineMarkerProvider.java

示例15: collectOverridingMethods

private List<LineMarkerInfo> collectOverridingMethods(@NotNull final Iterable<PsiMethod> _methods, @NotNull PsiClass containingClass)
{
	if(!myOverriddenOption.isEnabled() && !myImplementedOption.isEnabled())
	{
		return Collections.emptyList();
	}
	final Set<PsiMethod> overridden = new HashSet<>();

	Set<PsiMethod> methodSet = ContainerUtil.newHashSet(_methods);

	AllOverridingMethodsSearch.search(containingClass).forEach(pair ->
	{
		ProgressManager.checkCanceled();

		final PsiMethod superMethod = pair.getFirst();
		if(methodSet.remove(superMethod))
		{
			overridden.add(superMethod);
		}
		return !methodSet.isEmpty();
	});

	if(!methodSet.isEmpty())
	{
		final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(containingClass);
		if(interfaceMethod != null && FunctionalExpressionSearch.search(containingClass).findFirst() != null)
		{
			overridden.add(interfaceMethod);
		}
	}

	List<LineMarkerInfo> result = new ArrayList<>();
	for(PsiMethod method : overridden)
	{
		ProgressManager.checkCanceled();
		boolean overrides = !method.hasModifierProperty(PsiModifier.ABSTRACT);
		if(overrides)
		{
			if(!myOverriddenOption.isEnabled())
			{
				return Collections.emptyList();
			}
		}
		else
		{
			if(!myImplementedOption.isEnabled())
			{
				return Collections.emptyList();
			}
		}
		PsiElement range = getMethodRange(method);
		final MarkerType type = MarkerType.OVERRIDDEN_METHOD;
		final Icon icon = overrides ? AllIcons.Gutter.OverridenMethod : AllIcons.Gutter.ImplementedMethod;
		LineMarkerInfo<PsiElement> info = new LineMarkerInfo<>(range, range.getTextRange(), icon, Pass.LINE_MARKERS, type.getTooltip(), type.getNavigationHandler(), GutterIconRenderer.Alignment
				.RIGHT);
		NavigateAction.setNavigateAction(info, overrides ? "Go to overriding methods" : "Go to implementation(s)", IdeActions.ACTION_GOTO_IMPLEMENTATION);
		result.add(info);
	}
	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:60,代码来源:JavaLineMarkerProvider.java


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