use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class AuthenticationService method getIdeaDefinedProxy.
@Nullable
public static Proxy getIdeaDefinedProxy(@NotNull final SVNURL url) {
// SVNKit authentication implementation sets repositories as noProxy() to provide custom proxy authentication logic - see for instance,
// SvnAuthenticationManager.getProxyManager(). But noProxy() setting is not cleared correctly in all cases - so if svn command
// (for command line) is executed on thread where repository url was added as noProxy() => proxies are not retrieved for such commands
// and execution logic is incorrect.
// To prevent such behavior repositoryUrl is manually removed from noProxy() list (for current thread).
// NOTE, that current method is only called from code flows for executing commands through command line client and should not be called
// from SVNKit code flows.
CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort());
final List<Proxy> proxies = CommonProxy.getInstance().select(URI.create(url.toString()));
if (proxies != null && !proxies.isEmpty()) {
for (Proxy proxy : proxies) {
if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
return proxy;
}
}
}
return null;
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class AuthenticationService method requestCredentials.
@Nullable
public SVNAuthentication requestCredentials(final SVNURL repositoryUrl, final String type) {
SVNAuthentication authentication = null;
if (repositoryUrl != null) {
final String realm = repositoryUrl.toDecodedString();
authentication = requestCredentials(realm, type, () -> myConfiguration.getInteractiveManager(myVcs).getInnerProvider().requestClientAuthentication(type, repositoryUrl, realm, null, null, true));
}
if (authentication == null) {
LOG.warn("Could not get authentication. Type - " + type + ", Url - " + repositoryUrl);
}
return authentication;
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class AuthenticationService method requestSshCredentials.
@Nullable
public String requestSshCredentials(@NotNull final String realm, @NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) {
return requestCredentials(realm, StringUtil.toLowerCase(mode.toString()), () -> {
final Ref<String> answer = new Ref<>();
Runnable command = () -> {
SimpleCredentialsDialog dialog = new SimpleCredentialsDialog(myVcs.getProject());
dialog.setup(mode, realm, key, true);
dialog.setTitle(SvnBundle.message("dialog.title.authentication.required"));
dialog.setSaveEnabled(false);
if (dialog.showAndGet()) {
answer.set(dialog.getPassword());
}
};
// Use ModalityState.any() as currently ssh credentials in terminal mode are requested in the thread that reads output and not in
// the thread that started progress
WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command, ModalityState.any());
return answer.get();
});
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class DefaultBranchConfigInitializer method getDefaultConfiguration.
@Nullable
public SvnBranchConfigurationNew getDefaultConfiguration() {
SvnBranchConfigurationNew result = null;
SvnVcs vcs = SvnVcs.getInstance(myProject);
SVNURL rootUrl = SvnUtil.getUrl(vcs, VfsUtilCore.virtualToIoFile(myRoot));
if (rootUrl != null) {
try {
result = getDefaultConfiguration(vcs, rootUrl);
} catch (SVNException | VcsException e) {
LOG.info(e);
}
} else {
LOG.info("Directory is not a working copy: " + myRoot.getPresentableUrl());
}
return result;
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class ComponentTree method extractComponent.
@Nullable
public RadComponent extractComponent(Object value) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object userObject = node.getUserObject();
if (myDesigner != null && userObject instanceof TreeNodeDescriptor) {
TreeNodeDescriptor descriptor = (TreeNodeDescriptor) userObject;
Object element = descriptor.getElement();
if (element instanceof RadComponent) {
return (RadComponent) element;
}
}
return null;
}
Aggregations