Search in sources :

Example 1 with SingleRemoteServerConfigurable

use of com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable in project intellij-community by JetBrains.

the class CloudAccountSelectionEditor method createAccount.

private void createAccount(ServerType<?> cloudType) {
    RemoteServer<?> newAccount = RemoteServersManager.getInstance().createServer(cloudType, generateServerName(cloudType));
    final Ref<Consumer<String>> errorConsumerRef = new Ref<>();
    SingleRemoteServerConfigurable configurable = new SingleRemoteServerConfigurable(newAccount, null, true) {

        @Override
        protected void setConnectionStatusText(boolean error, String text) {
            super.setConnectionStatusText(error, error ? "" : text);
            errorConsumerRef.get().consume(error ? text : null);
        }
    };
    if (!new SingleConfigurableEditor(myMainPanel, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), false) {

        {
            errorConsumerRef.set(s -> setErrorText(s, myMainPanel));
        }
    }.showAndGet()) {
        return;
    }
    newAccount.setName(configurable.getDisplayName());
    RemoteServersManager.getInstance().addServer(newAccount);
    AccountItem newAccountItem = new AccountItem(newAccount);
    myAccountComboBox.addItem(newAccountItem);
    myAccountComboBox.setSelectedItem(newAccountItem);
}
Also used : Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor) SingleRemoteServerConfigurable(com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable)

Aggregations

SingleConfigurableEditor (com.intellij.openapi.options.ex.SingleConfigurableEditor)1 Ref (com.intellij.openapi.util.Ref)1 SingleRemoteServerConfigurable (com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable)1 Consumer (com.intellij.util.Consumer)1