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