com.intellij.openapi.editor.markup.SeparatorPlacement Java Examples

The following examples show how to use com.intellij.openapi.editor.markup.SeparatorPlacement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FragmentHighlighterImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addSeparatingLine(@Nonnull LineFragment fragment, @Nonnull DiffMarkup appender, int startLine, int endLine) {
  if (endLine <= 0) return;
  TextDiffTypeEnum type = fragment.getType();
  appender.addLineMarker(endLine - 1, type == null ? null : DiffUtil.makeTextDiffType(fragment), SeparatorPlacement.BOTTOM);
  if (fragment.getRange(appender.getSide()).getLength() > 0 && startLine > 0) {
    appender.addLineMarker(startLine, type == null ? null : DiffUtil.makeTextDiffType(fragment), SeparatorPlacement.TOP);
  }
}
 
Example #2
Source File: LineMarkersPass.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static LineMarkerInfo<PsiElement> createMethodSeparatorLineMarker(@Nonnull PsiElement startFrom, @Nonnull EditorColorsManager colorsManager) {
  LineMarkerInfo<PsiElement> 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;
}
 
Example #3
Source File: UsageCountLineProvider.java    From Android-Resource-Usage-Count with MIT License 4 votes vote down vote up
public MyLineMarkerInfo(PsiElement element, int count) {
    super(element, element.getTextRange(), new MyIcon(count), Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.RIGHT);
    separatorPlacement = SeparatorPlacement.BOTTOM;
}
 
Example #4
Source File: UsageCountLineProvider.java    From Android-Resource-Usage-Count with MIT License 4 votes vote down vote up
public MyLineMarkerInfo(PsiElement element, int count) {
    super(element, element.getTextRange(), new MyIcon(count), Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.RIGHT);
    separatorPlacement = SeparatorPlacement.BOTTOM;
}
 
Example #5
Source File: CSharpLineMarkerProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@Nonnull PsiElement element)
{
	if(myDaemonCodeAnalyzerSettings.SHOW_METHOD_SEPARATORS && (element instanceof DotNetQualifiedElement))
	{
		if(element.getNode().getTreeParent() == null)
		{
			return null;
		}

		final PsiElement parent = element.getParent();
		if(!(parent instanceof DotNetMemberOwner))
		{
			return null;
		}

		if(ArrayUtil.getFirstElement(((DotNetMemberOwner) parent).getMembers()) == element)
		{
			return null;
		}

		LineMarkerInfo info = new LineMarkerInfo<PsiElement>(element, element.getTextRange(), null, Pass.UPDATE_ALL, FunctionUtil.<Object, String>nullConstant(), null,
				GutterIconRenderer.Alignment.RIGHT);
		EditorColorsScheme scheme = myEditorColorsManager.getGlobalScheme();
		info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
		info.separatorPlacement = SeparatorPlacement.TOP;
		return info;
	}

	final Ref<LineMarkerInfo> ref = Ref.create();
	Consumer<LineMarkerInfo> consumer = new Consumer<LineMarkerInfo>()
	{
		@Override
		public void consume(LineMarkerInfo markerInfo)
		{
			ref.set(markerInfo);
		}
	};

	//noinspection ForLoopReplaceableByForEach
	for(int j = 0; j < ourSingleCollector.length; j++)
	{
		LineMarkerCollector ourCollector = ourSingleCollector[j];
		ourCollector.collect(element, consumer);
	}

	return ref.get();
}
 
Example #6
Source File: ChangesDiffCalculator.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addLineMarker(int line, TextDiffType type, SeparatorPlacement separatorPlacement) {
}
 
Example #7
Source File: FileSeparatorUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static int getDisplayLine(@Nonnull LineMarkerInfo lineMarkerInfo, @Nonnull Document document) {
  int offset = lineMarkerInfo.separatorPlacement == SeparatorPlacement.TOP ? lineMarkerInfo.startOffset : lineMarkerInfo.endOffset;
  return document.getLineNumber(Math.min(document.getTextLength(), Math.max(0, offset))) +
         (lineMarkerInfo.separatorPlacement == SeparatorPlacement.TOP ? 0 : 1);
}