use of com.intellij.openapi.options.ConfigurationException in project azure-tools-for-java by Microsoft.
the class FunctionDeployConfiguration method validate.
@Override
public void validate() throws ConfigurationException {
checkAzurePreconditions();
if (this.module == null) {
throw new ConfigurationException(message("function.deploy.validate.noModule"));
}
final FunctionAppConfig functionAppConfig = functionDeployModel.getFunctionAppConfig();
if (StringUtils.isAllEmpty(functionAppConfig.getResourceId(), functionAppConfig.getName())) {
throw new ConfigurationException(message("function.deploy.validate.noTarget"));
}
}
use of com.intellij.openapi.options.ConfigurationException in project moe-ide-integration by multi-os-engine.
the class MOEModuleBuilder method setupRootModel.
@Override
public void setupRootModel(final ModifiableRootModel rootModel) throws ConfigurationException {
Project project = rootModel.getProject();
Module module = rootModel.getModule();
myJdk = MOESdkType.getJDK();
ProjectRootManager.getInstance(project).setProjectSdk(myJdk);
rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(MOESdkType.REQUIRED_JAVA_LANGUAGE_LEVEL);
super.setupRootModel(rootModel);
ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project);
String projectPath = rootModel.getProject().getBasePath();
String contentEntryPath = getContentEntryPath();
if (contentEntryPath == null || contentEntryPath.isEmpty()) {
throw new RuntimeException("Can't get content entry path.");
}
VirtualFile contentRoot = LocalFileSystem.getInstance().findFileByIoFile(new File(contentEntryPath));
try {
createModule(contentRoot, project);
} catch (MOEProjectComposer.MOEProjectComposerException e) {
throw new ConfigurationException(e.getMessage());
}
VirtualFile[] contentFiles = new VirtualFile[] { contentRoot };
VfsUtil.markDirtyAndRefresh(false, true, true, contentFiles);
new ReformatCodeProcessor(project, module, false).run();
String resourcePath = "src/main/" + MOESdkPlugin.getResourcesFolderName();
String sourcePath = "src/main/java";
for (ContentEntry entry : rootModel.getContentEntries()) {
for (SourceFolder srcFolder : entry.getSourceFolders()) {
entry.removeSourceFolder(srcFolder);
}
VirtualFile sourceFile = null;
if (contentRoot != null) {
sourceFile = contentRoot.findFileByRelativePath(sourcePath);
}
if (sourceFile != null) {
entry.addSourceFolder(sourceFile, false);
}
VirtualFile resourceFolder = null;
if (contentRoot != null) {
resourceFolder = contentRoot.findFileByRelativePath(resourcePath);
}
if (resourceFolder != null && resourceFolder.exists()) {
SourceFolder sourceFolder = entry.addSourceFolder(resourceFolder, JavaResourceRootType.RESOURCE);
JavaSourceRootProperties properties = sourceFolder.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
if (properties != null) {
properties.setForGeneratedSources(true);
}
}
}
try {
configureGradle(rootModel);
} catch (IOException e) {
MOEToolWindow.getInstance(project).error("Error occurred during gradle configuration: " + e.getMessage());
}
if (!isNewProject) {
File settingsGradle = new File(projectPath, "settings.gradle");
try {
if (!settingsGradle.exists()) {
if (!settingsGradle.createNewFile()) {
MOEToolWindow.getInstance(project).error("Error occurred during gradle settings file.");
}
}
modifyGradleSettings(settingsGradle, new Module[] { rootModel.getModule() });
} catch (IOException e) {
MOEToolWindow.getInstance(project).error("Error occurred during gradle configuration: " + e.getMessage());
}
}
if (contentRoot != null) {
contentRoot.refresh(false, true);
}
Sdk sdk = MOESdkType.getMOESdk(rootModel.getModule());
if (sdk != null) {
rootModel.setSdk(sdk);
} else {
MOEToolWindow.getInstance(project).error("Error, unable set Sdk.");
}
rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(MOESdkType.REQUIRED_JAVA_LANGUAGE_LEVEL);
StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
configureRun(rootModel);
}
});
}
use of com.intellij.openapi.options.ConfigurationException in project moe-ide-integration by multi-os-engine.
the class MOERunConfigurationEditor method applyEditorTo.
@Override
protected void applyEditorTo(MOERunConfiguration configuration) throws ConfigurationException {
if (configurationCombo.getSelectedItem() != null) {
configuration.configuration(configurationCombo.getSelectedItem().toString());
}
if (simulatorCombo.getSelectedItem() != null) {
configuration.simulatorDeviceName(simulatorCombo.getSelectedItem().toString());
configuration.simulatorUdid(((SimulatorComboItem) simulatorCombo.getSelectedItem()).udid());
}
if (deviceCombo.getSelectedItem() != null) {
String deviceUdid = deviceCombo.getSelectedItem().toString();
if (deviceUdid.equals(MOEText.get("First.Device.Available"))) {
deviceUdid = "";
}
configuration.deviceUdid(deviceUdid);
}
if (moduleCombo.getSelectedItem() == null) {
throw new ConfigurationException("Please select a module");
}
try {
configuration.moduleName(moduleCombo.getSelectedItem().toString());
} catch (Exception e) {
throw new ConfigurationException(e.getMessage());
}
String port = textDebugPort.getText();
if (!InputValidationHelper.isInteger(port)) {
throw new ConfigurationException("Wrong debug port number, please enter a numeric value.");
}
configuration.debugPort(Integer.parseInt(port));
port = textDebugRemotePort.getText();
if (!InputValidationHelper.isInteger(port)) {
throw new ConfigurationException("Wrong remote debug port number, please enter a numeric value.");
}
if (enableRemoteBuildCheckBox.isSelected()) {
Properties properties = RemoteSettings.getProperties(hostTextField.getText(), portTextField.getText(), userTextField.getText(), knownhostsTextField.getText(), identityTextField.getText(), keychainNameTextField.getText(), keychainPassTextField.getText(), keychainLocktimeoutTextField.getText(), gradleRepositoriesTextField.getText());
try {
RemoteSettings.validate(properties);
} catch (ConfigurationValidationException e) {
throw new ConfigurationException(e.getErrorMessage());
}
}
configuration.debugRemotePort(Integer.parseInt(port));
configuration.runOnSimulator(simulatorRadio.isSelected());
configuration.runJUnitTests(runJUnitTestsCheckBox.isSelected());
configuration.setTestType(getTestingType());
updateButtonsAndLabelComponents(configuration.getTestType());
configuration.setTestClassName(myClassComponent.getComponent().getText());
configuration.setTestPackageName(myPackageComponent.getComponent().getText());
configuration.setRemoteBuildEnabled(enableRemoteBuildCheckBox.isSelected());
configuration.setRemoteHost(hostTextField.getText());
String remotePort = portTextField.getText();
remotePort = remotePort == null || remotePort.isEmpty() ? "0" : remotePort;
configuration.setRemotePort(Integer.parseInt(remotePort));
configuration.setRemoteUser(userTextField.getText());
configuration.setRemoteKnownhosts(knownhostsTextField.getText());
configuration.setRemoteIdentity(identityTextField.getText());
configuration.setRemoteKeychainPass(keychainPassTextField.getText());
configuration.setRemoteKeychainName(keychainNameTextField.getText());
String remoteBuildTimeout = keychainLocktimeoutTextField.getText();
remoteBuildTimeout = remoteBuildTimeout == null || remoteBuildTimeout.isEmpty() ? "0" : remoteBuildTimeout;
configuration.setRemoteKeychainLocktimeout(Integer.parseInt(remoteBuildTimeout));
configuration.setRemoteGradleRepositories(gradleRepositoriesTextField.getText());
configuration.setOpenDeploymentTargetDialog(openSelectDeploymentTargetCheckBox.isSelected());
argumentsPanel.applyEditorTo(configuration);
}
use of com.intellij.openapi.options.ConfigurationException in project clion-embedded-arm by elmot.
the class OpenOcdLauncher method createProcess.
@Override
protected ProcessHandler createProcess(@NotNull CommandLineState commandLineState) throws ExecutionException {
File runFile = findRunFile(commandLineState);
findOpenOcdAction(commandLineState.getEnvironment().getProject()).stopOpenOcd();
try {
GeneralCommandLine commandLine = OpenOcdComponent.createOcdCommandLine(commandLineState.getEnvironment().getProject(), runFile, "reset", true);
OSProcessHandler osProcessHandler = new OSProcessHandler(commandLine);
osProcessHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
super.processTerminated(event);
Project project = commandLineState.getEnvironment().getProject();
if (event.getExitCode() == 0) {
Informational.showSuccessfulDownloadNotification(project);
} else {
Informational.showFailedDownloadNotification(project);
}
}
});
return osProcessHandler;
} catch (ConfigurationException e) {
Messages.showErrorDialog(getProject(), e.getLocalizedMessage(), e.getTitle());
throw new ExecutionException(e);
}
}
use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by StepicOrg.
the class ModuleUtils method createStepModule.
static void createStepModule(@NotNull Project project, @NotNull StepNode step, @NotNull ModifiableModuleModel moduleModel) {
StudyNode lesson = step.getParent();
if (lesson != null) {
String moduleDir = String.join("/", project.getBasePath(), lesson.getPath());
StepModuleBuilder stepModuleBuilder = new StepModuleBuilder(moduleDir, step);
try {
stepModuleBuilder.createModule(moduleModel);
} catch (IOException | ModuleWithNameAlreadyExists | JDOMException | ConfigurationException e) {
logger.warn("Cannot create step: " + step.getDirectory(), e);
}
}
}
Aggregations