mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Google App Engine: do not check connection to avoid confusing 'connection successful' messages
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.remoteServer;
|
||||
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class RemoteServerConfigurable implements UnnamedConfigurable {
|
||||
/**
|
||||
* When user edits a server configuration IDEA periodically tries to connect to the server to check the configuration and show
|
||||
* the connection status. If it isn't desirable (e.g. if required credentials aren't specified yet) return {@code false} from this method.
|
||||
* @return {@code true} if it makes sense to check connection to the remote server
|
||||
*/
|
||||
public boolean canCheckConnection() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,17 @@ public abstract class ServerType<C extends ServerConfiguration> {
|
||||
public abstract C createDefaultConfiguration();
|
||||
|
||||
@NotNull
|
||||
public abstract UnnamedConfigurable createConfigurable(@NotNull C configuration);
|
||||
public RemoteServerConfigurable createServerConfigurable(@NotNull C configuration) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated override {@link #createServerConfigurable(com.intellij.remoteServer.configuration.ServerConfiguration)} instead
|
||||
*/
|
||||
@NotNull
|
||||
public UnnamedConfigurable createConfigurable(@NotNull C configuration) {
|
||||
return createServerConfigurable(configuration);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract DeploymentConfigurator<?, C> createDeploymentConfigurator(Project project);
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.remoteServer.impl.configuration;
|
||||
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.remoteServer.RemoteServerConfigurable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class DelegatingRemoteServerConfigurable extends RemoteServerConfigurable {
|
||||
private final UnnamedConfigurable myDelegate;
|
||||
|
||||
public DelegatingRemoteServerConfigurable(UnnamedConfigurable delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return myDelegate.createComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return myDelegate.isModified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
myDelegate.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
myDelegate.reset();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -75,7 +75,7 @@ public class RemoteServerListConfigurable extends MasterDetailsComponent impleme
|
||||
}
|
||||
|
||||
private MyNode addServerNode(RemoteServer<?> server, boolean isNew) {
|
||||
MyNode node = new MyNode(new RemoteServerConfigurable(server, TREE_UPDATER, isNew));
|
||||
MyNode node = new MyNode(new SingleRemoteServerConfigurable(server, TREE_UPDATER, isNew));
|
||||
addNode(node, myRoot);
|
||||
return node;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.remoteServer.impl.configuration.RemoteServerConfigurable">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
+16
-9
@@ -1,13 +1,12 @@
|
||||
package com.intellij.remoteServer.impl.configuration;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.remoteServer.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.ServerConfiguration;
|
||||
import com.intellij.remoteServer.runtime.ServerConnection;
|
||||
@@ -31,14 +30,11 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>> {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#" + RemoteServerConfigurable.class.getName());
|
||||
|
||||
public class SingleRemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>> {
|
||||
private static final String HELP_TOPIC_ID = "reference.settings.clouds";
|
||||
|
||||
|
||||
private final UnnamedConfigurable myConfigurable;
|
||||
private final RemoteServerConfigurable myConfigurable;
|
||||
private final RemoteServer<?> myServer;
|
||||
private String myServerName;
|
||||
private boolean myNew;
|
||||
@@ -57,7 +53,7 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
|
||||
|
||||
private CloudDataLoader myDataLoader = CloudDataLoader.NULL;
|
||||
|
||||
public <C extends ServerConfiguration> RemoteServerConfigurable(RemoteServer<C> server, Runnable treeUpdater, boolean isNew) {
|
||||
public <C extends ServerConfiguration> SingleRemoteServerConfigurable(RemoteServer<C> server, Runnable treeUpdater, boolean isNew) {
|
||||
super(true, treeUpdater);
|
||||
myServer = server;
|
||||
myNew = isNew;
|
||||
@@ -68,13 +64,15 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
|
||||
myInnerApplied = false;
|
||||
myUncheckedApply = false;
|
||||
|
||||
myConfigurable = server.getType().createConfigurable(innerConfiguration);
|
||||
myConfigurable = createConfigurable(server, innerConfiguration);
|
||||
|
||||
myConnected = false;
|
||||
myRunner = new DelayedRunner(myMainPanel) {
|
||||
|
||||
@Override
|
||||
protected boolean wasChanged() {
|
||||
if (!myConfigurable.canCheckConnection()) return false;
|
||||
|
||||
boolean modified = myConfigurable.isModified();
|
||||
boolean result = modified || myUncheckedApply;
|
||||
if (result) {
|
||||
@@ -106,6 +104,15 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
|
||||
};
|
||||
}
|
||||
|
||||
private static <C extends ServerConfiguration> RemoteServerConfigurable createConfigurable(RemoteServer<C> server, C configuration) {
|
||||
try {
|
||||
return server.getType().createServerConfigurable(configuration);
|
||||
}
|
||||
catch (UnsupportedOperationException e) {
|
||||
return new DelegatingRemoteServerConfigurable(server.getType().createConfigurable(configuration));
|
||||
}
|
||||
}
|
||||
|
||||
private void setConnectionStatus(boolean error, boolean connected, String text) {
|
||||
boolean changed = myConnected != connected;
|
||||
myConnected = connected;
|
||||
+2
-2
@@ -24,7 +24,7 @@ import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
import com.intellij.remoteServer.configuration.ServerConfiguration;
|
||||
import com.intellij.remoteServer.configuration.deployment.DeploymentConfigurationManager;
|
||||
import com.intellij.remoteServer.impl.configuration.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.impl.runtime.deployment.DeploymentTaskImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.log.DeploymentLogManagerImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl;
|
||||
@@ -227,7 +227,7 @@ public class ServersTreeStructure extends AbstractTreeStructureBase {
|
||||
|
||||
@Override
|
||||
public void editConfiguration() {
|
||||
ShowSettingsUtil.getInstance().editConfigurable(doGetProject(), new RemoteServerConfigurable(getValue(), null, false));
|
||||
ShowSettingsUtil.getInstance().editConfigurable(doGetProject(), new SingleRemoteServerConfigurable(getValue(), null, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
import com.intellij.remoteServer.impl.configuration.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
@@ -118,7 +118,7 @@ public class CloudAccountSelectionEditor {
|
||||
|
||||
final Ref<Consumer<String>> errorConsumerRef = new Ref<Consumer<String>>();
|
||||
|
||||
RemoteServerConfigurable configurable = new RemoteServerConfigurable(newAccount, null, true) {
|
||||
SingleRemoteServerConfigurable configurable = new SingleRemoteServerConfigurable(newAccount, null, true) {
|
||||
|
||||
@Override
|
||||
protected void setConnectionStatusText(boolean error, String text) {
|
||||
|
||||
+2
-6
@@ -2,10 +2,10 @@ package com.intellij.remoteServer.util;
|
||||
|
||||
import com.intellij.execution.configurations.RuntimeConfigurationError;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.remoteServer.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
@@ -17,7 +17,7 @@ import javax.swing.*;
|
||||
/**
|
||||
* @author michael.golubev
|
||||
*/
|
||||
public abstract class CloudConfigurableBase<SC extends CloudConfigurationBase> implements UnnamedConfigurable {
|
||||
public abstract class CloudConfigurableBase<SC extends CloudConfigurationBase> extends RemoteServerConfigurable {
|
||||
|
||||
private final ServerType<SC> myCloudType;
|
||||
protected final SC myConfiguration;
|
||||
@@ -54,10 +54,6 @@ public abstract class CloudConfigurableBase<SC extends CloudConfigurationBase> i
|
||||
getPasswordField().setText(myConfiguration.getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
}
|
||||
|
||||
protected void applyCoreTo(SC configuration) throws ConfigurationException {
|
||||
String email = getEmailTextField().getText();
|
||||
if (StringUtil.isEmpty(email)) {
|
||||
|
||||
+8
-5
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.remoteServer.RemoteServerConfigurable;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.components.JBPasswordField;
|
||||
import com.intellij.ui.components.JBRadioButton;
|
||||
@@ -37,7 +38,7 @@ import java.awt.event.ActionListener;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class AppEngineCloudConfigurable implements Configurable {
|
||||
public class AppEngineCloudConfigurable extends RemoteServerConfigurable implements Configurable {
|
||||
public static final String EMAIL_KEY = "GOOGLE_APP_ENGINE_ACCOUNT_EMAIL";
|
||||
private final AppEngineServerConfiguration myConfiguration;
|
||||
@Nullable private final Project myProject;
|
||||
@@ -79,6 +80,12 @@ public class AppEngineCloudConfigurable implements Configurable {
|
||||
return StringUtil.nullize(myEmailField.getText(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCheckConnection() {
|
||||
//currently our App Engine implementation actually doesn't connect to the cloud so it makes no sense to show connection status in 'Settings'
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
@@ -164,8 +171,4 @@ public class AppEngineCloudConfigurable implements Configurable {
|
||||
|| myRememberPasswordCheckBox.isSelected() != myConfiguration.isPasswordStored()
|
||||
|| myRememberPasswordCheckBox.isSelected() && !getPassword().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -18,9 +18,9 @@ package com.intellij.appengine.cloud;
|
||||
import com.intellij.appengine.actions.AppEngineUploader;
|
||||
import com.intellij.appengine.util.AppEngineUtil;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.remoteServer.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.deployment.*;
|
||||
@@ -65,9 +65,10 @@ public class AppEngineCloudType extends ServerType<AppEngineServerConfiguration>
|
||||
return new AppEngineServerConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public UnnamedConfigurable createConfigurable(@NotNull AppEngineServerConfiguration configuration) {
|
||||
public RemoteServerConfigurable createServerConfigurable(@NotNull AppEngineServerConfiguration configuration) {
|
||||
return new AppEngineCloudConfigurable(configuration, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user