svn: Refactor "SvnConfiguration" - rename methods

This commit is contained in:
Konstantin Kolosovsky
2018-11-21 16:56:50 +03:00
parent fb6485a3cd
commit 9d6daaa79a
6 changed files with 22 additions and 38 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
@@ -64,11 +64,11 @@ public class GeneralSettingsPanel implements ConfigurableUi<SvnConfiguration> {
@Override
public void reset(@NotNull SvnConfiguration configuration) {
String path = configuration.getConfigurationDirectory();
if (configuration.isUseDefaultConfiguation() || path == null) {
if (configuration.isUseDefaultConfiguration() || path == null) {
path = USER_CONFIGURATION_PATH.getValue().toString();
}
myConfigurationDirectoryText.setText(path);
myUseCustomConfigurationDirectory.setSelected(!configuration.isUseDefaultConfiguation());
myUseCustomConfigurationDirectory.setSelected(!configuration.isUseDefaultConfiguration());
boolean enabled = myUseCustomConfigurationDirectory.isSelected();
myConfigurationDirectoryText.setEnabled(enabled);
@@ -81,7 +81,7 @@ public class GeneralSettingsPanel implements ConfigurableUi<SvnConfiguration> {
@Override
public boolean isModified(@NotNull SvnConfiguration configuration) {
if (configuration.isUseDefaultConfiguation() == myUseCustomConfigurationDirectory.isSelected()) {
if (configuration.isUseDefaultConfiguration() == myUseCustomConfigurationDirectory.isSelected()) {
return true;
}
if (configuration.isRunUnderTerminal() != myRunUnderTerminal.isSelected()) return true;
@@ -67,7 +67,7 @@ public class NetworkSettingsPanel implements ConfigurableUi<SvnConfiguration> {
@Override
public void reset(@NotNull SvnConfiguration configuration) {
myUseCommonProxy.setSelected(configuration.isIsUseDefaultProxy());
myUseCommonProxy.setSelected(configuration.isUseDefaultProxy());
mySSHConnectionTimeout.setValue(Long.valueOf(configuration.getSshConnectionTimeout() / 1000));
mySSHReadTimeout.setValue(Long.valueOf(configuration.getSshReadTimeout() / 1000));
myHttpTimeout.setValue(Long.valueOf(configuration.getHttpTimeout() / 1000));
@@ -85,7 +85,7 @@ public class NetworkSettingsPanel implements ConfigurableUi<SvnConfiguration> {
@Override
public boolean isModified(@NotNull SvnConfiguration configuration) {
if (configuration.isIsUseDefaultProxy() != myUseCommonProxy.isSelected()) {
if (configuration.isUseDefaultProxy() != myUseCommonProxy.isSelected()) {
return true;
}
if (configuration.getSshConnectionTimeout() / 1000 != ((SpinnerNumberModel)mySSHConnectionTimeout.getModel()).getNumber().longValue()) {
@@ -103,7 +103,7 @@ public class NetworkSettingsPanel implements ConfigurableUi<SvnConfiguration> {
@Override
public void apply(@NotNull SvnConfiguration configuration) {
configuration.setIsUseDefaultProxy(myUseCommonProxy.isSelected());
configuration.setUseDefaultProxy(myUseCommonProxy.isSelected());
configuration.setSshConnectionTimeout(((SpinnerNumberModel)mySSHConnectionTimeout.getModel()).getNumber().longValue() * 1000);
configuration.setSshReadTimeout(((SpinnerNumberModel)mySSHReadTimeout.getModel()).getNumber().longValue() * 1000);
configuration.setHttpTimeout(((SpinnerNumberModel)myHttpTimeout.getModel()).getNumber().longValue() * 1000);
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn;
import com.intellij.openapi.components.*;
@@ -278,7 +276,7 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
}
public String getConfigurationDirectory() {
if (myState.directory.path == null || isUseDefaultConfiguation()) {
if (myState.directory.path == null || isUseDefaultConfiguration()) {
myState.directory.path = USER_CONFIGURATION_PATH.getValue().toString();
}
return myState.directory.path;
@@ -289,22 +287,22 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
return Paths.get(getConfigurationDirectory());
}
public boolean isUseDefaultConfiguation() {
public boolean isUseDefaultConfiguration() {
return myState.directory.useDefault;
}
public void setConfigurationDirParameters(final boolean newUseDefault, final String newConfigurationDirectory) {
final String defaultPath = USER_CONFIGURATION_PATH.getValue().toString();
final String oldEffectivePath = isUseDefaultConfiguation() ? defaultPath : getConfigurationDirectory();
final String oldEffectivePath = isUseDefaultConfiguration() ? defaultPath : getConfigurationDirectory();
final String newEffectivePath = newUseDefault ? defaultPath : newConfigurationDirectory;
boolean directoryChanged = !Comparing.equal(getConfigurationDirectory(), newConfigurationDirectory);
if (directoryChanged) {
myState.directory.path = newConfigurationDirectory;
}
boolean usageChanged = isUseDefaultConfiguation() != newUseDefault;
boolean usageChanged = isUseDefaultConfiguration() != newUseDefault;
if (usageChanged) {
setUseDefaultConfiguation(newUseDefault);
setUseDefaultConfiguration(newUseDefault);
}
if (directoryChanged || usageChanged) {
@@ -322,7 +320,7 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
RUNTIME_AUTH_CACHE.clear();
}
private void setUseDefaultConfiguation(boolean useDefault) {
private void setUseDefaultConfiguration(boolean useDefault) {
myState.directory.useDefault = useDefault;
}
@@ -386,11 +384,11 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
myState.keepLocks = keepLocks;
}
public boolean isIsUseDefaultProxy() {
public boolean isUseDefaultProxy() {
return myState.useDefaultProxy;
}
public void setIsUseDefaultProxy(final boolean isUseDefaultProxy) {
public void setUseDefaultProxy(final boolean isUseDefaultProxy) {
myState.useDefaultProxy = isUseDefaultProxy;
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn;
import com.intellij.ide.ui.OptionsTopHitProvider;
@@ -49,7 +35,7 @@ public final class SvnOptionsTopHitProvider extends OptionsTopHitProvider {
option(config, "Subversion: Check svn:mergeinfo in target subtree when preparing for merge", "isCheckNestedForQuickMerge", "setCheckNestedForQuickMerge"),
option(config, "Subversion: Show merge source in history and annotations", "isShowMergeSourcesInAnnotate", "setShowMergeSourcesInAnnotate"),
option(config, "Subversion: Ignore whitespace differences in annotations", "isIgnoreSpacesInAnnotate", "setIgnoreSpacesInAnnotate"),
option(config, "Subversion: Use IDEA general proxy settings as default for Subversion", "isIsUseDefaultProxy", "setIsUseDefaultProxy")));
option(config, "Subversion: Use IDEA general proxy settings as default for Subversion", "isUseDefaultProxy", "setUseDefaultProxy")));
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn.auth;
import com.intellij.openapi.application.ModalityState;
@@ -263,7 +263,7 @@ public class AuthenticationService {
// TODO: rename
public boolean haveDataForTmpConfig() {
final HttpConfigurable instance = HttpConfigurable.getInstance();
return myConfiguration.isIsUseDefaultProxy() && (instance.USE_HTTP_PROXY || instance.USE_PROXY_PAC);
return myConfiguration.isUseDefaultProxy() && (instance.USE_HTTP_PROXY || instance.USE_PROXY_PAC);
}
@Nullable
@@ -222,7 +222,7 @@ class SvnAuthenticationNotifier(private val myVcs: SvnVcs) : GenericNotifierImpl
interactive: Boolean): Boolean {
// we should also NOT show proxy credentials dialog if at least fixed proxy was used, so
var proxyToRelease: Proxy? = null
if (!interactive && configuration.isIsUseDefaultProxy) {
if (!interactive && configuration.isUseDefaultProxy) {
val instance = HttpConfigurable.getInstance()
if (instance.USE_HTTP_PROXY && instance.PROXY_AUTHENTICATION && (isEmptyOrSpaces(instance.proxyLogin) || isEmptyOrSpaces(
instance.plainProxyPassword))) {
@@ -269,7 +269,7 @@ class SvnAuthenticationNotifier(private val myVcs: SvnVcs) : GenericNotifierImpl
return false
}
finally {
if (!interactive && configuration.isIsUseDefaultProxy && proxyToRelease != null) {
if (!interactive && configuration.isUseDefaultProxy && proxyToRelease != null) {
val address = proxyToRelease.address() as InetSocketAddress
CommonProxy.getInstance().noAuthentication("http", address.hostName, address.port)
}