void (@NotNull DropContext dropContext, boolean externalDrop) { @Nullable PsiElement target = dropContext.targetElement(); PsiElement @Nullable [] sources = getPsiElements(dropContext); if (target == null || sources == null) return; if (!myProject.isInitialized()) { Messages.showMessageDialog(myProject, LangBundle.message("dialog.message.move.refactoring.available"), LangBundle.message("dialog.title.project.initialization"), null); return; } Module module = dropContext.targetModule(); final DataContext dataContext = DataManager.getInstance().getDataContext(myTree); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); if (!target.isValid()) return; for (PsiElement element : sources) { if (!element.isValid()) return; } DataContext context = CustomizedDataContext.create(externalDrop ? DataContext.EMPTY_CONTEXT : dataContext, dataId -> { if (LangDataKeys.TARGET_MODULE.is(dataId)) return module; if (LangDataKeys.TARGET_PSI_ELEMENT.is(dataId)) return target; else return null; }); getActionHandler().invoke(myProject, sources, context); }