use of com.intellij.execution.configurations.RunProfile in project go-lang-idea-plugin by go-lang-plugin-org.
the class DlvStackFrame method findFile.
@Nullable
private VirtualFile findFile() {
String url = myLocation.file;
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(url);
if (file == null && SystemInfo.isWindows) {
Project project = myProcess.getSession().getProject();
RunProfile profile = myProcess.getSession().getRunProfile();
Module module = profile instanceof ModuleBasedConfiguration ? ((ModuleBasedConfiguration) profile).getConfigurationModule().getModule() : null;
String sdkHomePath = GoSdkService.getInstance(project).getSdkHomePath(module);
if (sdkHomePath == null)
return null;
String newUrl = StringUtil.replaceIgnoreCase(url, "c:/go", sdkHomePath);
return LocalFileSystem.getInstance().findFileByPath(newUrl);
}
return file;
}
use of com.intellij.execution.configurations.RunProfile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestConsoleProperties method initScope.
@NotNull
@Override
protected GlobalSearchScope initScope() {
RunProfile configuration = getConfiguration();
if (configuration instanceof GoTestRunConfiguration) {
Project project = ((GoTestRunConfiguration) configuration).getProject();
Module module = ((GoTestRunConfiguration) configuration).getConfigurationModule().getModule();
switch(((GoTestRunConfiguration) configuration).getKind()) {
case DIRECTORY:
String directoryUrl = VfsUtilCore.pathToUrl(((GoTestRunConfiguration) configuration).getDirectoryPath());
VirtualFile directory = VirtualFileManager.getInstance().findFileByUrl(directoryUrl);
if (directory != null) {
return GlobalSearchScopesCore.directoryScope(project, directory, true);
}
break;
case PACKAGE:
VirtualFile packageDir = GoPackageUtil.findByImportPath(((GoTestRunConfiguration) configuration).getPackage(), project, module);
PsiDirectory psiDirectory = packageDir != null ? PsiManager.getInstance(project).findDirectory(packageDir) : null;
if (psiDirectory != null) {
return GoPackageUtil.packageScope(psiDirectory, null);
}
break;
case FILE:
String fileUrl = VfsUtilCore.pathToUrl(((GoTestRunConfiguration) configuration).getFilePath());
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(fileUrl);
if (file != null) {
return GlobalSearchScope.fileScope(project, file);
}
break;
}
}
if (configuration instanceof GoRunConfigurationBase) {
GlobalSearchScope scope = GlobalSearchScope.EMPTY_SCOPE;
for (Module module : ((GoRunConfigurationBase) configuration).getModules()) {
scope = new GoUtil.TestsScope(GoUtil.goPathResolveScope(module, null));
}
return scope;
}
return super.initScope();
}
use of com.intellij.execution.configurations.RunProfile in project Intellij-Plugin by getgauge.
the class GaugeTestRunnerTest method shouldRunOnlyGaugeRunConfiguration.
@Test
public void shouldRunOnlyGaugeRunConfiguration() {
RunProfile profile = mock(GaugeRunConfiguration.class);
GaugeTestRunner runner = new GaugeTestRunner();
assertTrue("Should run only GaugeRunConfiguration Expected: true, Actual: false", runner.canRun("", profile));
}
use of com.intellij.execution.configurations.RunProfile in project Intellij-Plugin by getgauge.
the class GaugeTestRunnerTest method shouldNotRunNonGaugeRunConfigurationProfile.
@Test
public void shouldNotRunNonGaugeRunConfigurationProfile() {
RunProfile profile = mock(RunProfile.class);
GaugeTestRunner runner = new GaugeTestRunner();
assertFalse("Should run only GaugeRunConfiguration Expected: false, Actual: true", runner.canRun("", profile));
}
use of com.intellij.execution.configurations.RunProfile in project intellij by bazelbuild.
the class BlazeHotSwapManager method findHotSwappableBlazeDebuggerSession.
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
if (session == null || !session.isAttached()) {
return null;
}
JavaDebugProcess process = session.getProcess().getXdebugProcess();
if (process == null) {
return null;
}
ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
return null;
}
RunProfile runProfile = env.getRunProfile();
if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
return null;
}
return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
Aggregations