Search in sources :

Example 86 with Nullable

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;
}
Also used : CommonProxy(com.intellij.util.proxy.CommonProxy) Nullable(org.jetbrains.annotations.Nullable)

Example 87 with Nullable

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;
}
Also used : SVNAuthentication(org.tmatesoft.svn.core.auth.SVNAuthentication) Nullable(org.jetbrains.annotations.Nullable)

Example 88 with Nullable

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();
    });
}
Also used : Ref(com.intellij.openapi.util.Ref) SimpleCredentialsDialog(org.jetbrains.idea.svn.dialogs.SimpleCredentialsDialog) Nullable(org.jetbrains.annotations.Nullable)

Example 89 with Nullable

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;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Nullable(org.jetbrains.annotations.Nullable)

Example 90 with Nullable

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;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) RadComponent(com.intellij.designer.model.RadComponent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Nullable (org.jetbrains.annotations.Nullable)4694 VirtualFile (com.intellij.openapi.vfs.VirtualFile)812 PsiElement (com.intellij.psi.PsiElement)485 File (java.io.File)405 Project (com.intellij.openapi.project.Project)396 PsiFile (com.intellij.psi.PsiFile)320 NotNull (org.jetbrains.annotations.NotNull)259 IOException (java.io.IOException)247 Module (com.intellij.openapi.module.Module)227 ArrayList (java.util.ArrayList)178 TextRange (com.intellij.openapi.util.TextRange)156 Document (com.intellij.openapi.editor.Document)124 List (java.util.List)116 ASTNode (com.intellij.lang.ASTNode)105 IElementType (com.intellij.psi.tree.IElementType)103 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)102 XmlTag (com.intellij.psi.xml.XmlTag)96 Editor (com.intellij.openapi.editor.Editor)94 Element (org.jdom.Element)93 XmlFile (com.intellij.psi.xml.XmlFile)78