use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.
the class FlexTestUtils method createFlashRunConfig.
public static void createFlashRunConfig(final RunManager runManager, final Module module, final String configName, final String className, boolean generatedName) {
final RunnerAndConfigurationSettings settings = runManager.createRunConfiguration(configName, FlashRunConfigurationType.getFactory());
runManager.addConfiguration(settings, false);
final FlashRunnerParameters params = ((FlashRunConfiguration) settings.getConfiguration()).getRunnerParameters();
params.setModuleName(module.getName());
params.setBCName(FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration().getName());
params.setOverrideMainClass(true);
params.setOverriddenMainClass(className);
if (generatedName) {
((FlashRunConfiguration) settings.getConfiguration()).setGeneratedName();
}
}
use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.
the class FlashRunConfigurationForm method doResetEditorFrom.
private void doResetEditorFrom(final FlashRunConfiguration configuration) {
final FlashRunnerParameters params = configuration.getRunnerParameters();
// must be before myBCsCombo.setModel()
myLauncherParameters = params.getLauncherParameters().clone();
myBCCombo.resetFrom(params);
myOverrideMainClassCheckBox.setSelected(params.isOverrideMainClass());
if (params.isOverrideMainClass()) {
myMainClassComponent.setText(params.getOverriddenMainClass());
myOutputFileNameTextField.setText(params.getOverriddenOutputFileName());
}
myBCOutputRadioButton.setSelected(!params.isLaunchUrl());
myUrlOrFileRadioButton.setSelected(params.isLaunchUrl());
final String url = params.getUrl();
final boolean windowsLocalFile = SystemInfo.isWindows && url.length() >= 2 && Character.isLetter(url.charAt(0)) && ':' == url.charAt(1);
myUrlOrFileTextWithBrowse.setText(windowsLocalFile ? FileUtil.toSystemDependentName(url) : url);
myRunTrustedCheckBox.setSelected(params.isRunTrusted());
myAdlOptionsEditor.setText(params.getAdlOptions());
myAirProgramParametersEditor.setText(params.getAirProgramParameters());
myOnEmulatorRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.Emulator);
myEmulatorCombo.setSelectedItem(params.getEmulator());
if (params.getEmulator().adlAlias == null) {
myScreenWidth.setText(String.valueOf(params.getScreenWidth()));
myScreenHeight.setText(String.valueOf(params.getScreenHeight()));
myFullScreenWidth.setText(String.valueOf(params.getFullScreenWidth()));
myFullScreenHeight.setText(String.valueOf(params.getFullScreenHeight()));
myScreenDpi.setText(params.getScreenDpi() > 0 ? String.valueOf(params.getScreenDpi()) : "");
}
myOnAndroidDeviceRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.AndroidDevice);
myOnIOSSimulatorRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.iOSSimulator);
myIOSSimulatorSdkTextWithBrowse.setText(FileUtil.toSystemDependentName(params.getIOSSimulatorSdkPath()));
myOnIOSDeviceRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.iOSDevice);
myFastPackagingCheckBox.setSelected(params.isFastPackaging());
myDebugOverNetworkRadioButton.setSelected(params.getDebugTransport() == AirMobileDebugTransport.Network);
myDebugOverUSBRadioButton.setSelected(params.getDebugTransport() == AirMobileDebugTransport.USB);
myUsbDebugPortTextField.setText(String.valueOf(params.getUsbDebugPort()));
myEmulatorAdlOptionsEditor.setText(params.getEmulatorAdlOptions());
myAppDescriptorForEmulatorCombo.setSelectedItem(params.getAppDescriptorForEmulator());
final FlexBuildConfiguration bc = myBCCombo.getBC();
mySdkForDebuggingCombo.setBCSdk(bc == null ? null : bc.getSdk());
mySdkForDebuggingCombo.setSelectedSdkRaw(params.getDebuggerSdkRaw());
updateControls();
}
use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.
the class FlashRunConfigurationForm method applyEditorTo.
@Override
protected void applyEditorTo(@NotNull final FlashRunConfiguration configuration) throws ConfigurationException {
final FlashRunnerParameters params = configuration.getRunnerParameters();
myBCCombo.applyTo(params);
final boolean overrideMainClass = myOverrideMainClassCheckBox.isSelected();
params.setOverrideMainClass(overrideMainClass);
params.setOverriddenMainClass(overrideMainClass ? myMainClassComponent.getText().trim() : "");
params.setOverriddenOutputFileName(overrideMainClass ? myOutputFileNameTextField.getText().trim() : "");
params.setLaunchUrl(myUrlOrFileRadioButton.isSelected());
final String url = myUrlOrFileTextWithBrowse.getText().trim();
final boolean windowsLocalFile = SystemInfo.isWindows && url.length() >= 2 && Character.isLetter(url.charAt(0)) && ':' == url.charAt(1);
params.setUrl(windowsLocalFile ? FileUtil.toSystemIndependentName(url) : url);
params.setLauncherParameters(myLauncherParameters);
params.setRunTrusted(myRunTrustedCheckBox.isSelected());
params.setAdlOptions(myAdlOptionsEditor.getText().trim());
params.setAirProgramParameters(myAirProgramParametersEditor.getText().trim());
final AirMobileRunTarget mobileRunTarget = myOnEmulatorRadioButton.isSelected() ? AirMobileRunTarget.Emulator : myOnAndroidDeviceRadioButton.isSelected() ? AirMobileRunTarget.AndroidDevice : myOnIOSSimulatorRadioButton.isSelected() ? AirMobileRunTarget.iOSSimulator : AirMobileRunTarget.iOSDevice;
params.setMobileRunTarget(mobileRunTarget);
final Emulator emulator = (Emulator) myEmulatorCombo.getSelectedItem();
params.setEmulator(emulator);
if (emulator.adlAlias == null) {
try {
params.setScreenWidth(Integer.parseInt(myScreenWidth.getText().trim()));
params.setScreenHeight(Integer.parseInt(myScreenHeight.getText().trim()));
params.setFullScreenWidth(Integer.parseInt(myFullScreenWidth.getText().trim()));
params.setFullScreenHeight(Integer.parseInt(myFullScreenHeight.getText().trim()));
} catch (NumberFormatException e) {
/**/
}
try {
params.setScreenDpi(Integer.parseInt(myScreenDpi.getText().trim()));
} catch (NumberFormatException e) {
params.setScreenDpi(0);
}
}
final FlexBuildConfiguration bc = myBCCombo.getBC();
if (SystemInfo.isMac && bc != null && bc.getTargetPlatform() == TargetPlatform.Mobile && myOnIOSSimulatorRadioButton.isSelected()) {
final String path = FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim());
if (!path.isEmpty()) {
PropertiesComponent.getInstance().setValue(LATEST_SELECTED_IOS_SIMULATOR_SDK_PATH_KEY, path);
}
}
params.setIOSSimulatorSdkPath(FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim()));
params.setFastPackaging(myFastPackagingCheckBox.isSelected());
params.setDebugTransport(myDebugOverNetworkRadioButton.isSelected() ? AirMobileDebugTransport.Network : AirMobileDebugTransport.USB);
try {
final int port = Integer.parseInt(myUsbDebugPortTextField.getText().trim());
if (port > 0 && port < 65535) {
params.setUsbDebugPort(port);
}
} catch (NumberFormatException ignore) {
/*ignore*/
}
params.setEmulatorAdlOptions(myEmulatorAdlOptionsEditor.getText().trim());
params.setAppDescriptorForEmulator((AppDescriptorForEmulator) myAppDescriptorForEmulatorCombo.getSelectedItem());
params.setDebuggerSdkRaw(mySdkForDebuggingCombo.getSelectedSdkRaw());
}
use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.
the class FlexModuleBuilder method createRunConfiguration.
public static void createRunConfiguration(final Module module, final FlexBuildConfiguration bc) {
final RunManager runManager = RunManagerEx.getInstance(module.getProject());
final List<RunConfiguration> existingConfigurations = runManager.getConfigurationsList(FlashRunConfigurationType.getInstance());
for (RunConfiguration configuration : existingConfigurations) {
final FlashRunnerParameters parameters = ((FlashRunConfiguration) configuration).getRunnerParameters();
if (module.getName().equals(parameters.getModuleName()) && bc.getName().equals(parameters.getBCName())) {
//already exists
return;
}
}
final RunnerAndConfigurationSettings settings = runManager.createConfiguration("", FlashRunConfigurationType.getFactory());
final FlashRunConfiguration runConfiguration = (FlashRunConfiguration) settings.getConfiguration();
final FlashRunnerParameters params = runConfiguration.getRunnerParameters();
params.setModuleName(module.getName());
params.setBCName(bc.getName());
if (bc.getNature().isMobilePlatform()) {
if (bc.getAndroidPackagingOptions().isEnabled()) {
params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.Android);
} else if (bc.getIosPackagingOptions().isEnabled()) {
params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.IOS);
}
}
settings.setName(params.suggestUniqueName(existingConfigurations));
settings.setTemporary(false);
runManager.addConfiguration(settings, false);
runManager.setSelectedConfiguration(settings);
}
use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.
the class ValidateFlashConfigurationsPrecompileTask method getProblems.
static Collection<Trinity<Module, FlexBuildConfiguration, FlashProjectStructureProblem>> getProblems(final CompileScope scope, final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile) {
final Collection<Trinity<Module, FlexBuildConfiguration, FlashProjectStructureProblem>> problems = new ArrayList<>();
for (final Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
final Module module = moduleAndBC.first;
final FlexBuildConfiguration bc = moduleAndBC.second;
final Consumer<FlashProjectStructureProblem> errorConsumer = problem -> problems.add(Trinity.create(module, bc, problem));
checkConfiguration(module, bc, false, errorConsumer);
final RunConfiguration runConfig = CompileStepBeforeRun.getRunConfiguration(scope);
if (bc.getNature().isApp() && runConfig instanceof FlashRunConfiguration) {
final FlashRunnerParameters params = ((FlashRunConfiguration) runConfig).getRunnerParameters();
if (module.getName().equals(params.getModuleName()) && bc.getName().equals(params.getBCName())) {
if (bc.getNature().isDesktopPlatform()) {
FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAirDesktopPackagingOptions(), errorConsumer, false, "does not matter");
} else if (bc.getNature().isMobilePlatform()) {
switch(params.getMobileRunTarget()) {
case Emulator:
switch(params.getAppDescriptorForEmulator()) {
case Android:
FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), errorConsumer, false, "does not matter");
break;
case IOS:
FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), errorConsumer, false, "does not matter");
break;
}
break;
case AndroidDevice:
checkPackagingOptions(module, bc.getSdk(), bc.getAndroidPackagingOptions(), false, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
break;
case iOSSimulator:
checkPackagingOptions(module, bc.getSdk(), bc.getIosPackagingOptions(), true, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
break;
case iOSDevice:
checkPackagingOptions(module, bc.getSdk(), bc.getIosPackagingOptions(), false, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
break;
}
}
}
}
}
checkSimilarOutputFiles(modulesAndBCsToCompile, trinity -> problems.add(trinity));
return problems;
}
Aggregations