Search in sources :

Example 6 with RuntimeConfigurationWarning

use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project intellij-community by JetBrains.

the class TestDirectory method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    JavaParametersUtil.checkAlternativeJRE(getConfiguration());
    ProgramParametersUtil.checkWorkingDirectoryExist(getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
    final String dirName = getConfiguration().getPersistentData().getDirName();
    if (dirName == null || dirName.isEmpty()) {
        throw new RuntimeConfigurationError("Directory is not specified");
    }
    final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
    if (file == null) {
        throw new RuntimeConfigurationWarning("Directory \'" + dirName + "\' is not found");
    }
    final Module module = getConfiguration().getConfigurationModule().getModule();
    if (module == null) {
        throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 7 with RuntimeConfigurationWarning

use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project intellij-community by JetBrains.

the class CloudGitDeploymentChecker method checkGitUrl.

public void checkGitUrl(final RemoteServer<SC> server, final DeploymentSource deploymentSource, final T settings) throws RuntimeConfigurationException {
    if (!(deploymentSource instanceof ModuleDeploymentSource)) {
        return;
    }
    ModuleDeploymentSource moduleSource = (ModuleDeploymentSource) deploymentSource;
    Module module = moduleSource.getModule();
    if (module == null) {
        return;
    }
    File contentRootFile = deploymentSource.getFile();
    if (contentRootFile == null) {
        return;
    }
    final Project project = module.getProject();
    VirtualFile contentRoot = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(contentRootFile);
    if (contentRoot == null) {
        return;
    }
    GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRoot(contentRoot);
    if (repository == null) {
        return;
    }
    String expectedName = settings.getDeploymentSourceName(deploymentSource);
    List<String> appNames = myDetector.collectApplicationNames(repository);
    if (appNames.isEmpty() || appNames.contains(expectedName)) {
        return;
    }
    RuntimeConfigurationWarning warning = new RuntimeConfigurationWarning("Cloud Git URL found in repository, but it doesn't match the run configuration");
    warning.setQuickFix(() -> {
        CloudGitApplication application = new CloudConnectionTask<CloudGitApplication, SC, T, SR>(project, "Searching for application", server) {

            @Override
            protected CloudGitApplication run(SR serverRuntime) throws ServerRuntimeException {
                CloudGitDeploymentRuntime deploymentRuntime = (CloudGitDeploymentRuntime) serverRuntime.createDeploymentRuntime(deploymentSource, settings, project);
                return deploymentRuntime.findApplication4Repository();
            }
        }.performSync();
        if (application == null) {
            Messages.showErrorDialog(project, "No application matching repository URL(s) found in account", server.getName());
        } else {
            settings.setDefaultDeploymentName(false);
            settings.setDeploymentName(application.getName());
        }
    });
    throw warning;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CloudGitApplication(com.intellij.remoteServer.agent.util.CloudGitApplication) Project(com.intellij.openapi.project.Project) GitRepository(git4idea.repo.GitRepository) ModuleDeploymentSource(com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) Module(com.intellij.openapi.module.Module) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)4 Module (com.intellij.openapi.module.Module)4 File (java.io.File)4 Project (com.intellij.openapi.project.Project)2 Nullable (org.jetbrains.annotations.Nullable)2 JavaRunConfigurationModule (com.intellij.execution.configurations.JavaRunConfigurationModule)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 FlexCommonBundle (com.intellij.flex.FlexCommonBundle)1 FlexCommonUtils (com.intellij.flex.FlexCommonUtils)1 LinkageType (com.intellij.flex.model.bc.LinkageType)1 OutputType (com.intellij.flex.model.bc.OutputType)1 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)1 BrowserUtil (com.intellij.ide.BrowserUtil)1 ActionScriptClassResolver (com.intellij.javascript.flex.resolve.ActionScriptClassResolver)1 TestFileStructurePack (com.intellij.javascript.testFramework.TestFileStructurePack)1 FlexBundle (com.intellij.lang.javascript.flex.FlexBundle)1 AirPackageUtil (com.intellij.lang.javascript.flex.actions.airpackage.AirPackageUtil)1 FlashProjectStructureProblem (com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem)1