Search in sources :

Example 6 with PyRemoteSdkAdditionalDataBase

use of com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase in project intellij-community by JetBrains.

the class PyRemotePackageManagerImpl method getHelperPath.

@Nullable
@Override
protected String getHelperPath(String helper) throws ExecutionException {
    final Sdk sdk = getSdk();
    final SdkAdditionalData sdkData = sdk.getSdkAdditionalData();
    if (sdkData instanceof PyRemoteSdkAdditionalDataBase) {
        final PyRemoteSdkAdditionalDataBase remoteSdkData = (PyRemoteSdkAdditionalDataBase) sdkData;
        try {
            String helpersPath;
            if (CaseCollector.useRemoteCredentials(remoteSdkData)) {
                final RemoteSdkCredentials remoteSdkCredentials = remoteSdkData.getRemoteSdkCredentials(false);
                helpersPath = remoteSdkCredentials.getHelpersPath();
            } else {
                helpersPath = remoteSdkData.getHelpersPath();
            }
            if (!StringUtil.isEmpty(helpersPath)) {
                return new RemoteFile(helpersPath, helper).getPath();
            } else {
                return null;
            }
        } catch (InterruptedException e) {
            LOG.error(e);
        } catch (ExecutionException e) {
            throw analyzeException(e, helper, Collections.<String>emptyList());
        }
    }
    return null;
}
Also used : PyRemoteSdkAdditionalDataBase(com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase) Sdk(com.intellij.openapi.projectRoots.Sdk) ExecutionException(com.intellij.execution.ExecutionException) RemoteFile(com.intellij.remote.RemoteFile) RemoteSdkAdditionalData(com.intellij.remote.RemoteSdkAdditionalData) SdkAdditionalData(com.intellij.openapi.projectRoots.SdkAdditionalData) RemoteSdkCredentials(com.intellij.remote.RemoteSdkCredentials) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with PyRemoteSdkAdditionalDataBase

use of com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase in project intellij-community by JetBrains.

the class PyRemoteProcessStarter method doStartRemoteProcess.

protected PyRemoteProcessHandlerBase doStartRemoteProcess(@NotNull Sdk sdk, @NotNull final GeneralCommandLine commandLine, @NotNull final PythonRemoteInterpreterManager manager, @Nullable final Project project, @Nullable PyRemotePathMapper pathMapper) throws ExecutionException {
    SdkAdditionalData data = sdk.getSdkAdditionalData();
    assert data instanceof PyRemoteSdkAdditionalDataBase;
    final PyRemoteSdkAdditionalDataBase pyRemoteSdkAdditionalDataBase = (PyRemoteSdkAdditionalDataBase) data;
    final PyRemotePathMapper extendedPathMapper = manager.setupMappings(project, pyRemoteSdkAdditionalDataBase, pathMapper);
    try {
        return PyRemoteProcessStarterManagerUtil.getManager(pyRemoteSdkAdditionalDataBase).startRemoteProcess(project, commandLine, manager, pyRemoteSdkAdditionalDataBase, extendedPathMapper);
    } catch (InterruptedException e) {
        throw new ExecutionException(e);
    }
}
Also used : PyRemotePathMapper(com.jetbrains.python.remote.PyRemotePathMapper) PyRemoteSdkAdditionalDataBase(com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase) ExecutionException(com.intellij.execution.ExecutionException) SdkAdditionalData(com.intellij.openapi.projectRoots.SdkAdditionalData)

Example 8 with PyRemoteSdkAdditionalDataBase

use of com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase in project intellij-community by JetBrains.

the class PydevConsoleRunnerImpl method createProcessHandler.

private PyConsoleProcessHandler createProcessHandler(final Process process) {
    if (PySdkUtil.isRemote(mySdk)) {
        PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
        if (manager != null) {
            PyRemoteSdkAdditionalDataBase data = (PyRemoteSdkAdditionalDataBase) mySdk.getSdkAdditionalData();
            assert data != null;
            myProcessHandler = manager.createConsoleProcessHandler((RemoteProcess) process, myConsoleView, myPydevConsoleCommunication, myCommandLine, CharsetToolkit.UTF8_CHARSET, manager.setupMappings(myProject, data, null), myRemoteProcessHandlerBase.getRemoteSocketToLocalHostProvider());
        } else {
            LOG.error("Can't create remote console process handler");
        }
    } else {
        myProcessHandler = new PyConsoleProcessHandler(process, myConsoleView, myPydevConsoleCommunication, myCommandLine, CharsetToolkit.UTF8_CHARSET);
    }
    return myProcessHandler;
}
Also used : PyRemoteSdkAdditionalDataBase(com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase) RemoteProcess(com.intellij.remote.RemoteProcess) PythonRemoteInterpreterManager(com.jetbrains.python.remote.PythonRemoteInterpreterManager)

Aggregations

PyRemoteSdkAdditionalDataBase (com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase)8 ExecutionException (com.intellij.execution.ExecutionException)5 SdkAdditionalData (com.intellij.openapi.projectRoots.SdkAdditionalData)4 Nullable (org.jetbrains.annotations.Nullable)4 PyRemotePathMapper (com.jetbrains.python.remote.PyRemotePathMapper)3 PythonRemoteInterpreterManager (com.jetbrains.python.remote.PythonRemoteInterpreterManager)3 Sdk (com.intellij.openapi.projectRoots.Sdk)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 RemoteProcess (com.intellij.remote.RemoteProcess)2 RemoteSdkAdditionalData (com.intellij.remote.RemoteSdkAdditionalData)2 RemoteSdkCredentials (com.intellij.remote.RemoteSdkCredentials)2 IOException (java.io.IOException)2 NotNull (org.jetbrains.annotations.NotNull)2 Function (com.google.common.base.Function)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 ProcessOutput (com.intellij.execution.process.ProcessOutput)1 ArchiveFileType (com.intellij.ide.highlighter.ArchiveFileType)1 PsiFile (com.intellij.psi.PsiFile)1 RemoteFile (com.intellij.remote.RemoteFile)1 Tunnelable (com.intellij.remote.Tunnelable)1