Search in sources :

Example 16 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class AirPackageDialog method updateControlsEnabledState.

private void updateControlsEnabledState() {
    boolean desktopPresent = false;
    boolean androidPresent = false;
    boolean iosPresent = false;
    for (Pair<Module, FlexBuildConfiguration> moduleAndBC : getSelectedBCs()) {
        final FlexBuildConfiguration bc = moduleAndBC.second;
        final BuildConfigurationNature nature = bc.getNature();
        if (nature.isDesktopPlatform())
            desktopPresent = true;
        if (nature.isMobilePlatform() && bc.getAndroidPackagingOptions().isEnabled())
            androidPresent = true;
        if (nature.isMobilePlatform() && bc.getIosPackagingOptions().isEnabled())
            iosPresent = true;
        if (desktopPresent && androidPresent && iosPresent)
            break;
    }
    myDesktopTypeLabel.setEnabled(desktopPresent);
    myDesktopTypeCombo.setEnabled(desktopPresent);
    myAndroidTypeLabel.setEnabled(androidPresent);
    myAndroidTypeCombo.setEnabled(androidPresent);
    myApkCaptiveRuntimeCheckBox.setEnabled(androidPresent);
    UIUtil.setEnabled(myApkDebugPortPanel, androidPresent, true);
    //UIUtil.setEnabled(myApkDebugHostPanel, androidPresent, true);
    myIosTypeLabel.setEnabled(iosPresent);
    myIOSTypeCombo.setEnabled(iosPresent);
    myIosFastPackagingCheckBox.setEnabled(iosPresent);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module)

Example 17 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlexUnitRunConfiguration method getState.

@Override
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    final FlexBuildConfiguration bc;
    try {
        bc = myRunnerParameters.checkAndGetModuleAndBC(getProject()).second;
    } catch (RuntimeConfigurationError e) {
        throw new ExecutionException(e.getMessage());
    }
    final BuildConfigurationNature nature = bc.getNature();
    if (nature.isDesktopPlatform() || nature.isMobilePlatform()) {
        return new FlashRunConfiguration.AirRunState(getProject(), env, myRunnerParameters) {

            @NotNull
            @Override
            public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
                final ProcessHandler processHandler = startProcess();
                final ExecutionConsole console = FlexBaseRunner.createFlexUnitRunnerConsole(getProject(), env, processHandler);
                return new DefaultExecutionResult(console, processHandler);
            }
        };
    }
    return EmptyRunProfileState.INSTANCE;
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) ProgramRunner(com.intellij.execution.runners.ProgramRunner) NotNull(org.jetbrains.annotations.NotNull)

Example 18 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature 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);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) AddBuildConfigurationDialog(com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog) SdkEntry(com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)

Example 19 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlashRunConfiguration method getState.

@Override
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    final FlexBuildConfiguration config;
    try {
        config = myRunnerParameters.checkAndGetModuleAndBC(getProject()).second;
    } catch (RuntimeConfigurationError e) {
        throw new ExecutionException(e.getMessage());
    }
    final BuildConfigurationNature nature = config.getNature();
    if (nature.isDesktopPlatform() || (nature.isMobilePlatform() && myRunnerParameters.getMobileRunTarget() == AirMobileRunTarget.Emulator)) {
        return new AirRunState(getProject(), env, myRunnerParameters);
    }
    return EmptyRunProfileState.INSTANCE;
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ExecutionException(com.intellij.execution.ExecutionException)

Example 20 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlexBCConfigurator method copy.

public void copy(final CompositeConfigurable configurable, final Runnable treeNodeNameUpdater) {
    try {
        configurable.apply();
    } catch (ConfigurationException ignored) {
    /**/
    }
    ModifiableFlexBuildConfiguration existingBC = myConfigurablesMap.getKeysByValue(configurable).get(0);
    FlexBCConfigurable unwrapped = FlexBCConfigurable.unwrap(configurable);
    final String title = FlexBundle.message("copy.build.configuration", existingBC.getName(), unwrapped.getModule().getName());
    Module module = unwrapped.getModule();
    AddBuildConfigurationDialog dialog = new AddBuildConfigurationDialog(module.getProject(), title, getUsedNames(module), existingBC.getNature(), true);
    dialog.reset("", existingBC.getAndroidPackagingOptions().isEnabled(), existingBC.getIosPackagingOptions().isEnabled());
    if (!dialog.showAndGet()) {
        return;
    }
    final String newBCName = dialog.getBCName();
    final String fileName = PathUtil.suggestFileName(newBCName);
    final BuildConfigurationNature newNature = dialog.getNature();
    ModifiableFlexBuildConfiguration newBC = myConfigEditor.copyConfiguration(existingBC, newNature);
    newBC.setName(newBCName);
    newBC.setOutputFileName(fileName + (newBC.getOutputType() == OutputType.Library ? ".swc" : ".swf"));
    updatePackageFileName(newBC, fileName);
    if (newNature.isApp() && newNature.isMobilePlatform()) {
        newBC.getAndroidPackagingOptions().setEnabled(dialog.isAndroidEnabled());
        newBC.getIosPackagingOptions().setEnabled(dialog.isIOSEnabled());
    }
    createConfigurableNode(newBC, unwrapped.getModule(), treeNodeNameUpdater);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ConfigurationException(com.intellij.openapi.options.ConfigurationException) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) AddBuildConfigurationDialog(com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog)

Aggregations

BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)36 Module (com.intellij.openapi.module.Module)11 Sdk (com.intellij.openapi.projectRoots.Sdk)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)4 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)4 NotNull (org.jetbrains.annotations.NotNull)4 OutputType (com.intellij.flex.model.bc.OutputType)3 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)3 WriteAction (com.intellij.openapi.application.WriteAction)3 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)3 FlexTestUtils (com.intellij.flex.util.FlexTestUtils)2 FlexStylesIndexableSetContributor (com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor)2 FlexSchemaHandler (com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler)2 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)2 ModuleType (com.intellij.openapi.module.ModuleType)2 Project (com.intellij.openapi.project.Project)2 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)2 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)2