void () { MnemonicHelper.init(getContentPane()); ButtonGroup group = new ButtonGroup(); group.add(myRbImportAuto); group.add(myRbImport); group.add(myRbDoNotImport); myRbDoNotImport.setSelected(true); if (myGuessedOldConfigDirs.isEmpty()) { myRbImportAuto.setVisible(false); myComboBoxOldPaths.setVisible(false); } else { myComboBoxOldPaths.setModel(new CollectionComboBoxModel<>(myGuessedOldConfigDirs)); myComboBoxOldPaths.setSelectedItem(myGuessedOldConfigDirs.get(0)); myRbImportAuto.setSelected(true); } for (Enumeration<AbstractButton> e = group.getElements(); e.hasMoreElements(); ) { e.nextElement().addChangeListener(event -> update()); } if (SystemInfo.isMac) { myLastSelection = Paths.get("/Applications"); } else if (SystemInfo.isWindows) { String programFiles = System.getenv("ProgramFiles"); if (programFiles != null) { Path candidate = Paths.get(programFiles, "JetBrains"); myLastSelection = Files.isDirectory(candidate) ? candidate : Paths.get(programFiles); } } myPrevInstallation.setTextFieldPreferredWidth(50); myPrevInstallation.addActionListener(e -> { FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); chooserDescriptor.setHideIgnored(false); chooserDescriptor.withFileFilter(file -> file.isDirectory() || ConfigImportHelper.isSettingsFile(file)); Ref<File> fileRef = Ref.create(); PathChooserDialog chooser = FileChooserFactoryImpl.createNativePathChooserIfEnabled(chooserDescriptor, null, myRootPanel); if (chooser != null) { VirtualFile vf = myLastSelection != null ? new CoreLocalVirtualFile(new CoreLocalFileSystem(), myLastSelection) : null; chooser.choose(vf, files -> fileRef.set(new File(files.get(0).getPresentableUrl()))); } else { JFileChooser fc = new JFileChooser(myLastSelection != null ? myLastSelection.getParent().toFile() : null); fc.setSelectedFile(myLastSelection != null ? myLastSelection.toFile() : null); fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fc.setFileHidingEnabled(SystemInfo.isWindows || SystemInfo.isMac); fc.setFileFilter(new FileNameExtensionFilter("settings file", "zip", "jar")); @SuppressWarnings("DuplicatedCode") int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); if (file != null) { fileRef.set(file); myPrevInstallation.setText(file.getAbsolutePath()); } } } if (!fileRef.isNull()) { myLastSelection = fileRef.get().toPath(); myPrevInstallation.setText(fileRef.get().getAbsolutePath()); } }); myOkButton.addActionListener(e -> close()); CloudConfigProvider configProvider = CloudConfigProvider.getProvider(); if (configProvider != null) { configProvider.initConfigsPanel(group, myCustomButton); } getContentPane().setLayout(new BorderLayout()); getContentPane().add(myRootPanel); getRootPane().setDefaultButton(myOkButton); update(); pack(); setLocationRelativeTo(null); setMinimumSize(getSize()); }