mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remote Interpreters: add path mappings to python
(cherry picked from commit b0e41df)
This commit is contained in:
+17
-3
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.configuration;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
@@ -31,6 +32,7 @@ import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.CollectionComboBoxModel;
|
||||
@@ -71,6 +73,8 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
private static final String SHOW_ALL = PyBundle.message("active.sdk.dialog.show.all.item");
|
||||
private Set<Sdk> myInitialSdkSet;
|
||||
|
||||
private Disposable myDisposable = null;
|
||||
|
||||
public PyActiveSdkConfigurable(@NotNull Project project) {
|
||||
myModule = null;
|
||||
myProject = project;
|
||||
@@ -149,14 +153,21 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(myDetailsButton, c);
|
||||
|
||||
final PyCustomSdkUiProvider customUiProvider = PyCustomSdkUiProvider.getInstance();
|
||||
if (customUiProvider != null) {
|
||||
myDisposable = Disposer.newDisposable();
|
||||
customUiProvider.customizeActiveSdkPanel(myProject, mySdkCombo, myMainPanel, c, myDisposable);
|
||||
}
|
||||
|
||||
c.insets = new Insets(2,2,0,2);
|
||||
c.gridx = 0;
|
||||
c.gridy = 1;
|
||||
c.gridy++;
|
||||
c.gridwidth = 3;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(emptyLabel, c);
|
||||
|
||||
c.gridx = 0;
|
||||
c.gridy = 2;
|
||||
c.gridy++;
|
||||
c.weighty = 1.;
|
||||
c.gridwidth = 3;
|
||||
c.gridheight = GridBagConstraints.RELATIVE;
|
||||
@@ -165,7 +176,7 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
|
||||
c.gridheight = GridBagConstraints.REMAINDER;
|
||||
c.gridx = 0;
|
||||
c.gridy = 3;
|
||||
c.gridy++;
|
||||
c.gridwidth = 3;
|
||||
c.weighty = 0.;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
@@ -374,6 +385,9 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
public void disposeUIResources() {
|
||||
myProjectSdksModel.removeListener(mySdkModelListener);
|
||||
myInterpreterList.disposeModel();
|
||||
if (myDisposable != null) {
|
||||
Disposer.dispose(myDisposable);
|
||||
}
|
||||
}
|
||||
|
||||
private class MySdkModelListener implements SdkModel.Listener {
|
||||
|
||||
@@ -611,6 +611,7 @@
|
||||
<extensionPoint qualifiedName="Pythonid.consoleOptionsProvider" interface="com.jetbrains.python.console.PyConsoleOptionsProvider"/>
|
||||
<extensionPoint qualifiedName="Pythonid.testLocator" interface="com.jetbrains.python.testing.PythonTestLocator"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyRootTypeProvider" interface="com.jetbrains.python.module.PyRootTypeProvider"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyCustomSdkUiProvider" interface="com.jetbrains.python.sdk.PyCustomSdkUiProvider"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="Pythonid">
|
||||
|
||||
@@ -890,6 +890,8 @@ sdk.gen.stubs.for.binary.modules=Generate stubs for binary module {0}
|
||||
# Active SDK configurable and related dialogs
|
||||
active.sdk.dialog.show.all.item=Show All
|
||||
active.sdk.dialog.project.interpreter=Project Interpreter:
|
||||
active.sdk.dialog.project.interpreter.path.mappings=Path mappings:
|
||||
active.sdk.dialog.project.interpreter.path.mappings.default.project.error=Open or create project to configure mappings
|
||||
|
||||
sdk.details.step.add.local=Add Local
|
||||
sdk.details.step.add.remote=Add Remote
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.jetbrains.python.sdk;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class PyCustomSdkUiProvider {
|
||||
public final static ExtensionPointName<PyCustomSdkUiProvider> EP_NAME =
|
||||
ExtensionPointName.create("Pythonid.pyCustomSdkUiProvider");
|
||||
|
||||
@Nullable
|
||||
public static PyCustomSdkUiProvider getInstance() {
|
||||
if (EP_NAME.getExtensions().length > 0) {
|
||||
return EP_NAME.getExtensions()[0];
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void customizeActiveSdkPanel(@NotNull Project project, @NotNull ComboBox mySdkCombo, @NotNull JPanel myMainPanel,
|
||||
@NotNull GridBagConstraints c, @NotNull Disposable disposable);
|
||||
}
|
||||
Reference in New Issue
Block a user