use of com.intellij.util.PathMappingSettings in project intellij-community by JetBrains.
the class PydevConsoleRunner method getPathMapper.
@Nullable
static PyRemotePathMapper getPathMapper(@NotNull Project project, Sdk sdk, PyConsoleOptions.PyConsoleSettings consoleSettings) {
if (PySdkUtil.isRemote(sdk)) {
PythonRemoteInterpreterManager instance = PythonRemoteInterpreterManager.getInstance();
if (instance != null) {
//noinspection ConstantConditions
PyRemotePathMapper remotePathMapper = instance.setupMappings(project, (PyRemoteSdkAdditionalDataBase) sdk.getSdkAdditionalData(), null);
PathMappingSettings mappingSettings = consoleSettings.getMappingSettings();
remotePathMapper.addAll(mappingSettings.getPathMappings(), PyRemotePathMapper.PyPathMappingType.USER_DEFINED);
return remotePathMapper;
}
}
return null;
}
use of com.intellij.util.PathMappingSettings in project intellij-community by JetBrains.
the class PathMappingsComponent method setMappingSettings.
public void setMappingSettings(@Nullable final PathMappingSettings mappingSettings) {
if (mappingSettings == null) {
myMappingSettings = new PathMappingSettings();
} else {
myMappingSettings = mappingSettings;
}
setTextRepresentation(myMappingSettings);
fireStateChanged();
}
use of com.intellij.util.PathMappingSettings in project intellij-community by JetBrains.
the class PyRemotePathMapperTest method testFromSettings.
@Test
public void testFromSettings() throws Exception {
PathMappingSettings settings = new PathMappingSettings();
PyRemotePathMapper emptyMapper = PyRemotePathMapper.fromSettings(settings, PyPathMappingType.USER_DEFINED);
assertTrue(emptyMapper.isEmpty());
settings.add(new PathMappingSettings.PathMapping("C:\\local\\folder", "/remote/folder"));
settings.add(new PathMappingSettings.PathMapping("C:\\local\\folder\\child", "/remote/child-from-local"));
settings.add(new PathMappingSettings.PathMapping("C:\\local\\child-from-remote", "/remote/folder/child"));
PyRemotePathMapper mapper = PyRemotePathMapper.fromSettings(settings, PyPathMappingType.HELPERS);
assertFalse(mapper.isEmpty());
assertConvertsOneToAnother(mapper, "C:\\local\\folder\\src\\main.py", "/remote/folder/src/main.py");
assertConvertsOneToAnother(mapper, "C:\\local\\folder\\child\\test\\all.py", "/remote/child-from-local/test/all.py");
assertConvertsOneToAnother(mapper, "C:/local/child-from-remote/README", "/remote/folder/child/README");
assertEquals("/unmapped/list.txt", mapper.convertToLocal("/unmapped/list.txt"));
assertEquals("C:\\unmapped\\list.txt", mapper.convertToRemote("C:\\unmapped\\list.txt"));
}
Aggregations