RUBY-22047 Implemented RunAnything patching with version managers

IDEA-CR-34952
This commit is contained in:
Alexandr Evstigneev
2018-07-26 14:04:46 +03:00
parent c1c721f9fe
commit 810e443891
2 changed files with 3 additions and 30 deletions
@@ -4,10 +4,7 @@ package com.intellij.ide.actions.runAnything;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.ide.actions.runAnything.activity.RunAnythingProvider;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.XmlSerializerUtil;
@@ -22,32 +19,7 @@ import java.util.stream.Collectors;
@State(name = "RunAnythingCache", storages = @Storage(StoragePathMacros.WORKSPACE_FILE))
public class RunAnythingCache implements PersistentStateComponent<RunAnythingCache.State> {
private static final Logger LOG = Logger.getInstance(RunAnythingCache.class);
private final State mySettings = new State();
public boolean CAN_RUN_RVM = false;
public boolean CAN_RUN_RBENV = false;
public RunAnythingCache() {
try {
CAN_RUN_RVM = ApplicationManager.getApplication().executeOnPooledThread(() -> canRunRVM()).get();
}
catch (java.util.concurrent.ExecutionException ignored) {
}
catch (InterruptedException e) {
LOG.error(e);
throw new ProcessCanceledException(e);
}
try {
CAN_RUN_RBENV = ApplicationManager.getApplication().executeOnPooledThread(() -> canRunRbenv()).get();
}
catch (java.util.concurrent.ExecutionException ignored) {
}
catch (InterruptedException e) {
LOG.error(e);
throw new ProcessCanceledException(e);
}
}
public static RunAnythingCache getInstance(Project project) {
return ServiceManager.getService(project, RunAnythingCache.class);
@@ -19,6 +19,7 @@ import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.execution.ParametersListUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -54,8 +55,8 @@ public abstract class RunAnythingCommandProvider extends RunAnythingProviderBase
dataContext = RunAnythingCommandCustomizer.customizeContext(dataContext);
GeneralCommandLine initialCommandLine =
new GeneralCommandLine(commandString).withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE);
GeneralCommandLine initialCommandLine = new GeneralCommandLine(ParametersListUtil.parse(commandString, false, true))
.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE);
GeneralCommandLine commandLine = RunAnythingCommandCustomizer.customizeCommandLine(dataContext, workDirectory, initialCommandLine);
try {
ExecutionEnvironmentBuilder.create(project, executor, new RunAnythingRunProfile(commandLine, commandString))