use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexUnitRunConfigurationForm method updateControls.
private void updateControls() {
if (myShowLogCheckBox.isSelected()) {
myLogLevelCombo.setEnabled(true);
if (myLogLevelCombo.getSelectedItem() == null) {
myLogLevelCombo.setSelectedItem(FlexUnitRunnerParameters.OutputLogLevel.values()[0]);
}
} else {
myLogLevelCombo.setEnabled(false);
}
final FlexBuildConfiguration bc = myBCCombo.getBC();
final boolean webPlatform = bc != null && bc.getTargetPlatform() == TargetPlatform.Web;
final boolean mobilePlatform = bc != null && bc.getTargetPlatform() == TargetPlatform.Mobile;
final boolean app = bc != null && bc.getOutputType() == OutputType.Application;
myLauncherParametersLabel.setVisible(webPlatform);
myLauncherParametersTextWithBrowse.setVisible(webPlatform);
myRunTrustedCheckBox.setVisible(webPlatform);
myEmulatorAdlOptionsLabel.setVisible(mobilePlatform);
myEmulatorAdlOptionsEditor.setVisible(mobilePlatform);
myAppDescriptorForEmulatorLabel.setVisible(app && mobilePlatform);
myAppDescriptorForEmulatorCombo.setVisible(app && mobilePlatform);
if (webPlatform) {
myLauncherParametersTextWithBrowse.getTextField().setText(myLauncherParameters.getPresentableText());
}
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexUnitRuntimeConfigurationProducer method configureRunnerParameters.
private static boolean configureRunnerParameters(final FlexUnitRunnerParameters params, final Module module, final PsiElement element) {
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(module);
FlexUnitSupport support = null;
FlexBuildConfiguration bc = null;
if (module.getName().equals(params.getModuleName()) && !params.getBCName().isEmpty()) {
bc = manager.findConfigurationByName(params.getBCName());
if (bc != null) {
support = FlexUnitSupport.getSupport(bc, module);
}
}
if (support == null) {
bc = manager.getActiveConfiguration();
support = FlexUnitSupport.getSupport(bc, module);
}
if (support == null) {
for (FlexBuildConfiguration anyBC : manager.getBuildConfigurations()) {
bc = anyBC;
support = FlexUnitSupport.getSupport(bc, module);
if (support != null) {
break;
}
}
}
if (support == null) {
return false;
}
params.setModuleName(module.getName());
params.setBCName(bc.getName());
if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
if (bc.getAndroidPackagingOptions().isEnabled()) {
params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.Android);
} else if (bc.getIosPackagingOptions().isEnabled()) {
params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.IOS);
}
}
if (element instanceof JSClass) {
final JSClass clazz = (JSClass) element;
if (!support.isTestClass(clazz, true))
return false;
forClass(clazz, params);
} else if (element instanceof JSFunction) {
final JSFunction method = (JSFunction) element;
final String methodName = method.getName();
final JSClass clazz = (JSClass) element.getParent();
if (!support.isTestClass(clazz, true))
return false;
if (methodName == null || !support.isTestMethod(method)) {
forClass(clazz, params);
} else {
params.setClassName(clazz.getQualifiedName());
params.setMethodName(methodName);
params.setScope(FlexUnitRunnerParameters.Scope.Method);
}
} else if (element instanceof PsiDirectory) {
if (!forDirectory((PsiDirectory) element, module, params))
return false;
} else if (element instanceof PsiDirectoryContainer) {
if (!forPackage((PsiDirectoryContainer) element, module, params))
return false;
} else {
return false;
}
return true;
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexOrderEnumerationHandler method addCustomRootsForLibrary.
@Override
public boolean addCustomRootsForLibrary(@NotNull final OrderEntry forOrderEntry, @NotNull final OrderRootType type, @NotNull final Collection<String> urls) {
if (!(forOrderEntry instanceof JdkOrderEntry)) {
return false;
}
if (myActiveConfigurations == null) {
return false;
}
final Module forModule = forOrderEntry.getOwnerModule();
final FlexBuildConfiguration bc = getActiveConfiguration(forModule);
final Sdk sdk = bc.getSdk();
if (sdk == null || sdk.getSdkType() != FlexSdkType2.getInstance()) {
return false;
}
final String[] allUrls = sdk.getRootProvider().getUrls(type);
if (type != OrderRootType.CLASSES) {
urls.addAll(Arrays.asList(allUrls));
return true;
}
final List<String> themePaths = BCUtils.getThemes(forModule, bc);
final List<String> allAccessibleUrls = ContainerUtil.filter(allUrls, s -> {
s = VirtualFileManager.extractPath(StringUtil.trimEnd(s, JarFileSystem.JAR_SEPARATOR));
return BCUtils.getSdkEntryLinkageType(s, bc) != null || themePaths.contains(s);
});
urls.addAll(new HashSet<>(allAccessibleUrls));
return true;
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexSdkStep method selectSdkUsedByOtherModules.
private static void selectSdkUsedByOtherModules(@Nullable final Project project, final FlexSdkComboBoxWithBrowseButton combo) {
if (project == null) {
return;
}
final FlexProjectConfigurationEditor currentEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
if (currentEditor != null) {
final Module[] modules = ModuleStructureConfigurable.getInstance(project).getModules();
for (Module module : modules) {
if (ModuleType.get(module) != FlexModuleType.getInstance()) {
continue;
}
for (ModifiableFlexBuildConfiguration c : currentEditor.getConfigurations(module)) {
SdkEntry sdkEntry = c.getDependencies().getSdkEntry();
Sdk sdk;
if (sdkEntry != null && (sdk = FlexSdkUtils.findFlexOrFlexmojosSdk(sdkEntry.getName())) != null && sdk.getSdkType() == FlexSdkType2.getInstance()) {
combo.setSelectedSdkRaw(sdk.getName());
return;
}
}
}
} else {
for (final Module module : ModuleManager.getInstance(project).getModules()) {
if (ModuleType.get(module) == FlexModuleType.getInstance()) {
for (FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
Sdk sdk = bc.getSdk();
if (sdk != null) {
combo.setSelectedSdkRaw(sdk.getName());
return;
}
}
}
}
}
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class BCCombo method initCombo.
private void initCombo() {
setMinimumSize(new Dimension(150, getMinimumSize().height));
final Collection<FlexBuildConfiguration> allConfigs = new ArrayList<>();
final Module[] modules = ModuleManager.getInstance(myProject).getModules();
mySingleModuleProject = modules.length == 1;
for (final Module module : modules) {
if (ModuleType.get(module) instanceof FlexModuleType) {
for (final FlexBuildConfiguration config : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
allConfigs.add(config);
myBCToModuleMap.put(config, module);
}
}
}
myAllConfigs = allConfigs.toArray(new FlexBuildConfiguration[allConfigs.size()]);
setRenderer(new ColoredListCellRendererWrapper() {
@Override
protected void doCustomize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
if (value instanceof Pair) {
final String moduleName = (String) ((Pair) value).first;
final String configName = (String) ((Pair) value).second;
//setIcon(PlatformIcons.ERROR_INTRODUCTION_ICON);
if (moduleName.isEmpty() || configName.isEmpty()) {
append(new SimpleColoredText("[none]", SimpleTextAttributes.ERROR_ATTRIBUTES));
} else {
append(BCUtils.renderMissingBuildConfiguration(configName, moduleName));
}
} else {
assert value instanceof FlexBuildConfiguration : value;
final FlexBuildConfiguration bc = (FlexBuildConfiguration) value;
setIcon(bc.getIcon());
append(BCUtils.renderBuildConfiguration(bc, mySingleModuleProject ? null : myBCToModuleMap.get(bc).getName()));
}
}
});
addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
// remove invalid entry
final Object selectedItem = getSelectedItem();
final Object firstItem = getItemAt(0);
if (selectedItem instanceof FlexBuildConfiguration && !(firstItem instanceof FlexBuildConfiguration)) {
setModel(new DefaultComboBoxModel(myAllConfigs));
setSelectedItem(selectedItem);
}
}
});
}
Aggregations