mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add possibility to customize terminal environment variables
This commit is contained in:
@@ -18,4 +18,9 @@
|
||||
<implementation-class>org.jetbrains.plugins.terminal.TerminalView</implementation-class>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="org.jetbrains.plugins.terminal.localTerminalCustomizer"
|
||||
interface="org.jetbrains.plugins.terminal.LocalTerminalCustomizer"/>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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 org.jetbrains.plugins.terminal;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public interface LocalTerminalCustomizer {
|
||||
ExtensionPointName<LocalTerminalCustomizer> EP_NAME =
|
||||
ExtensionPointName.create("org.jetbrains.plugins.terminal.localTerminalCustomizer");
|
||||
|
||||
void setupEnvironment(@NotNull Map<String, String> envs);
|
||||
}
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.jediterm.pty.PtyProcessTtyConnector;
|
||||
@@ -94,6 +93,11 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
|
||||
envs.put("TERM", "xterm-256color");
|
||||
}
|
||||
EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myDefaultCharset);
|
||||
|
||||
for (LocalTerminalCustomizer customizer: LocalTerminalCustomizer.EP_NAME.getExtensions()) {
|
||||
customizer.setupEnvironment(envs);
|
||||
}
|
||||
|
||||
try {
|
||||
return PtyProcess.exec(getCommand(), envs, directory != null ? directory : currentProjectFolder());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user