Java 类com.intellij.openapi.editor.markup.SeparatorPlacement 实例源码

项目:intellij-ce-playground    文件:LineMarkersPass.java   
@NotNull
public static LineMarkerInfo createMethodSeparatorLineMarker(@NotNull PsiElement startFrom, @NotNull EditorColorsManager colorsManager) {
  LineMarkerInfo info = new LineMarkerInfo<PsiElement>(
    startFrom, 
    startFrom.getTextRange(), 
    null, 
    Pass.UPDATE_ALL, 
    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;
}
项目:tools-idea    文件:LineMarkersPass.java   
@NotNull
public static LineMarkerInfo createMethodSeparatorLineMarker(@NotNull PsiElement startFrom, @NotNull EditorColorsManager colorsManager) {
  LineMarkerInfo info = new LineMarkerInfo<PsiElement>(
    startFrom, 
    startFrom.getTextRange(), 
    null, 
    Pass.UPDATE_ALL, 
    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;
}
项目:consulo-lua    文件:LuaMethodSeparatorMarkerProvider.java   
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
    if(myDaemonSettings.SHOW_METHOD_SEPARATORS)
    {
        if(element instanceof LuaDocComment)
        {
            LuaDocCommentOwner owner = ((LuaDocComment) element).getOwner();

            if(owner instanceof LuaFunctionDefinition)
            {
                TextRange range = new TextRange(element.getTextOffset(), owner.getTextRange().getEndOffset());
                LineMarkerInfo<PsiElement> info = new LineMarkerInfo<>(element, range, null, Pass.UPDATE_ALL, NullableFunction.NULL, null, GutterIconRenderer.Alignment.RIGHT);
                EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
                info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
                info.separatorPlacement = SeparatorPlacement.TOP;
                return info;
            }
        }
    }
    return null;
}
项目:DeftIDEA    文件:DylanLineMarkerProvider.java   
@Override
@Nullable
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
  if (myDaemonSettings.SHOW_METHOD_SEPARATORS) {
    if (element instanceof DylanDefinition) {
      LineMarkerInfo info = new LineMarkerInfo<PsiElement>(element, element.getTextRange(), null, Pass.UPDATE_ALL,
                                                           FunctionUtil.<Object, String>nullConstant(), null,
                                                           GutterIconRenderer.Alignment.RIGHT);
      EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
      info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
      info.separatorPlacement = SeparatorPlacement.BOTTOM;
      return info;
    }
  }
  return null;
}
项目:consulo    文件:LineMarkersPass.java   
@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;
}
项目:lua-for-idea    文件:LuaLineMarkerProvider.java   
@Override
public LineMarkerInfo getLineMarkerInfo(final PsiElement element) {
    if (element instanceof LuaReturnStatement && LuaApplicationSettings.getInstance().SHOW_TAIL_CALLS_IN_GUTTER) {
        LuaReturnStatement e = (LuaReturnStatement) element;

        if (e.isTailCall())
            return new LineMarkerInfo<PsiElement>(element, element.getTextRange(),
                    LuaIcons.TAIL_RECURSION, Pass.UPDATE_ALL,
                    tailCallTooltip, null,
                    GutterIconRenderer.Alignment.LEFT);
    }

    if (myDaemonSettings.SHOW_METHOD_SEPARATORS) {
        if (element instanceof LuaDocComment) {
            LuaDocCommentOwner owner = ((LuaDocComment) element).getOwner();

            if (owner instanceof LuaFunctionDefinition) {
                TextRange range = new TextRange(element.getTextOffset(), owner.getTextRange().getEndOffset());
                LineMarkerInfo<PsiElement> info =
                        new LineMarkerInfo<PsiElement>(element, range, null, Pass.UPDATE_ALL,
                                NullableFunction.NULL, null, GutterIconRenderer.Alignment.RIGHT);
                EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
                info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
                info.separatorPlacement = SeparatorPlacement.TOP;
                return info;
            }
        }
    }

    return null;
}
项目:intellij-ce-playground    文件:SimpleOnesideDiffViewer.java   
@Override
@NotNull
protected Runnable performRediff(@NotNull final ProgressIndicator indicator) {
  indicator.checkCanceled();

  return new Runnable() {
    @Override
    public void run() {
      clearDiffPresentation();

      boolean shouldHighlight = getTextSettings().getHighlightPolicy() != HighlightPolicy.DO_NOT_HIGHLIGHT;
      if (shouldHighlight) {
        final DocumentContent content = getContent();
        final Document document = content.getDocument();

        int start = 0;
        int end = document.getTextLength();
        TextDiffType type = getSide().select(TextDiffType.DELETED, TextDiffType.INSERTED);

        myHighlighters.addAll(DiffDrawUtil.createHighlighter(getEditor(), start, end, type, false));

        int startLine = 0;
        int endLine = getLineCount(document);

        if (startLine != endLine) {
          myHighlighters.addAll(DiffDrawUtil.createLineMarker(getEditor(), startLine, type, SeparatorPlacement.TOP));
          myHighlighters.addAll(DiffDrawUtil.createLineMarker(getEditor(), endLine - 1, type, SeparatorPlacement.BOTTOM));
        }
      }

      myInitialScrollHelper.onRediff();
    }
  };
}
项目:intellij-ce-playground    文件:SimpleThreesideDiffChange.java   
private void createHighlighter(@NotNull ThreeSide side) {
  Editor editor = side.select(myEditors);
  Document document = editor.getDocument();

  TextDiffType type = getDiffType();
  int startLine = myFragment.getStartLine(side);
  int endLine = myFragment.getEndLine(side);

  int start;
  int end;
  if (startLine == endLine) {
    start = end = startLine < DiffUtil.getLineCount(document) ? document.getLineStartOffset(startLine) : document.getTextLength();
  }
  else {
    start = document.getLineStartOffset(startLine);
    end = document.getLineEndOffset(endLine - 1);
    if (end < document.getTextLength()) end++;
  }

  myHighlighters.addAll(DiffDrawUtil.createHighlighter(editor, start, end, type));

  if (startLine == endLine) {
    if (startLine != 0) myHighlighters.addAll(DiffDrawUtil.createLineMarker(editor, endLine - 1, type, SeparatorPlacement.BOTTOM, true));
  }
  else {
    myHighlighters.addAll(DiffDrawUtil.createLineMarker(editor, startLine, type, SeparatorPlacement.TOP));
    myHighlighters.addAll(DiffDrawUtil.createLineMarker(editor, endLine - 1, type, SeparatorPlacement.BOTTOM));
  }
}
项目:intellij-ce-playground    文件:FragmentHighlighterImpl.java   
private static void addSeparatingLine(@NotNull LineFragment fragment, @NotNull 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);
  }
}
项目:intellij-ce-playground    文件:SvnPropertiesDiffViewer.java   
private SvnPropertiesDiffViewer(@NotNull DiffContext context, @NotNull WrapperRequest request, @NotNull List<DiffChange> diffChanges) {
  super(context, request);
  myWrapperRequest = request;
  myDiffChanges = diffChanges;

  for (EditorEx editor : getEditors()) {
    if (editor == null) continue;
    EditorSettings settings = editor.getSettings();

    settings.setAdditionalLinesCount(0);
    settings.setAdditionalColumnsCount(1);
    settings.setRightMarginShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setLineNumbersShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setAdditionalPageAtBottom(false);
    settings.setCaretRowShown(false);
    settings.setUseSoftWraps(false);
    editor.reinitSettings();
  }

  for (DiffChange change : myDiffChanges) {
    DiffDrawUtil.createBorderLineMarker(getEditor(Side.LEFT), change.myEndLine1, SeparatorPlacement.TOP);
    DiffDrawUtil.createBorderLineMarker(getEditor(Side.RIGHT), change.myEndLine2, SeparatorPlacement.TOP);
  }

  DiffSplitter splitter = myContentPanel.getSplitter();
  splitter.setDividerWidth(120);
  splitter.setShowDividerIcon(false);
}
项目:tools-idea    文件:FragmentHighlighterImpl.java   
private static void addSeparatingLine(@NotNull LineFragment fragment, @NotNull 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);
  }
}
项目:consulo    文件:FragmentHighlighterImpl.java   
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);
  }
}
项目:Android-Resource-Usage-Count    文件:UsageCountLineProvider.java   
public MyLineMarkerInfo(PsiElement element, int count) {
    super(element, element.getTextRange(), new MyIcon(count), Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.RIGHT);
    separatorPlacement = SeparatorPlacement.BOTTOM;
}
项目:Android-Resource-Usage-Count    文件:UsageCountLineProvider.java   
public MyLineMarkerInfo(PsiElement element, int count) {
    super(element, element.getTextRange(), new MyIcon(count), Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.RIGHT);
    separatorPlacement = SeparatorPlacement.BOTTOM;
}
项目:intellij-ce-playground    文件:JavaLineMarkerProvider.java   
@Override
@Nullable
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
  PsiElement parent;
  if (element instanceof PsiIdentifier && (parent = element.getParent()) instanceof PsiMethod) {
    PsiMethod method = (PsiMethod)parent;
    MethodSignatureBackedByPsiMethod superSignature = SuperMethodsSearch.search(method, null, true, false).findFirst();
    if (superSignature != null) {
      boolean overrides =
        method.hasModifierProperty(PsiModifier.ABSTRACT) == superSignature.getMethod().hasModifierProperty(PsiModifier.ABSTRACT);

      final Icon icon = overrides ? AllIcons.Gutter.OverridingMethod : AllIcons.Gutter.ImplementingMethod;
      return createSuperMethodLineMarkerInfo(element, icon, Pass.UPDATE_ALL);
    }
  }

  final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(element);
  final PsiElement firstChild = element.getFirstChild();
  if (interfaceMethod != null && firstChild != null) {
    return createSuperMethodLineMarkerInfo(firstChild, AllIcons.Gutter.ImplementingFunctional, Pass.UPDATE_ALL);
  }

  if (myDaemonSettings.SHOW_METHOD_SEPARATORS && firstChild == null) {
    PsiElement element1 = element;
    boolean isMember = false;
    while (element1 != null && !(element1 instanceof PsiFile) && element1.getPrevSibling() == null) {
      element1 = element1.getParent();
      if (element1 instanceof PsiMember) {
        isMember = true;
        break;
      }
    }
    if (isMember && !(element1 instanceof PsiAnonymousClass || element1.getParent() instanceof PsiAnonymousClass)) {
      PsiFile file = element1.getContainingFile();
      Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getLastCommittedDocument(file);
      boolean drawSeparator = false;

      if (document != null) {
        CharSequence documentChars = document.getCharsSequence();
        int category = getCategory(element1, documentChars);
        for (PsiElement child = element1.getPrevSibling(); child != null; child = child.getPrevSibling()) {
          int category1 = getCategory(child, documentChars);
          if (category1 == 0) continue;
          drawSeparator = category != 1 || category1 != 1;
          break;
        }
      }

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

  return null;
}
项目:intellij-ce-playground    文件:ChangesDiffCalculator.java   
@Override
public void addLineMarker(int line, TextDiffType type, SeparatorPlacement separatorPlacement) {
}
项目:intellij-ce-playground    文件:FileSeparatorProvider.java   
public static int getDisplayLine(@NotNull LineMarkerInfo lineMarkerInfo, @NotNull 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);
}
项目:intellij-ce-playground    文件:PyLineSeparatorUtil.java   
private static LineMarkerInfo<PsiElement> createLineSeparatorByElement(final PsiElement element) {
  final LineMarkerInfo<PsiElement> info = new LineMarkerInfo<PsiElement>(element, element.getTextRange().getStartOffset(), null, Pass.UPDATE_ALL, null, null);
  info.separatorColor = EditorColorsManager.getInstance().getGlobalScheme().getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
  info.separatorPlacement = SeparatorPlacement.TOP;
  return info;
}
项目:tools-idea    文件:JavaLineMarkerProvider.java   
@Override
@Nullable
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
  PsiElement parent;
  if (element instanceof PsiIdentifier && (parent = element.getParent()) instanceof PsiMethod && 
      !DumbService.getInstance(element.getProject()).isDumb()) {
    PsiMethod method = (PsiMethod)parent;
    MethodSignatureBackedByPsiMethod superSignature = SuperMethodsSearch.search(method, null, true, false).findFirst();
    if (superSignature != null) {
      boolean overrides =
        method.hasModifierProperty(PsiModifier.ABSTRACT) == superSignature.getMethod().hasModifierProperty(PsiModifier.ABSTRACT);

      final Icon icon = overrides ? AllIcons.Gutter.OverridingMethod : AllIcons.Gutter.ImplementingMethod;
      final MarkerType type = MarkerType.OVERRIDING_METHOD;
      return new ArrowUpLineMarkerInfo(element, icon, type);
    }
  }

  if (myDaemonSettings.SHOW_METHOD_SEPARATORS && element.getFirstChild() == null) {
    PsiElement element1 = element;
    boolean isMember = false;
    while (element1 != null && !(element1 instanceof PsiFile) && element1.getPrevSibling() == null) {
      element1 = element1.getParent();
      if (element1 instanceof PsiMember) {
        isMember = true;
        break;
      }
    }
    if (isMember && !(element1 instanceof PsiAnonymousClass || element1.getParent() instanceof PsiAnonymousClass)) {
      PsiFile file = element1.getContainingFile();
      Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
      boolean drawSeparator = false;

      if (document != null) {
        CharSequence documentChars = document.getCharsSequence();
        int category = getCategory(element1, documentChars);
        for (PsiElement child = element1.getPrevSibling(); child != null; child = child.getPrevSibling()) {
          int category1 = getCategory(child, documentChars);
          if (category1 == 0) continue;
          drawSeparator = category != 1 || category1 != 1;
          break;
        }
      }

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

  return null;
}
项目:tools-idea    文件:ChangesDiffCalculator.java   
@Override
public void addLineMarker(int line, TextDiffType type, SeparatorPlacement separatorPlacement) {
}
项目:consulo-csharp    文件:CSharpLineMarkerProvider.java   
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull 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();
}
项目:consulo    文件:ChangesDiffCalculator.java   
@Override
public void addLineMarker(int line, TextDiffType type, SeparatorPlacement separatorPlacement) {
}
项目:consulo    文件:FileSeparatorUtil.java   
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);
}