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


Java EditorGutterComponentEx类代码示例

本文整理汇总了Java中com.intellij.openapi.editor.ex.EditorGutterComponentEx的典型用法代码示例。如果您正苦于以下问题:Java EditorGutterComponentEx类的具体用法?Java EditorGutterComponentEx怎么用?Java EditorGutterComponentEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: paint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
@Override
public void paint(Editor editor, Graphics g, Rectangle range) {
  EditorGutterComponentEx gutter = ((EditorEx)editor).getGutterComponentEx();
  Graphics2D g2 = (Graphics2D)g;
  int x1 = 0;
  int x2 = x1 + gutter.getWidth();
  int y = range.y;
  int height = range.height;

  int annotationsOffset = gutter.getAnnotationsAreaOffset();
  int annotationsWidth = gutter.getAnnotationsAreaWidth();
  if (annotationsWidth != 0) {
    drawMarker(editor, g2, x1, annotationsOffset, y, height, false);
    x1 = annotationsOffset + annotationsWidth;
  }

  if (myIgnoredFoldingOutline) {
    int xOutline = gutter.getWhitespaceSeparatorOffset();
    drawMarker(editor, g2, xOutline, x2, y, height, true);
    drawMarker(editor, g2, x1, xOutline, y, height, false);
  } else {
    drawMarker(editor, g2, x1, x2, y, height, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DiffLineMarkerRenderer.java

示例2: paint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
@Override
public void paint(Editor editor, Graphics g, Rectangle r) {
  if (!myCondition.get()) return;

  int y = r.y;
  int lineHeight = myEditor.getLineHeight();

  EditorGutterComponentEx gutter = ((EditorEx)editor).getGutterComponentEx();
  int annotationsOffset = gutter.getAnnotationsAreaOffset();
  int annotationsWidth = gutter.getAnnotationsAreaWidth();
  if (annotationsWidth != 0) {
    g.setColor(editor.getColorsScheme().getColor(EditorColors.GUTTER_BACKGROUND));
    g.fillRect(annotationsOffset, y, annotationsWidth, lineHeight);
  }

  draw(g, 0, y, lineHeight, myEditor.getColorsScheme());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DiffLineSeparatorRenderer.java

示例3: requestRepaint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
private void requestRepaint(VerticalInfo oldCaretInfo) {
  int lineHeight = myEditor.getLineHeight();
  Rectangle visibleArea = myEditor.getScrollingModel().getVisibleArea();
  final EditorGutterComponentEx gutter = myEditor.getGutterComponentEx();
  final EditorComponentImpl content = myEditor.getContentComponent();

  int updateWidth = myEditor.getScrollPane().getHorizontalScrollBar().getValue() + visibleArea.width;
  if (Math.abs(myCaretInfo.y - oldCaretInfo.y) <= 2 * lineHeight) {
    int minY = Math.min(oldCaretInfo.y, myCaretInfo.y);
    int maxY = Math.max(oldCaretInfo.y + oldCaretInfo.height, myCaretInfo.y + myCaretInfo.height);
    content.repaintEditorComponent(0, minY, updateWidth, maxY - minY);
    gutter.repaint(0, minY, gutter.getWidth(), maxY - minY);
  }
  else {
    content.repaintEditorComponent(0, oldCaretInfo.y, updateWidth, oldCaretInfo.height + lineHeight);
    gutter.repaint(0, oldCaretInfo.y, updateWidth, oldCaretInfo.height + lineHeight);
    content.repaintEditorComponent(0, myCaretInfo.y, updateWidth, myCaretInfo.height + lineHeight);
    gutter.repaint(0, myCaretInfo.y, updateWidth, myCaretInfo.height + lineHeight);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CaretImpl.java

示例4: paint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public void paint(Editor editor, Graphics g, Rectangle r) {
  final TextAttributes color = editor.getColorsScheme().getAttributes(myKey);
  Color bgColor = color.getBackgroundColor();
  if (bgColor == null) {
    bgColor = color.getForegroundColor();
  }
  if (editor.getSettings().isLineNumbersShown() || ((EditorGutterComponentEx)editor.getGutter()).isAnnotationsShown()) {
    if (bgColor != null) {
      bgColor = ColorUtil.toAlpha(bgColor, 150);
    }
  }
  if (bgColor != null) {
    g.setColor(bgColor);
  }
  g.fillRect(r.x, r.y, r.width, r.height);
  final LineData lineData = getLineData(editor.xyToLogicalPosition(new Point(0, r.y)).line);
  if (lineData != null && lineData.isCoveredByOneTest()) {
    g.drawImage( ImageLoader.loadFromResource("/gutter/unique.png"), r.x, r.y, 8, 8, editor.getComponent());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CoverageLineMarkerRenderer.java

示例5: AnnotationPresentation

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
AnnotationPresentation(@NotNull final HighlightAnnotationsActions highlighting, @Nullable final AnnotationSourceSwitcher switcher,
                              final EditorGutterComponentEx gutter,
                              final List<AnnotationFieldGutter> gutters,
                              final AnAction... actions) {
  myHighlighting = highlighting;
  mySwitcher = switcher;

  myActions = new ArrayList<AnAction>();
  myActions.add(Separator.getInstance());
  if (actions != null) {
    final List<AnAction> actionsList = Arrays.asList(actions);
    if (!actionsList.isEmpty()) {
      myActions.addAll(actionsList);
      myActions.add(new Separator());
    }
  }
  myActions.addAll(myHighlighting.getList());
  if (mySwitcher != null) {
    mySwitchAction = new SwitchAnnotationSourceAction(mySwitcher, gutter);
    myActions.add(mySwitchAction);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:AnnotationPresentation.java

示例6: AnnotateActionGroup

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public AnnotateActionGroup(@Nonnull List<AnnotationFieldGutter> gutters,
                           @Nonnull EditorGutterComponentEx gutterComponent,
                           @Nullable Couple<Map<VcsRevisionNumber, Color>> bgColorMap) {
  super("View", true);
  final List<AnAction> actions = new ArrayList<>();
  for (AnnotationFieldGutter g : gutters) {
    if (g.getID() != null) {
      actions.add(new ShowHideAspectAction(g, gutterComponent));
    }
  }
  actions.add(AnSeparator.getInstance());
  if (bgColorMap != null) {
    actions.add(new ShowAnnotationColorsAction(gutterComponent));
  }
  actions.add(new ShowShortenNames(gutterComponent));
  myActions = actions.toArray(new AnAction[actions.size()]);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:AnnotateActionGroup.java

示例7: register

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public void register(@NotNull List<? extends Editor> editors) {
  myEditors = editors;
  for (Editor editor : editors) {
    if (editor == null) continue;
    registerCustomShortcutSet(getShortcutSet(), (EditorGutterComponentEx)editor.getGutter());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:OpenInEditorWithMouseAction.java

示例8: setLineNumberConvertors

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public void setLineNumberConvertors(@NotNull TIntFunction old, @NotNull TIntFunction newConvertor) {
  if (getEditor1() != null) {
    ((EditorGutterComponentEx) getEditor1().getGutter()).setLineNumberConvertor(old);
  }
  if (getEditor2() != null) {
    ((EditorGutterComponentEx) getEditor2().getGutter()).setLineNumberConvertor(newConvertor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DiffPanelImpl.java

示例9: paint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
@Override
public void paint(Editor editor, Graphics g, Rectangle range) {
  Color color = myDiffType.getPolygonColor(editor);
  if (color == null) {
    return;
  }

  EditorGutterComponentEx gutter = ((EditorEx)editor).getGutterComponentEx();
  Graphics2D g2 = (Graphics2D)g;
  int x = 0;
  int y = range.y;
  int width = gutter.getWidth();
  int height = range.height;

  if (!myDiffType.isApplied()) {
    if (height > 2) {
      g.setColor(color);
      g.fillRect(x, y, width, height);
      DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y - 1, color);
      DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y + height - 1, color);
    }
    else {
      // insertion or deletion, when a range is null. matching the text highlighter which is a 2 pixel line
      DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y - 1, color);
    }
  }
  else {
    DiffUtil.drawBoldDottedFramingLines(g2, x, x + width, y - 1, y + height - 1, color);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:DiffLineMarkerRenderer.java

示例10: editBreakpoint

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public void editBreakpoint(@NotNull Project project, @NotNull Editor editor, @NotNull Object breakpoint, @NotNull GutterIconRenderer breakpointGutterRenderer) {
  if (BreakpointsDialogFactory.getInstance(project).isBreakpointPopupShowing()) return;
  EditorGutterComponentEx gutterComponent = ((EditorEx)editor).getGutterComponentEx();
  Point point = gutterComponent.getPoint(breakpointGutterRenderer);
  if (point == null) return;
  final Icon icon = breakpointGutterRenderer.getIcon();
  Point whereToShow = new Point(point.x + icon.getIconWidth() / 2, point.y + icon.getIconHeight() / 2);
  doShowPopup(project, gutterComponent, whereToShow, breakpoint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EditBreakpointActionHandler.java

示例11: ShowAnnotationColorsAction

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public ShowAnnotationColorsAction(EditorGutterComponentEx gutter) {
  super("Colors", true);

  final ArrayList<AnAction> kids = new ArrayList<AnAction>(ShortNameType.values().length);
  for (ColorMode type : ColorMode.values()) {
    kids.add(new SetColorModeAction(type, gutter));
  }
  myChildren = kids.toArray(new AnAction[kids.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ShowAnnotationColorsAction.java

示例12: ShowShortenNames

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public ShowShortenNames(final EditorGutterComponentEx gutter) {
  super("Names", true);
  final ArrayList<AnAction> kids = new ArrayList<AnAction>(ShortNameType.values().length);
  for (ShortNameType type : ShortNameType.values()) {
    kids.add(new SetShortNameTypeAction(type, gutter));
  }
  myChildren = kids.toArray(new AnAction[kids.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ShowShortenNames.java

示例13: AnnotateActionGroup

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public AnnotateActionGroup(List<AnnotationFieldGutter> gutters, EditorGutterComponentEx gutterComponent) {
  super("View", true);
  final List<AnAction> actions = new ArrayList<AnAction>();
  for (AnnotationFieldGutter g : gutters) {
    if (g.getID() != null) {
      actions.add(new ShowHideAspectAction(g, gutterComponent));
    }
  }
  actions.add(Separator.getInstance());
  actions.add(new ShowAnnotationColorsAction(gutterComponent));
  actions.add(new ShowShortenNames(gutterComponent));
  myActions = actions.toArray(new AnAction[actions.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AnnotateActionGroup.java

示例14: canDoAction

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public boolean canDoAction(final MouseEvent e) {
  Component component = e.getComponent();
  if (component instanceof EditorGutterComponentEx) {
    EditorGutterComponentEx gutter = (EditorGutterComponentEx)component;
    return e.getX() > gutter.getLineMarkerAreaOffset() && e.getX() < gutter.getIconAreaOffset();
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CoverageLineMarkerRenderer.java

示例15: moveToLine

import com.intellij.openapi.editor.ex.EditorGutterComponentEx; //导入依赖的package包/类
public void moveToLine(final int lineNumber, final Editor editor) {
  final int firstOffset = editor.getDocument().getLineStartOffset(lineNumber);
  editor.getCaretModel().moveToOffset(firstOffset);
  editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);

  editor.getScrollingModel().runActionOnScrollingFinished(new Runnable() {
    public void run() {
      Point p = editor.visualPositionToXY(editor.offsetToVisualPosition(firstOffset));
      EditorGutterComponentEx editorComponent = (EditorGutterComponentEx)editor.getGutter();
      JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();
      p = SwingUtilities.convertPoint(editorComponent, THICKNESS, p.y, layeredPane);
      showHint(editor, p, lineNumber);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:CoverageLineMarkerRenderer.java


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