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


Java EditorCopyPasteHelperImpl类代码示例

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


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

示例1: createPendingSelectAndPasteAction

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
private ChainActionEvent createPendingSelectAndPasteAction(AnActionEvent e) {
    Runnable selectAndPaste = new Runnable() {
        @Override
        public void run() {
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    CommandContext cmdCtx = CopyCutWithoutSelectAction.getInstance().getCmdContext();
                    TextRange tr = Selection.getTextRangeBy(_editor, cmdCtx);
                    if (tr != null) {
                        _editor.getSelectionModel().setSelection(tr.getStartOffset(), tr.getEndOffset());
                        EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_editor);
                    }
                }
            };

            AppUtil.runWriteAction(runnable, _editor);
        }
    };

    return new ChainActionEvent(e, selectAndPaste, _editor, _project);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:23,代码来源:CopyAndReplaceAction.java

示例2: afterJump

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
@Override
public void afterJump() {
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            EditorUtils.copyRange(_selectorClass, _te);
            pasteClipboardToOffset();
        }

        private void pasteClipboardToOffset() {
            focusSourceCaret();

            TextRange[] tr = EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_se);

            if (_config._needSelectTextAfterJump)
                EditorUtils.selectTextRange(_se, tr);
        }
    };

    AppUtil.runWriteAction(runnable, _se);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:22,代码来源:CopyRangeAfterJumpCommand.java

示例3: afterJump

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
@Override
public void afterJump() {
    TextRange tr = getTextRangeToReplace();
    if (tr != null)
    {
        _se.getSelectionModel().setSelection(tr.getStartOffset(), tr.getEndOffset());
    }

    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            if (_addNewLineBeforePaste) {
                _se.getDocument().insertString(_se.getCaretModel().getOffset(), "\n");
                _se.getCaretModel().moveToOffset(_se.getCaretModel().getOffset() + 1);
            }

            EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_se);
        }
    };

    AppUtil.runWriteAction(runnable, _se);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:23,代码来源:PasteAfterJumpCommand.java

示例4: afterJump

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
@Override
public void afterJump() {
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            EditorUtils.copyRange(_selectorClass, _te);
            focusSourceCaret();

            EditorUtils.selectRangeOf(_selectorClass, _se);
            EditorUtils.deleteRange(_selectorClass, _se);
            TextRange[] tr = EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_se);

            if (_config._needSelectTextAfterJump) {
                EditorUtils.selectTextRange(_se, tr);
            }
        }
    };

    AppUtil.runWriteAction(runnable, _se);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:21,代码来源:ObtainAndPasteRangeAfterJumpCommand.java

示例5: afterJump

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
@Override
public void afterJump() {
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {

            TextRange tr = EditorUtils.getRangeOf(_selectorClass, _te);
            if (tr != null)
            {
                _te.getSelectionModel().setSelection(tr.getStartOffset(), tr.getEndOffset());
                EditorUtils.deleteRange(tr, _te);
            }

            CaretModel targetCaret = _te.getCaretModel();

            if (_addNewLineBeforePaste) {
                _te.getDocument().insertString(targetCaret.getOffset(), "\n");
                targetCaret.moveToOffset(targetCaret.getOffset() + 1);
            }

            TextRange[] textRanges = EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_te);

            if (_config._needSelectTextAfterJump) {
                int caret = textRanges[0].getStartOffset() + _caretOffsetFromSelectRangeStartBeforeJump;
                targetCaret.moveToOffset(caret);
                EditorUtils.selectRangeOf(_selectorClass, _te);
            }
        }
    };

    AppUtil.runWriteAction(runnable, _se);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:33,代码来源:ReplaceAfterJumpCommand.java

示例6: afterJump

import com.intellij.openapi.editor.impl.EditorCopyPasteHelperImpl; //导入依赖的package包/类
@Override
public void afterJump() {
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            TextRange sourceRange = EditorUtils.getRangeOf(_selectorClass, _te);

            if (inSameEditor()) {
                boolean noNeedToMove = sourceRange.contains(_soff);
                if (noNeedToMove) {
                    _se.getCaretModel().moveToOffset(_soff);
                    return;
                }
            }

            int textSourceStartOffset = sourceRange.getStartOffset();

            EditorUtils.copyRange(_selectorClass, _te);

            if ( !inSameEditor() || textSourceStartOffset > _soff) {
                deleteTextSource(_te);

                pasteClipboardToOffset();
            } else {
                pasteClipboardToOffset();

                focusTargetCaret();
                deleteTextSource(_te);
                focusSourceCaret();

                int cur_offset = _se.getCaretModel().getOffset();

                if (_config._needSelectTextAfterJump) {
                    EditorUtils.selectTextRange(_se, cur_offset - _length, cur_offset);
                }
            }
        }

        private void deleteTextSource(Editor editor) {
            EditorUtils.selectRangeOf(_selectorClass, editor);
            EditorModificationUtil.deleteSelectedText(editor);
        }

        private void pasteClipboardToOffset() {
            focusSourceCaret();

            TextRange[] tr = EditorCopyPasteHelperImpl.getInstance().pasteFromClipboard(_se);
            if (_config._needSelectTextAfterJump) {
                EditorUtils.selectTextRange(_se, tr);
            }
            _length = tr[0].getEndOffset() - tr[0].getStartOffset();
        }
    };

    AppUtil.runWriteAction(runnable, _se);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:57,代码来源:MoveRangeAfterJumpCommand.java


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