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


Java MarkupEditorFilterFactory类代码示例

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


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

示例1: mouseClicked

import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory; //导入依赖的package包/类
public void mouseClicked(final EditorMouseEvent e) {
  final Editor editor = e.getEditor();
  final MouseEvent mouseEvent = e.getMouseEvent();
  if (mouseEvent.isPopupTrigger()
      || mouseEvent.isMetaDown() || mouseEvent.isControlDown()
      || mouseEvent.getButton() != MouseEvent.BUTTON1
      || MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor)
      || e.getArea() != EditorMouseEventArea.LINE_MARKERS_AREA
      ||!isFromMyProject(editor)) {
    return;
  }

  PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Runnable() {
    public void run() {
      final int line = editor.xyToLogicalPosition(mouseEvent.getPoint()).line;
      final Document document = editor.getDocument();
      final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
      if (line >= 0 && line < document.getLineCount() && file != null) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          public void run() {
            if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) {

              XDebuggerUtil.getInstance().toggleLineBreakpoint(myProject, file, line, mouseEvent.isAltDown());
            }
          }
        });
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:XLineBreakpointManager.java

示例2: createHighlighter

import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory; //导入依赖的package包/类
@Override
@RequiredDispatchThread
protected void createHighlighter(@Nonnull Range range) {
  myApplication.assertIsDispatchThread();

  if (range.getHighlighter() != null) {
    LOG.error("Multiple highlighters registered for the same Range");
    return;
  }

  if (myMode == Mode.SILENT) return;

  int first =
          range.getLine1() >= getLineCount(myDocument) ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getLine1());
  int second =
          range.getLine2() >= getLineCount(myDocument) ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getLine2());

  MarkupModel markupModel = DocumentMarkupModel.forDocument(myDocument, myProject, true);

  RangeHighlighter highlighter = LineStatusMarkerRenderer.createRangeHighlighter(range, new TextRange(first, second), markupModel);
  highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(range, (editor) -> {
    return new LineStatusTrackerDrawing.MyLineStatusMarkerPopup(this, editor, range);
  }));

  highlighter.setEditorFilter(MarkupEditorFilterFactory.createIsNotDiffFilter());

  range.setHighlighter(highlighter);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:LineStatusTracker.java

示例3: mouseClicked

import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory; //导入依赖的package包/类
@Override
public void mouseClicked(final EditorMouseEvent e) {
  final Editor editor = e.getEditor();
  final MouseEvent mouseEvent = e.getMouseEvent();
  if (mouseEvent.isPopupTrigger()
      || mouseEvent.isMetaDown() || mouseEvent.isControlDown()
      || mouseEvent.getButton() != MouseEvent.BUTTON1
      || MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor)
      || !isInsideGutter(e, editor)
      || ConsoleViewUtil.isConsoleViewEditor(editor)
      || !isFromMyProject(editor)
      || (editor.getSelectionModel().hasSelection() && myDragDetected)
    ) {
    return;
  }

  PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Runnable() {
    @Override
    public void run() {
      final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent);
      final Document document = editor.getDocument();
      final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
      if (line >= 0 && line < document.getLineCount() && file != null) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) {
              ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent());

              AsyncResult<XLineBreakpoint> result = XBreakpointUtil.toggleLineBreakpoint(
                myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false);
              result.doWhenDone(new Consumer<XLineBreakpoint>() {
                @Override
                public void consume(XLineBreakpoint breakpoint) {
                  if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) {
                    breakpoint.setSuspendPolicy(SuspendPolicy.NONE);
                    String selection = editor.getSelectionModel().getSelectedText();
                    if (selection != null) {
                      breakpoint.setLogExpression(selection);
                    }
                    else {
                      breakpoint.setLogMessage(true);
                    }
                    // edit breakpoint
                    DebuggerUIUtil.showXBreakpointEditorBalloon(myProject, mouseEvent.getPoint(), ((EditorEx)editor).getGutterComponentEx(), false, breakpoint);
                  }
                }
              });
            }
          }
        });
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:XLineBreakpointManager.java

示例4: mouseClicked

import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory; //导入依赖的package包/类
@Override
public void mouseClicked(final EditorMouseEvent e) {
  final Editor editor = e.getEditor();
  final MouseEvent mouseEvent = e.getMouseEvent();
  if (mouseEvent.isPopupTrigger() ||
      mouseEvent.isMetaDown() ||
      mouseEvent.isControlDown() ||
      mouseEvent.getButton() != MouseEvent.BUTTON1 ||
      MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor) ||
      !isInsideGutter(e, editor) ||
      ConsoleViewUtil.isConsoleViewEditor(editor) ||
      !isFromMyProject(editor) ||
      (editor.getSelectionModel().hasSelection() && myDragDetected)) {
    return;
  }

  PsiDocumentManager.getInstance(myProject).commitAllDocuments();
  final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent);
  final Document document = editor.getDocument();
  final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (line >= 0 && line < document.getLineCount() && file != null) {
    ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent());

    final AsyncResult<XLineBreakpoint> lineBreakpoint =
            XBreakpointUtil.toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false);
    lineBreakpoint.doWhenDone(breakpoint -> {
      if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) {
        breakpoint.setSuspendPolicy(SuspendPolicy.NONE);
        String selection = editor.getSelectionModel().getSelectedText();
        if (selection != null) {
          breakpoint.setLogExpression(selection);
        }
        else {
          breakpoint.setLogMessage(true);
        }
        // edit breakpoint
        DebuggerUIUtil.showXBreakpointEditorBalloon(myProject, mouseEvent.getPoint(), ((EditorEx)editor).getGutterComponentEx(), false, breakpoint);
      }
    });
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:42,代码来源:XLineBreakpointManager.java


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