本文整理汇总了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());
}
}
});
}
}
});
}
示例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);
}
示例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);
}
}
});
}
}
});
}
}
});
}
示例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);
}
});
}
}