use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.
the class LibraryBundlingEditorComponent method applyTo.
public void applyTo(ApplicationSettings settings) throws ConfigurationException {
updateCurrentRule();
for (int i = 0; i < myRulesModel.getSize(); i++) {
try {
myRulesModel.getElementAt(i).validate();
} catch (IllegalArgumentException e) {
myRulesList.setSelectedIndex(i);
throw new ConfigurationException(e.getMessage());
}
}
settings.setLibraryBundlificationRules(ContainerUtil.newArrayList(myRulesModel.getItems()));
}
use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.
the class Flexmojos3GenerateConfigTask method updateMainClass.
public static void updateMainClass(final Module module, final VirtualFile configFile) {
// Project Structure open
if (FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor() != null)
return;
try {
final String mainClassPath = FlexUtils.findXMLElement(configFile.getInputStream(), "<flex-config><file-specs><path-element>");
final VirtualFile mainClassFile = mainClassPath == null ? null : LocalFileSystem.getInstance().findFileByPath(mainClassPath);
if (mainClassFile == null || mainClassFile.isDirectory())
return;
final VirtualFile sourceRoot = ProjectRootManager.getInstance(module.getProject()).getFileIndex().getSourceRootForFile(mainClassFile);
final String relativePath = sourceRoot == null ? null : VfsUtilCore.getRelativePath(mainClassFile, sourceRoot, '/');
final String mainClass = relativePath == null ? mainClassFile.getNameWithoutExtension() : FileUtil.getNameWithoutExtension(relativePath).replace('/', '.');
final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
final LibraryTable.ModifiableModel librariesModel = ProjectLibraryTable.getInstance(module.getProject()).getModifiableModel();
final FlexProjectConfigurationEditor flexEditor = FlexProjectConfigurationEditor.createEditor(module.getProject(), Collections.singletonMap(module, modifiableModel), librariesModel, null);
final ModifiableFlexBuildConfiguration[] bcs = flexEditor.getConfigurations(module);
final ModifiableFlexBuildConfiguration mainBC = ContainerUtil.find(bcs, bc -> bc.getOutputType() == OutputType.Application && module.getName().equals(bc.getName()));
if (mainBC != null) {
mainBC.setMainClass(mainClass);
}
flexEditor.commit();
Disposer.dispose(librariesModel);
modifiableModel.dispose();
} catch (IOException ignore) {
/**/
} catch (ConfigurationException ignore) {
/**/
}
}
use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.
the class FlexCompilerProjectConfigurable method apply.
public void apply() throws ConfigurationException {
if (!myProject.isDefault()) {
final FlexCompilerHandler flexCompilerHandler = FlexCompilerHandler.getInstance(myProject);
flexCompilerHandler.getCompilerDependenciesCache().clear();
flexCompilerHandler.quitCompilerShell();
flexCompilerHandler.getBuiltInFlexCompilerHandler().stopCompilerProcess();
}
myConfig.USE_BUILT_IN_COMPILER = myBuiltInCompilerRadioButton.isSelected();
myConfig.USE_MXMLC_COMPC = myMxmlcCompcRadioButton.isSelected();
myConfig.PREFER_ASC_20 = myPreferASC20CheckBox.isSelected();
try {
final int heapSizeMb = Integer.parseInt(myHeapSizeTextField.getText().trim());
if (heapSizeMb > 0) {
myConfig.HEAP_SIZE_MB = heapSizeMb;
} else {
throw new ConfigurationException(FlexBundle.message("invalid.flex.compiler.heap.size"));
}
} catch (NumberFormatException e) {
throw new ConfigurationException(FlexBundle.message("invalid.flex.compiler.heap.size"));
}
myConfig.VM_OPTIONS = myVMOptionsEditor.getText().trim();
}
use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.
the class FlexBuildTargetScopeProvider method appendBCDependencies.
private static void appendBCDependencies(final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCs, final Module module, final FlexBuildConfiguration bc) throws ConfigurationException {
for (final DependencyEntry entry : bc.getDependencies().getEntries()) {
if (entry instanceof BuildConfigurationEntry) {
final BuildConfigurationEntry bcEntry = (BuildConfigurationEntry) entry;
final Module dependencyModule = bcEntry.findModule();
final FlexBuildConfiguration dependencyBC = dependencyModule == null ? null : bcEntry.findBuildConfiguration();
if (dependencyModule == null || dependencyBC == null) {
throw new ConfigurationException(FlexBundle.message("bc.dependency.does.not.exist", bcEntry.getBcName(), bcEntry.getModuleName(), bc.getName(), module.getName()));
}
final Pair<Module, FlexBuildConfiguration> dependencyModuleAndBC = Pair.create(dependencyModule, dependencyBC);
if (!dependencyBC.isSkipCompile()) {
if (modulesAndBCs.add(dependencyModuleAndBC)) {
appendBCDependencies(modulesAndBCs, dependencyModule, dependencyBC);
}
}
}
}
}
use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.
the class FlexBCConfigurator method createBcConfigurable.
private CompositeConfigurable createBcConfigurable(final Module module, final ModifiableFlexBuildConfiguration bc, final Runnable treeNodeNameUpdater) {
final ProjectStructureConfigurable c = ProjectStructureConfigurable.getInstance(module.getProject());
final Runnable bcNatureModifier = createBCNatureModifier(bc);
return new FlexBCConfigurable(module, bc, bcNatureModifier, myConfigEditor, c.getProjectJdksModel(), c.getContext()) {
public void apply() throws ConfigurationException {
super.apply();
myBCToOutputPathMap.put(bc, bc.getActualOutputFilePath());
}
@Override
public void setDisplayName(final String name) {
super.setDisplayName(name);
treeNodeNameUpdater.run();
myEventDispatcher.getMulticaster().buildConfigurationRenamed(this);
}
}.wrapInTabs();
}
Aggregations