use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project intellij-community by JetBrains.
the class JsonSchemaConfigurable method doValidation.
private void doValidation() throws ConfigurationException {
final File file = new File(myProject.getBasePath(), myView.getSchemaSubPath());
VirtualFile vFile = null;
if (!file.exists() || (vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)) == null) {
throw new ConfigurationException((!StringUtil.isEmptyOrSpaces(myDisplayName) ? (myDisplayName + ": ") : "") + "Schema file does not exist");
}
final String filename = file.getName();
if (StringUtil.isEmptyOrSpaces(myDisplayName))
throw new ConfigurationException(filename + ": Schema name is empty");
if (StringUtil.isEmptyOrSpaces(myView.getSchemaSubPath()))
throw new ConfigurationException(filename + ": Schema path is empty");
final CollectConsumer<String> collectConsumer = new CollectConsumer<>();
final JsonSchemaService service = JsonSchemaService.Impl.get(myProject);
if (service != null && !service.isSchemaFile(vFile, collectConsumer)) {
final String message;
if (collectConsumer.getResult().isEmpty())
message = filename + ": Can not read JSON schema from file (Unknown reason)";
else
message = filename + ": Can not read JSON schema from file: " + StringUtil.join(collectConsumer.getResult(), "; ");
logErrorForUser(message);
throw new RuntimeConfigurationWarning(message);
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project intellij-plugins by JetBrains.
the class JstdRunConfigurationVerifier method verifyTestCase.
@Nullable
private static TestFileStructurePack verifyTestCase(@NotNull Project project, @NotNull JstdRunSettings runSettings) throws RuntimeConfigurationException {
verifyJSFileType(runSettings);
if (runSettings.getTestCaseName().isEmpty()) {
throw new RuntimeConfigurationError("Test case name is empty.");
}
VirtualFile jsTestVirtualFile = VfsUtil.findFileByIoFile(new File(runSettings.getJsFilePath()), false);
if (jsTestVirtualFile == null) {
throw new RuntimeConfigurationWarning("Can't find JavaScript test file.");
}
JSFile jsFile = ObjectUtils.tryCast(PsiManager.getInstance(project).findFile(jsTestVirtualFile), JSFile.class);
if (jsFile == null) {
throw new RuntimeConfigurationWarning("Wrong JavaScript test file.");
}
TestFileStructurePack pack = TestFileStructureManager.fetchTestFileStructurePackByJsFile(jsFile);
if (pack != null) {
boolean found = pack.contains(runSettings.getTestCaseName(), null, JstdTestMethodNameRefiner.INSTANCE);
if (!found) {
throw new RuntimeConfigurationWarning("Can't find test case with name '" + runSettings.getTestCaseName() + "'.");
}
return pack;
}
return null;
}
use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project intellij-plugins by JetBrains.
the class FlashRunnerParameters method reportWarnings.
public void reportWarnings(final Project project) throws RuntimeConfigurationWarning {
try {
final Pair<Module, FlexBuildConfiguration> moduleAndBC = super.checkAndGetModuleAndBC(project);
final Module module = moduleAndBC.first;
final FlexBuildConfiguration bc = moduleAndBC.second;
final Ref<String> errorMessageRef = new Ref<>(null);
final Consumer<FlashProjectStructureProblem> consumer = problem -> errorMessageRef.set(problem.errorMessage);
if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAirDesktopPackagingOptions(), consumer, true, getBCName());
} else if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
switch(myMobileRunTarget) {
case Emulator:
switch(myAppDescriptorForEmulator) {
case Android:
checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
break;
case IOS:
checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
break;
}
break;
case AndroidDevice:
checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
break;
case iOSSimulator:
case iOSDevice:
checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
break;
}
}
if (!errorMessageRef.isNull()) {
throw new RuntimeConfigurationWarning(errorMessageRef.get());
}
} catch (RuntimeConfigurationError e) {
/* should be already checked somewhere else */
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project liferay-ide by liferay.
the class LiferayServerConfiguration method checkConfiguration.
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(this);
ProgramParametersUtil.checkWorkingDirectoryExist(this, getProject(), null);
File liferayHome = new File(getLiferayBundle());
if (!liferayHome.exists()) {
throw new RuntimeConfigurationWarning("Unable to detect liferay bundle from '" + liferayHome.toPath() + "', you need to run gradle task 'initBundle' first.");
}
JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this);
}
use of com.intellij.execution.configurations.RuntimeConfigurationWarning in project moe-ide-integration by multi-os-engine.
the class MOEJUnitUtil method checkConfiguration.
public static void checkConfiguration(Module module, int TESTING_TYPE, String PACKAGE_NAME, String CLASS_NAME) throws RuntimeConfigurationException {
JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject());
switch(TESTING_TYPE) {
case TEST_ALL_IN_PACKAGE:
if (PACKAGE_NAME == null || PACKAGE_NAME.isEmpty()) {
throw new RuntimeConfigurationWarning("No test package specified");
}
final PsiPackage testPackage = facade.findPackage(PACKAGE_NAME);
if (testPackage == null) {
throw new RuntimeConfigurationWarning(ExecutionBundle.message("package.does.not.exist.error.message", PACKAGE_NAME));
}
Vector<PsiClass> packageTestClasses = MOEJUnitUtil.getTestClasses(module, PACKAGE_NAME);
if (packageTestClasses == null || packageTestClasses.size() == 0) {
throw new RuntimeConfigurationWarning("Not found test class in package: " + PACKAGE_NAME);
}
break;
case TEST_CLASS:
JavaRunConfigurationModule configurationModule = new JavaRunConfigurationModule(module.getProject(), false);
configurationModule.setModule(module);
final PsiClass testClass = configurationModule.checkModuleAndClassName(CLASS_NAME, ExecutionBundle.message("no.test.class.specified.error.text"));
if (!JUnitUtil.isTestClass(testClass)) {
throw new RuntimeConfigurationWarning(ExecutionBundle.message("class.isnt.test.class.error.message", CLASS_NAME));
}
break;
case TEST_METHOD:
// Already not used
break;
}
}
Aggregations