use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck3.
public void testCorrectScopeForSuperclassCheck3() throws Exception {
// IDEA-91539
final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
FlexTestUtils.modifyConfigs(myProject, e -> {
ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
bc1.setTargetPlatform(TargetPlatform.Desktop);
FlexTestUtils.setSdk(e.getConfigurations(myModule)[0], sdk46);
});
doTestFor(true, getTestName(false) + ".js2", getTestName(false) + "_2.mxml");
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration 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.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexBCConfigurator method canBeRemoved.
public boolean canBeRemoved(ModifiableFlexBuildConfiguration[] configurations) {
Map<Module, Integer> module2ConfigCount = new HashMap<>();
for (ModifiableFlexBuildConfiguration bc : configurations) {
Module module = myConfigEditor.getModule(bc);
Integer count = module2ConfigCount.get(module);
module2ConfigCount.put(module, count != null ? count + 1 : 1);
}
for (Map.Entry<Module, Integer> entry : module2ConfigCount.entrySet()) {
Module module = entry.getKey();
if (myConfigEditor.getConfigurations(module).length == entry.getValue()) {
return false;
}
}
return true;
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexBCConfigurator method addConfiguration.
public void addConfiguration(final Module module, final Runnable treeNodeNameUpdater) {
if (module == null) {
return;
}
final String title = FlexBundle.message("add.build.configuration.title", module.getName());
final AddBuildConfigurationDialog dialog = new AddBuildConfigurationDialog(module.getProject(), title, getUsedNames(module), BuildConfigurationNature.DEFAULT, true);
if (!dialog.showAndGet()) {
return;
}
final ModifiableFlexBuildConfiguration bc = myConfigEditor.createConfiguration(module);
final String bcName = dialog.getBCName();
final String fileName = PathUtil.suggestFileName(bcName);
final BuildConfigurationNature nature = dialog.getNature();
bc.setName(bcName);
bc.setNature(nature);
final ModifiableFlexBuildConfiguration someExistingConfig = myConfigEditor.getConfigurations(module)[0];
bc.setOutputFileName(fileName + (bc.getOutputType() == OutputType.Library ? ".swc" : ".swf"));
bc.setOutputFolder(someExistingConfig.getOutputFolder());
updatePackageFileName(bc, fileName);
if (nature.isApp() && nature.isMobilePlatform()) {
bc.getAndroidPackagingOptions().setEnabled(dialog.isAndroidEnabled());
bc.getIosPackagingOptions().setEnabled(dialog.isIOSEnabled());
}
final SdkEntry sdkEntry = someExistingConfig.getDependencies().getSdkEntry();
final SdkEntry newSdkEntry;
if (sdkEntry != null && FlexSdkUtils.findFlexOrFlexmojosSdk(sdkEntry.getName()) != null) {
newSdkEntry = Factory.createSdkEntry(sdkEntry.getName());
} else {
newSdkEntry = findAnySdk();
}
bc.getDependencies().setSdkEntry(newSdkEntry);
createConfigurableNode(bc, module, treeNodeNameUpdater);
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexBCConfigurator method moduleRemoved.
public void moduleRemoved(final Module module) {
if (ModuleType.get(module) != FlexModuleType.getInstance()) {
return;
}
// config editor will handle event and update modifiable model on its own, we just need to update configurables
Collection<ModifiableFlexBuildConfiguration> configsToRemove = ContainerUtil.findAll(myConfigurablesMap.keySet(), bc -> myConfigEditor.getModule(bc) == module);
final ProjectStructureDaemonAnalyzer daemonAnalyzer = ProjectStructureConfigurable.getInstance(myConfigEditor.getProject()).getContext().getDaemonAnalyzer();
for (ModifiableFlexBuildConfiguration bc : configsToRemove) {
CompositeConfigurable configurable = myConfigurablesMap.remove(bc);
myBCToOutputPathMap.remove(bc);
daemonAnalyzer.removeElement(configurable.getProjectStructureElement());
daemonAnalyzer.queueUpdateForAllElementsWithErrors();
configurable.disposeUIResources();
}
myEventDispatcher.getMulticaster().moduleRemoved(module);
}
Aggregations