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");
}
}
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;
}
Aggregations