use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager in project intellij-plugins by JetBrains.
the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck2.
public void testCorrectScopeForSuperclassCheck2() throws Exception {
//
final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
FlexTestUtils.modifyConfigs(myProject, e -> {
ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
bc1.setName("web");
bc1.setTargetPlatform(TargetPlatform.Web);
FlexTestUtils.setSdk(bc1, sdk46);
ModifiableFlexBuildConfiguration bc2 = e.createConfiguration(myModule);
bc2.setName("air");
bc1.setTargetPlatform(TargetPlatform.Desktop);
FlexTestUtils.setSdk(bc2, sdk46);
});
FlexBuildConfigurationManager m = FlexBuildConfigurationManager.getInstance(myModule);
m.setActiveBuildConfiguration(m.findConfigurationByName("air"));
defaultTest();
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager in project intellij-plugins by JetBrains.
the class ChooseActiveBuildConfigurationAction method createPopup.
public static ListPopup createPopup(@NotNull Module module) {
final DefaultActionGroup actionGroup = new DefaultActionGroup();
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(module);
final FlexBuildConfiguration activeBc = manager.getActiveConfiguration();
final FlexBuildConfiguration[] bcs = manager.getBuildConfigurations();
Arrays.sort(bcs, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
for (final FlexBuildConfiguration bc : bcs) {
actionGroup.add(new SelectBcAction(bc, manager));
}
actionGroup.addSeparator();
actionGroup.add(new EditBcsAction(module));
final DataContext dataContext = SimpleDataContext.getProjectContext(module.getProject());
return new PopupFactoryImpl.ActionGroupPopup(FlexBundle.message("choose.build.configuration.popup.title", module.getName()), actionGroup, dataContext, false, false, false, true, null, -1, anAction -> anAction instanceof SelectBcAction && ((SelectBcAction) anAction).getBC() == activeBc, null) {
@Override
protected ListCellRenderer getListElementRenderer() {
return new PopupListElementRenderer(this) {
{
//myRendererComponent.setBorder(new EmptyBorder(5, 0, 5, 0));
}
@Override
protected JComponent createItemComponent() {
return new MyPanel();
}
@Override
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
MyPanel p = (MyPanel) myComponent;
p.clear();
PopupFactoryImpl.ActionItem actionItem = (PopupFactoryImpl.ActionItem) value;
AnAction anAction = actionItem.getAction();
SimpleColoredText text;
Icon icon;
boolean isActive;
if (anAction instanceof SelectBcAction) {
FlexBuildConfiguration bc = ((SelectBcAction) anAction).getBC();
isActive = bc == activeBc;
text = BCUtils.renderBuildConfiguration(bc, null, isActive);
icon = bc.getIcon();
} else {
text = new SimpleColoredText(anAction.getTemplatePresentation().getText(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
icon = anAction.getTemplatePresentation().getIcon();
isActive = false;
}
RowIcon rowIcon = new RowIcon(2);
rowIcon.setIcon(isActive ? (isSelected ? ICON_ACTIVE_SELECTED : ICON_ACTIVE) : ICON_EMPTY, 0);
rowIcon.setIcon(icon, 1);
p.setIcon(rowIcon);
if (isSelected) {
text = text.derive(SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES, true);
setSelected(p);
} else {
setDeselected(p);
}
p.setText(text);
mySeparatorComponent.setVisible(actionItem.isPrependWithSeparator());
return myRendererComponent;
}
};
}
};
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager in project intellij-plugins by JetBrains.
the class ActionScriptCompletionInTextFieldTest method doTestCustomScope.
private void doTestCustomScope(String activeBcName, String selectedBcName, int numberOfVariants) throws Exception {
String filename = getTestName(false).replaceAll("\\d+", "");
configureByFiles(null, BASE_PATH + filename + "_2.mxml", BASE_PATH + filename + "_3.mxml");
final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
FlexTestUtils.modifyConfigs(myProject, e -> {
{
final ModifiableFlexBuildConfiguration bc = e.getConfigurations(myModule)[0];
bc.setName("Flex");
bc.setNature(new BuildConfigurationNature(TargetPlatform.Web, false, OutputType.Application));
FlexTestUtils.setSdk(bc, sdk);
}
{
final ModifiableFlexBuildConfiguration bc = e.createConfiguration(myModule);
bc.setName("AIR");
bc.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
FlexTestUtils.setSdk(bc, sdk);
}
});
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(myModule);
manager.setActiveBuildConfiguration(manager.findConfigurationByName(activeBcName));
final ModuleWithDependenciesScope scope = FlexUtils.getModuleWithDependenciesAndLibrariesScope(myModule, manager.findConfigurationByName(selectedBcName), false);
PublicInheritorFilter filter = new PublicInheritorFilter(myProject, FlashRunConfigurationForm.SPRITE_CLASS_NAME, scope, true);
PsiFile fragment = JSReferenceEditor.forClassName("", myProject, null, GlobalSearchScope.moduleScope(myModule), null, filter, "").getPsiFile();
doTestForEditorTextField((JSExpressionCodeFragment) fragment, "", "js2", BASE_PATH + filename + ".txt");
if (numberOfVariants == 0) {
assertNull(myItems);
} else {
assertEquals(numberOfVariants, myItems.length);
}
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager in project intellij-plugins by JetBrains.
the class ActionScriptCompletionTest method testTwoSdks.
public void testTwoSdks() throws Exception {
final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
FlexTestUtils.modifyConfigs(myProject, new Consumer<FlexProjectConfigurationEditor>() {
public void consume(final FlexProjectConfigurationEditor editor) {
ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
bc1.setName("1");
FlexTestUtils.setSdk(bc1, sdk45);
ModifiableFlexBuildConfiguration bc2 = editor.createConfiguration(myModule);
bc2.setName("2");
FlexTestUtils.setSdk(bc2, sdk46);
}
});
final FlexBuildConfigurationManager m = FlexBuildConfigurationManager.getInstance(myModule);
class TestZZ implements ThrowableRunnable<Exception> {
private final String myBcName;
private final String myExpectedTypeText;
TestZZ(final String bcName, final String expectedTypeText) {
myBcName = bcName;
myExpectedTypeText = expectedTypeText;
}
@Override
public void run() throws Exception {
m.setActiveBuildConfiguration(m.findConfigurationByName(myBcName));
defaultTest();
for (LookupElement item : myItems) {
final LookupElementPresentation p = new LookupElementPresentation();
item.renderElement(p);
assertEquals(myExpectedTypeText, p.getTypeText());
}
}
}
new TestZZ("1", sdk45.getName()).run();
new TestZZ("2", sdk46.getName()).run();
new TestZZ("1", sdk45.getName()).run();
}
Aggregations