use of com.intellij.ide.cloudConfig.CloudConfigProvider in project intellij-community by JetBrains.
the class ConfigImportHelper method importConfigsTo.
public static void importConfigsTo(@NotNull String newConfigPath) {
System.setProperty(FIRST_SESSION_KEY, Boolean.TRUE.toString());
ConfigImportSettings settings = getConfigImportSettings();
File newConfigDir = new File(newConfigPath);
File oldConfigDir = findOldConfigDir(newConfigDir, settings.getCustomPathsSelector());
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable ignore) {
}
while (true) {
ImportOldConfigsPanel dialog = new ImportOldConfigsPanel(oldConfigDir, settings);
dialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
AppUIUtil.updateWindowIcon(dialog);
dialog.setVisible(true);
if (!dialog.isImportEnabled()) {
break;
}
File installationHome = dialog.getSelectedFile();
oldConfigDir = getOldConfigDir(installationHome, settings);
if (!validateOldConfigDir(installationHome, oldConfigDir, settings)) {
continue;
}
assert oldConfigDir != null;
doImport(newConfigDir, oldConfigDir, settings, installationHome);
settings.importFinished(newConfigPath);
System.setProperty(CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY, Boolean.TRUE.toString());
CloudConfigProvider provider = CloudConfigProvider.getProvider();
if (provider != null) {
provider.importFinished(newConfigDir);
}
break;
}
}
use of com.intellij.ide.cloudConfig.CloudConfigProvider in project intellij-community by JetBrains.
the class ImportOldConfigsPanel method init.
private void init() {
MnemonicHelper.init(getContentPane());
ButtonGroup group = new ButtonGroup();
group.add(myRbDoNotImport);
group.add(myRbImport);
group.add(myRbImportAuto);
myRbDoNotImport.setSelected(true);
String productName = mySettings.getProductName(ThreeState.UNSURE);
mySuggestLabel.setText(mySettings.getTitleLabel(productName));
myRbDoNotImport.setText(mySettings.getDoNotImportLabel(productName));
if (myGuessedOldConfig != null) {
myRbImportAuto.setText(mySettings.getAutoImportLabel(myGuessedOldConfig));
myRbImportAuto.setSelected(true);
} else {
myRbImportAuto.setVisible(false);
}
myRbImport.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
update();
}
});
if (myGuessedOldConfig != null) {
myPrevInstallation.setText(myGuessedOldConfig.getParent());
} else if (SystemInfo.isMac) {
myPrevInstallation.setText(findPreviousInstallationMac(productName));
} else if (SystemInfo.isWindows) {
String prevInstall = findPreviousInstallationWindows(productName);
if (prevInstall != null) {
myPrevInstallation.setText(prevInstall);
}
}
myPrevInstallation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = myLastSelection != null ? new JFileChooser(myLastSelection) : new JFileChooser();
fc.setFileSelectionMode(SystemInfo.isMac ? JFileChooser.FILES_AND_DIRECTORIES : JFileChooser.DIRECTORIES_ONLY);
fc.setFileHidingEnabled(!SystemInfo.isLinux);
int returnVal = fc.showOpenDialog(ImportOldConfigsPanel.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
if (file != null) {
myLastSelection = file;
myPrevInstallation.setText(file.getAbsolutePath());
}
}
}
});
myOkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
close();
}
});
CloudConfigProvider configProvider = CloudConfigProvider.getProvider();
if (configProvider != null) {
configProvider.initConfigsPanel(group, myCustomButton);
}
getContentPane().setLayout(new BorderLayout());
getContentPane().add(myRootPanel);
getRootPane().setDefaultButton(myOkButton);
setTitle(ApplicationBundle.message("title.complete.installation"));
update();
pack();
setLocationRelativeTo(null);
}
use of com.intellij.ide.cloudConfig.CloudConfigProvider in project intellij-community by JetBrains.
the class StartupUtil method runStartupWizard.
static void runStartupWizard() {
ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
String stepsProviderName = appInfo.getCustomizeIDEWizardStepsProvider();
if (stepsProviderName != null) {
CustomizeIDEWizardStepsProvider provider;
try {
Class<?> providerClass = Class.forName(stepsProviderName);
provider = (CustomizeIDEWizardStepsProvider) providerClass.newInstance();
} catch (Throwable e) {
Main.showMessage("Configuration Wizard Failed", e);
return;
}
CloudConfigProvider configProvider = CloudConfigProvider.getProvider();
if (configProvider != null) {
configProvider.beforeStartupWizard();
}
new CustomizeIDEWizardDialog(provider).show();
PluginManagerCore.invalidatePlugins();
if (configProvider != null) {
configProvider.startupWizardFinished();
}
return;
}
List<ApplicationInfoEx.PluginChooserPage> pages = appInfo.getPluginChooserPages();
if (!pages.isEmpty()) {
new StartupWizard(pages).show();
PluginManagerCore.invalidatePlugins();
}
}
use of com.intellij.ide.cloudConfig.CloudConfigProvider in project intellij-community by JetBrains.
the class PluginGroups method initCloudPlugins.
private void initCloudPlugins() {
CloudConfigProvider provider = CloudConfigProvider.getProvider();
if (provider == null) {
return;
}
List<String> plugins = provider.getInstalledPlugins();
if (plugins.isEmpty()) {
return;
}
for (Iterator<Entry<String, String>> I = myFeaturedPlugins.entrySet().iterator(); I.hasNext(); ) {
String value = I.next().getValue();
if (ContainerUtil.find(plugins, plugin -> value.endsWith(":" + plugin)) != null) {
I.remove();
}
}
for (String plugin : plugins) {
myFeaturedPlugins.put(plugin, "#Cloud:#Cloud:" + plugin);
}
}
Aggregations