Search in sources :

Example 1 with CloudConfigProvider

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;
    }
}
Also used : CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider)

Example 2 with CloudConfigProvider

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);
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider) ChangeListener(javax.swing.event.ChangeListener) File(java.io.File)

Example 3 with CloudConfigProvider

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();
    }
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) CustomizeIDEWizardStepsProvider(com.intellij.ide.customize.CustomizeIDEWizardStepsProvider) CustomizeIDEWizardDialog(com.intellij.ide.customize.CustomizeIDEWizardDialog) CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider) StartupWizard(com.intellij.ide.startupWizard.StartupWizard)

Example 4 with CloudConfigProvider

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);
    }
}
Also used : WelcomeWizardUtil(com.intellij.ide.WelcomeWizardUtil) java.util(java.util) ArrayUtil(com.intellij.util.ArrayUtil) StringUtil(com.intellij.openapi.util.text.StringUtil) PathManager(com.intellij.openapi.application.PathManager) CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider) PluginManagerCore(com.intellij.ide.plugins.PluginManagerCore) ContainerUtil(com.intellij.util.containers.ContainerUtil) File(java.io.File) ExecutionException(java.util.concurrent.ExecutionException) PlatformImplIcons(icons.PlatformImplIcons) Nullable(org.jetbrains.annotations.Nullable) RepositoryHelper(com.intellij.ide.plugins.RepositoryHelper) Pair(com.intellij.openapi.util.Pair) Entry(java.util.Map.Entry) PluginId(com.intellij.openapi.extensions.PluginId) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) Entry(java.util.Map.Entry) CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider)

Aggregations

CloudConfigProvider (com.intellij.ide.cloudConfig.CloudConfigProvider)4 File (java.io.File)2 WelcomeWizardUtil (com.intellij.ide.WelcomeWizardUtil)1 CustomizeIDEWizardDialog (com.intellij.ide.customize.CustomizeIDEWizardDialog)1 CustomizeIDEWizardStepsProvider (com.intellij.ide.customize.CustomizeIDEWizardStepsProvider)1 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 PluginManagerCore (com.intellij.ide.plugins.PluginManagerCore)1 RepositoryHelper (com.intellij.ide.plugins.RepositoryHelper)1 StartupWizard (com.intellij.ide.startupWizard.StartupWizard)1 PathManager (com.intellij.openapi.application.PathManager)1 ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)1 PluginId (com.intellij.openapi.extensions.PluginId)1 Condition (com.intellij.openapi.util.Condition)1 Pair (com.intellij.openapi.util.Pair)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 ArrayUtil (com.intellij.util.ArrayUtil)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 PlatformImplIcons (icons.PlatformImplIcons)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1