void (Project project, final Editor editor, PsiElement qualifier) { PsiElement resolved = resolveQualifier(qualifier); if (!(resolved instanceof PsiClass)) return; JVMElementFactory factory = JVMElementFactories.getFactory(resolved.getLanguage(), project); if (factory == null) return; String name = myRefElement.getReferenceName(); PsiClass template = createTemplate(factory, name); if (template == null) { ApplicationManager.getApplication().invokeLater(() -> { if (editor != null && editor.getComponent().isDisplayable()) { HintManager.getInstance().showErrorHint(editor, GroovyBundle.message("cannot.create.class")); } }); return; } if (!FileModificationService.getInstance().preparePsiElementForWrite(resolved)) return; WriteAction.run(() -> { PsiClass added = (PsiClass)resolved.add(template); PsiModifierList modifierList = added.getModifierList(); if (modifierList != null) { modifierList.setModifierProperty(PsiModifier.STATIC, true); } IntentionUtils.positionCursor(project, added.getContainingFile(), added); }); }