Search in sources :

Example 26 with RunProfile

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;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) RunProfile(com.intellij.execution.configurations.RunProfile) Module(com.intellij.openapi.module.Module) ModuleBasedConfiguration(com.intellij.execution.configurations.ModuleBasedConfiguration) Nullable(org.jetbrains.annotations.Nullable)

Example 27 with RunProfile

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();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) GoRunConfigurationBase(com.goide.runconfig.GoRunConfigurationBase) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) PsiDirectory(com.intellij.psi.PsiDirectory) GoUtil(com.goide.util.GoUtil) RunProfile(com.intellij.execution.configurations.RunProfile) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with RunProfile

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));
}
Also used : RunProfile(com.intellij.execution.configurations.RunProfile) Test(org.junit.Test)

Example 29 with RunProfile

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));
}
Also used : RunProfile(com.intellij.execution.configurations.RunProfile) Test(org.junit.Test)

Example 30 with RunProfile

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);
}
Also used : DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) JavaDebugProcess(com.intellij.debugger.engine.JavaDebugProcess) RunProfile(com.intellij.execution.configurations.RunProfile) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) Nullable(javax.annotation.Nullable)

Aggregations

RunProfile (com.intellij.execution.configurations.RunProfile)33 ProcessHandler (com.intellij.execution.process.ProcessHandler)9 Project (com.intellij.openapi.project.Project)8 NotNull (org.jetbrains.annotations.NotNull)8 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)7 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)7 RunConfigurationBase (com.intellij.execution.configurations.RunConfigurationBase)6 Nullable (org.jetbrains.annotations.Nullable)6 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)5 ExecutionException (com.intellij.execution.ExecutionException)4 ExecutionEnvironmentBuilder (com.intellij.execution.runners.ExecutionEnvironmentBuilder)4 Test (org.junit.Test)4 AndroidSessionInfo (com.android.tools.idea.run.AndroidSessionInfo)3 ExecutionResult (com.intellij.execution.ExecutionResult)3 Module (com.intellij.openapi.module.Module)3 XDebugSession (com.intellij.xdebugger.XDebugSession)3 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)2 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)2 CompatibilityAwareRunProfile (com.intellij.execution.configuration.CompatibilityAwareRunProfile)2 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)2