AbstractDialog (boolean headless, Window owner, DialogWrapper wrapper, Project project, DialogWrapper.IdeModalityType ideModalityType) { if (headless) { return new HeadlessDialog(wrapper); } else { MyDialog dialog = new MyDialog(OwnerOptional.fromComponent(owner).get(), wrapper, project); dialog.setModalityType(ideModalityType.toAwtModality()); return dialog; } }