boolean (@NotNull Transferable t, @Nullable Editor editor, Project project) { VirtualFile file = getColorSchemeFile(t); assert file != null; if (MessageDialogBuilder.yesNo(LangBundle.message("dialog.title.install.color.scheme"), LangBundle.message("message.would.you.like.to.install.and.apply.0.editor.color.scheme", file.getName())) .yesText(LangBundle.message("button.install")) .noText(LangBundle.message("button.open.in.editor")) .ask(project)) { try { ColorSchemeImporter importer = new ColorSchemeImporter(); EditorColorsManager colorsManager = EditorColorsManager.getInstance(); EditorColorsScheme oldScheme = colorsManager.getGlobalScheme(); List<String> names = ContainerUtil.map(colorsManager.getAllSchemes(), EditorColorsScheme::getName); EditorColorsScheme imported = importer .importScheme(DefaultProjectFactory.getInstance().getDefaultProject(), file, colorsManager.getGlobalScheme(), name -> { String preferredName = name != null ? name : "Unnamed"; String newName = SchemeNameGenerator.getUniqueName(preferredName, candidate -> names.contains(candidate)); AbstractColorsScheme newScheme = new EditorColorsSchemeImpl(EmptyColorScheme.INSTANCE); newScheme.setName(newName); newScheme.setDefaultMetaInfo(EmptyColorScheme.INSTANCE); return newScheme; }); if (imported != null) { colorsManager.addColorScheme(imported); String message = importer.getAdditionalImportInfo(imported); if (message == null) { message = ApplicationBundle.message("settings.editor.scheme.import.success", file.getPresentableUrl(), imported.getName()); } colorsManager.setGlobalScheme(imported); Notification notification = new Notification("ColorSchemeDrop", LangBundle.message("notification.title.color.scheme.added"), message, NotificationType.INFORMATION); QuickChangeColorSchemeAction.changeLafIfNecessary(oldScheme, imported, () -> { new Alarm().addRequest( () -> Notifications.Bus.notify(notification, project), 300); }); } } catch (SchemeImportException e) { String title = e.isWarning() ? LangBundle.message("notification.title.color.scheme.added") : LangBundle.message("notification.title.color.scheme.import.failed"); NotificationType type = e.isWarning() ? NotificationType.WARNING : NotificationType.ERROR; Notification notification = new Notification("ColorSchemeDrop", title, e.getMessage(), type); notification.notify(project); } return true; } return false; }