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


Java EditorModificationUtil.deleteSelectedText方法代码示例

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


在下文中一共展示了EditorModificationUtil.deleteSelectedText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeWriteAction

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
@Override
public void executeWriteAction(Editor editor, Caret caret, DataContext dataContext) {
  CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP);
  CopyPasteManager.getInstance().stopKillRings();

  boolean camelMode = editor.getSettings().isCamelWords();
  if (myNegateCamelMode) {
    camelMode = !camelMode;
  }

  if (editor.getSelectionModel().hasSelection()) {
    EditorModificationUtil.deleteSelectedText(editor);
    return;
  }

  deleteToWordEnd(editor, camelMode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DeleteToWordEndAction.java

示例2: deleteToTargetPosition

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
public static void deleteToTargetPosition(@NotNull Editor editor, @NotNull LogicalPosition pos) {
  LogicalPosition logicalPosition = editor.getCaretModel().getLogicalPosition();
  if (logicalPosition.line != pos.line) {
    LOGGER.error("Unexpected caret position: " + logicalPosition + ", target indent position: " + pos);
    return;
  }
  if (pos.column < logicalPosition.column) {
    int targetOffset = editor.logicalPositionToOffset(pos);
    int offset = editor.getCaretModel().getOffset();
    editor.getSelectionModel().setSelection(targetOffset, offset);
    EditorModificationUtil.deleteSelectedText(editor);
  }
  else if (pos.column > logicalPosition.column) {
    EditorModificationUtil.insertStringAtCaret(editor, StringUtil.repeatSymbol(' ', pos.column - logicalPosition.column));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BackspaceHandler.java

示例3: afterJump

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
@Override
public void afterJump() {
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            if (inSameEditor()) {
                selectJumpArea();

                _se.getSelectionModel().copySelectionToClipboard();
                EditorModificationUtil.deleteSelectedText(_se);
                _se.getSelectionModel().removeSelection();
            }
        }
    };

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

示例4: charDeleted

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
public boolean charDeleted(final char c, @NotNull final PsiFile file, @NotNull final Editor editor) {
    if (myTargetPosition != null) {
        final int offset = editor.getCaretModel().getOffset();
        editor.getSelectionModel().setSelection(offset - editor.getCaretModel().getVisualPosition().column + myTargetPosition.column, offset);
        EditorModificationUtil.deleteSelectedText(editor);
        editor.getCaretModel().moveToLogicalPosition(myTargetPosition);
        myTargetPosition = null;
        return true;
    }
    return false;
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:12,代码来源:OCamlBackspaceHandler.java

示例5: executeWriteAction

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
@Override
public void executeWriteAction(Editor editor, DataContext dataContext) {
  if(!editor.getSelectionModel().hasSelection()) {
    if (Registry.is(CopyAction.SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
      return;
    }
    editor.getSelectionModel().selectLineAtCaret();
  }
  editor.getSelectionModel().copySelectionToClipboard();
  EditorModificationUtil.deleteSelectedText(editor);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:CutAction.java

示例6: makeOneSpaceBetween

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
private void makeOneSpaceBetween(final int begin, final int end) {
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            _editor.getSelectionModel().setSelection(begin, end);
            EditorModificationUtil.deleteSelectedText(_editor);
            EditorModificationUtil.insertStringAtCaret(_editor, " ");
        }
    };
    AppUtil.runWriteAction(runnable, _editor);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:12,代码来源:JustOneSpace.java

示例7: cutSelection

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
private void cutSelection() {
    Runnable cutRunnable = new Runnable() {
        @Override
        public void run() {
            _editor.getSelectionModel().copySelectionToClipboard();
            EditorModificationUtil.deleteSelectedText(_editor);
        }
    };

    AppUtil.runWriteAction(cutRunnable, _editor);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:12,代码来源:CopyCutWithoutSelectAction.java

示例8: deleteToTargetPosition

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
public static void deleteToTargetPosition(@Nonnull Editor editor, @Nonnull LogicalPosition pos) {
  final int offset = editor.getCaretModel().getOffset();
  final int targetOffset = editor.logicalPositionToOffset(pos);
  editor.getSelectionModel().setSelection(targetOffset, offset);
  EditorModificationUtil.deleteSelectedText(editor);
  editor.getCaretModel().moveToLogicalPosition(pos);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:BackspaceHandler.java

示例9: executeWriteAction

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
@Override
public void executeWriteAction(Editor editor, DataContext dataContext) {
  Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(editor.getContentComponent()));
  if (project == null) {
    if (myOriginalHandler != null) {
      myOriginalHandler.execute(editor, dataContext);
    }
    return;
  }

  final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());

  if (file == null) {
    if (myOriginalHandler != null) {
      myOriginalHandler.execute(editor, dataContext);
    }
    return;
  }

  SelectionModel selectionModel = editor.getSelectionModel();
  if (!selectionModel.hasSelection() && !selectionModel.hasBlockSelection()) {
    if (Registry.is(CopyAction.SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
      return;
    }
    selectionModel.selectLineAtCaret();
    if (!selectionModel.hasSelection()) return;
  }

  int start = selectionModel.getSelectionStart();
  int end = selectionModel.getSelectionEnd();

  EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_COPY).execute(editor, dataContext);

  if (start != end) {
    // There is a possible case that 'sticky selection' is active. It's automatically removed on copying then, so, we explicitly
    // remove the text.
    editor.getDocument().deleteString(start, end);
  }
  else {
    EditorModificationUtil.deleteSelectedText(editor);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:CutHandler.java

示例10: deleteRange

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的package包/类
public static void deleteRange(Class<? extends Selector> selectorClass, Editor editor) {
    selectRangeOf(selectorClass, editor);
    EditorModificationUtil.deleteSelectedText(editor);
}
 
开发者ID:whunmr,项目名称:emacsIDEAs,代码行数:5,代码来源:EditorUtils.java

示例11: afterJump

import com.intellij.openapi.editor.EditorModificationUtil; //导入方法依赖的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.EditorModificationUtil.deleteSelectedText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。