boolean (@NotNull EditorImpl editor, @NotNull Transferable t, int dropAction) { EditorDropHandler dropHandler = editor.getDropHandler(); if (Registry.is("debugger.click.disable.breakpoints")) { try { if (t.isDataFlavorSupported(GutterDraggableObject.flavor)) { Object attachedObject = t.getTransferData(GutterDraggableObject.flavor); if (attachedObject instanceof GutterIconRenderer) { GutterDraggableObject object = ((GutterIconRenderer)attachedObject).getDraggableObject(); if (object != null) { object.remove(); Point mouseLocationOnScreen = MouseInfo.getPointerInfo().getLocation(); JComponent editorComponent = editor.getComponent(); Point editorComponentLocationOnScreen = editorComponent.getLocationOnScreen(); Disposable painterListenersDisposable = Disposer.newDisposable("PainterListenersDisposable"); Disposer.register(editor.getDisposable(), painterListenersDisposable); GutterIconDropAnimator painter = new GutterIconDropAnimator( new Point( mouseLocationOnScreen.x - editorComponentLocationOnScreen.x, mouseLocationOnScreen.y - editorComponentLocationOnScreen.y ), editor.myGutterComponent.getDragImage((GutterIconRenderer)attachedObject), painterListenersDisposable ); IdeGlassPaneUtil.installPainter( editorComponent, painter, painterListenersDisposable ); return true; } } } } catch (UnsupportedFlavorException | IOException e) { LOG.warn(e); } } if (dropHandler != null && dropHandler.canHandleDrop(t.getTransferDataFlavors())) { dropHandler.handleDrop(t, editor.getProject(), null, dropAction); return true; } int caretOffset = editor.getCaretModel().getOffset(); if (editor.myDraggedRange != null && editor.myDraggedRange.getStartOffset() <= caretOffset && caretOffset < editor.myDraggedRange.getEndOffset()) { return false; } if (editor.myDraggedRange != null) { editor.getCaretModel().moveToOffset(editor.mySavedCaretOffsetForDNDUndoHack); } CommandProcessor.getInstance().executeCommand(editor.myProject, () -> { try { editor.getSelectionModel().removeSelection(); int offset; if (editor.myDraggedRange != null) { editor.getCaretModel().moveToOffset(caretOffset); offset = caretOffset; } else { offset = editor.getCaretModel().getOffset(); } if (editor.getDocument().getRangeGuard(offset, offset) != null) { return; } editor.putUserData(LAST_PASTED_REGION, null); AnAction pasteAction = ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_PASTE); if (pasteAction instanceof EditorAction) { EditorTextInsertHandler handler = ((EditorAction)pasteAction).getHandlerOfType(EditorTextInsertHandler.class); if (handler == null) { LOG.error("No suitable paste handler found"); } else { try (AccessToken ignore = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { handler.execute(editor, editor.getDataContext(), () -> t); } } } else { LOG.error("Couldn't find paste action: " + pasteAction); } TextRange range = editor.getUserData(LAST_PASTED_REGION); if (range != null) { editor.getCaretModel().moveToOffset(range.getStartOffset()); editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset()); } if (DnDManager.getInstance() instanceof DnDManagerImpl manager) { manager.setLastDropHandler(editor.getContentComponent()); } } catch (Exception exception) { LOG.error(exception); } }, EditorBundle.message("paste.command.name"), DND_COMMAND_GROUP, UndoConfirmationPolicy.DEFAULT, editor.getDocument()); return true; }