本文整理汇总了Java中com.intellij.util.EnvironmentUtil.getEnvironmentMap方法的典型用法代码示例。如果您正苦于以下问题:Java EnvironmentUtil.getEnvironmentMap方法的具体用法?Java EnvironmentUtil.getEnvironmentMap怎么用?Java EnvironmentUtil.getEnvironmentMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.EnvironmentUtil
的用法示例。
在下文中一共展示了EnvironmentUtil.getEnvironmentMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GitHandler
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
/**
* A constructor
*
* @param project a project
* @param directory a process directory
* @param command a command to execute (if empty string, the parameter is ignored)
*/
protected GitHandler(@NotNull Project project, @NotNull File directory, @NotNull GitCommand command) {
myProject = project;
myCommand = command;
myAppSettings = GitVcsApplicationSettings.getInstance();
myProjectSettings = GitVcsSettings.getInstance(myProject);
myEnv = new HashMap<String, String>(EnvironmentUtil.getEnvironmentMap());
myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
myWorkingDirectory = directory;
myCommandLine = new GeneralCommandLine();
if (myAppSettings != null) {
myCommandLine.setExePath(myAppSettings.getPathToGit());
}
myCommandLine.setWorkDirectory(myWorkingDirectory);
if (GitVersionSpecialty.CAN_OVERRIDE_GIT_CONFIG_FOR_COMMAND.existsIn(myVcs.getVersion())) {
myCommandLine.addParameters("-c", "core.quotepath=false");
}
myCommandLine.addParameter(command.name());
myStdoutSuppressed = true;
mySilent = myCommand.lockingPolicy() == GitCommand.LockingPolicy.READ;
}
示例2: compute
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
@NotNull
@Override
protected Map<String, String> compute() {
Map<String, String> cvsEnv = new HashMap<String, String>();
Map<String, String> knownToCvs = EnvironmentUtil.getEnvironmentMap();
@SuppressWarnings("SpellCheckingInspection") String[] toCvs = {
"CVSIGNORE", "CVSWRAPPERS", "CVSREAD", "CVSREADONLYFS", "CVSUMASK",
"CVSROOT", "CVSEDITOR", "EDITOR", "VISUAL", "PATH", "HOME", "HOMEPATH", "HOMEDRIVE", "CVS_RSH", "CVS_SERVER",
"CVS_PASSFILE", "CVS_CLIENT_PORT", "CVS_PROXY_PORT", "CVS_RCMD_PORT", "CVS_CLIENT_LOG",
"CVS_SERVER_SLEEP", "CVS_IGNORE_REMOTE_ROOT", "CVS_LOCAL_BRANCH_NUM", "COMSPEC", "TMPDIR",
"CVS_PID", "COMSPEC", "CVS_VERIFY_TEMPLATE", "CVS_NOBASES", "CVS_SIGN_COMMITS", "CVS_VERIFY_CHECKOUTS"
};
for (String name : toCvs) {
String value = knownToCvs.get(name);
if (value != null) {
cvsEnv.put(name, value);
}
}
return cvsEnv;
}
示例3: getParentEnvironment
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
/**
* Returns an environment that will be passed to a child process.
*/
@NotNull
public Map<String, String> getParentEnvironment() {
switch (myParentEnvironmentType) {
case SYSTEM:
return System.getenv();
case CONSOLE:
return EnvironmentUtil.getEnvironmentMap();
default:
return Collections.emptyMap();
}
}
示例4: getParentEnvironment
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
/**
* Returns an environment that will be inherited by a child process.
* @see #getEffectiveEnvironment()
*/
@Nonnull
public Map<String, String> getParentEnvironment() {
switch (myParentEnvironmentType) {
case SYSTEM:
return System.getenv();
case CONSOLE:
return EnvironmentUtil.getEnvironmentMap();
default:
return Collections.emptyMap();
}
}
示例5: actionPerformed
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
Options options = OptionsManager.getInstance().getOptions();
String executablePath = options.getExternalEditorOptions().getExecutablePath();
if (StringUtil.isEmpty(executablePath)) {
Messages.showErrorDialog(project,
ImagesBundle.message("error.empty.external.editor.path"),
ImagesBundle.message("error.title.empty.external.editor.path"));
OptionsConfigurabe.show(project);
}
else {
if (files != null) {
Map<String, String> env = EnvironmentUtil.getEnvironmentMap();
for (String varName : env.keySet()) {
if (SystemInfo.isWindows) {
executablePath = StringUtil.replace(executablePath, "%" + varName + "%", env.get(varName), true);
}
else {
executablePath = StringUtil.replace(executablePath, "${" + varName + "}", env.get(varName), false);
}
}
executablePath = FileUtil.toSystemDependentName(executablePath);
File executable = new File(executablePath);
GeneralCommandLine commandLine = new GeneralCommandLine();
final String path = executable.exists() ? executable.getAbsolutePath() : executablePath;
if (SystemInfo.isMac) {
commandLine.setExePath(ExecUtil.getOpenCommandPath());
commandLine.addParameter("-a");
commandLine.addParameter(path);
} else {
commandLine.setExePath(path);
}
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
if (file.isInLocalFileSystem() && typeManager.isImage(file)) {
commandLine.addParameter(VfsUtilCore.virtualToIoFile(file).getAbsolutePath());
}
}
commandLine.setWorkDirectory(new File(executablePath).getParentFile());
try {
commandLine.createProcess();
}
catch (ExecutionException ex) {
Messages.showErrorDialog(project, ex.getLocalizedMessage(), ImagesBundle.message("error.title.launching.external.editor"));
OptionsConfigurabe.show(project);
}
}
}
}
示例6: actionPerformed
import com.intellij.util.EnvironmentUtil; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
Options options = OptionsManager.getInstance().getOptions();
String executablePath = options.getExternalEditorOptions().getExecutablePath();
if (StringUtil.isEmpty(executablePath)) {
Messages.showErrorDialog(project,
ImagesBundle.message("error.empty.external.editor.path"),
ImagesBundle.message("error.title.empty.external.editor.path"));
OptionsConfigurabe.show(project);
}
else {
if (files != null) {
Map<String, String> env = EnvironmentUtil.getEnvironmentMap();
for (String varName : env.keySet()) {
if (SystemInfo.isWindows) {
executablePath = StringUtil.replace(executablePath, "%" + varName + "%", env.get(varName), true);
}
else {
executablePath = StringUtil.replace(executablePath, "${" + varName + "}", env.get(varName), false);
}
}
executablePath = FileUtil.toSystemDependentName(executablePath);
File executable = new File(executablePath);
GeneralCommandLine commandLine = new GeneralCommandLine();
final String path = executable.exists() ? executable.getAbsolutePath() : executablePath;
if (SystemInfo.isMac) {
commandLine.setExePath(ExecUtil.getOpenCommandPath());
commandLine.addParameter("-a");
commandLine.addParameter(path);
} else {
commandLine.setExePath(path);
}
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
if (file.isInLocalFileSystem() && typeManager.isImage(file)) {
commandLine.addParameter(VfsUtilCore.virtualToIoFile(file).getAbsolutePath());
}
}
commandLine.setWorkDirectory(new File(executablePath).getParentFile());
try {
commandLine.createProcess();
}
catch (ExecutionException ex) {
Messages.showErrorDialog(project, ex.getLocalizedMessage(), ImagesBundle.message("error.title.launching.external.editor"));
OptionsConfigurabe.show(project);
}
}
}
}