use of com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType in project intellij-plugins by JetBrains.
the class BCUtils method updateAvailableTargetPlayers.
public static void updateAvailableTargetPlayers(Sdk currentSdk, final JComboBox targetPlayerCombo) {
if (currentSdk != null && currentSdk.getSdkType() instanceof FlexmojosSdkType)
return;
final String sdkHome = currentSdk == null ? null : currentSdk.getHomePath();
final String playerFolderPath = sdkHome == null ? null : sdkHome + "/frameworks/libs/player";
if (playerFolderPath != null) {
final VirtualFile playerDir = ApplicationManager.getApplication().runWriteAction((NullableComputable<VirtualFile>) () -> {
final VirtualFile playerFolder = LocalFileSystem.getInstance().refreshAndFindFileByPath(playerFolderPath);
if (playerFolder != null && playerFolder.isDirectory()) {
playerFolder.refresh(false, true);
return playerFolder;
}
return null;
});
if (playerDir != null) {
final Collection<String> availablePlayers = new ArrayList<>(2);
FlexSdkUtils.processPlayerglobalSwcFiles(playerDir, playerglobalSwcFile -> {
availablePlayers.add(playerglobalSwcFile.getParent().getName());
return true;
});
final Object selectedItem = targetPlayerCombo.getSelectedItem();
final String[] availablePlayersArray = ArrayUtil.toStringArray(availablePlayers);
targetPlayerCombo.setModel(new DefaultComboBoxModel(availablePlayersArray));
//noinspection SuspiciousMethodCalls
if (selectedItem != null && availablePlayers.contains(selectedItem)) {
targetPlayerCombo.setSelectedItem(selectedItem);
} else {
targetPlayerCombo.setSelectedItem(FlexCommonUtils.getMaximumVersion(availablePlayersArray));
}
}
} else {
targetPlayerCombo.setModel(new DefaultComboBoxModel(ArrayUtil.EMPTY_STRING_ARRAY));
}
}
use of com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType in project intellij-plugins by JetBrains.
the class LibraryCollector method collect.
/**
* We don't use BuildConfigurationEntry as source of libraries. If reference to component declared in such build configuration is resolved, so, we register such bc's module
*/
public void collect(Module module) {
final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration();
final Sdk sdk = bc.getSdk();
assert sdk != null;
final SdkType sdkType;
try {
sdkType = (SdkType) sdk.getClass().getMethod("getSdkType").invoke(sdk);
} catch (Exception e) {
throw new RuntimeException(e);
}
final boolean isFlexmojosSdk = sdkType instanceof FlexmojosSdkType;
if (!isFlexmojosSdk) {
collectSdkLibraries(bc, sdk);
} else {
final String sdkHomePath = sdk.getHomePath();
LogMessageUtil.LOG.assertTrue(sdkHomePath != null && sdkHomePath.contains("flex"), sdkHomePath + " must be path to maven repo and contains 'flex'");
flexmojosSdkHomePath = sdkHomePath.substring(0, sdkHomePath.indexOf("flex"));
}
flexSdkVersion = sdk.getVersionString();
assert flexSdkVersion != null;
if (StringUtil.compareVersionNumbers(flexSdkVersion, "4.5.1") >= 0) {
flexSdkVersion = "4.6";
} else {
flexSdkVersion = flexSdkVersion.substring(0, 3);
}
globalCatalogForTests(bc);
final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
for (DependencyEntry entry : bc.getDependencies().getEntries()) {
if (entry instanceof ModuleLibraryEntry) {
LibraryOrderEntry orderEntry = FlexProjectRootsUtil.findOrderEntry((ModuleLibraryEntry) entry, moduleRootManager);
if (orderEntry != null) {
collectFromLibraryOrderEntry(orderEntry.getRootFiles(OrderRootType.CLASSES));
}
} else if (entry instanceof SharedLibraryEntry) {
com.intellij.openapi.roots.libraries.Library library = FlexProjectRootsUtil.findOrderEntry(module.getProject(), (SharedLibraryEntry) entry);
if (library != null) {
collectFromLibraryOrderEntry(library.getFiles(OrderRootType.CLASSES));
}
}
}
// IDEA-71055
// todo css-based themes
final List<String> themes = BCUtils.getThemes(module, bc);
for (String theme : themes) {
if (theme.endsWith(DOT_SWC)) {
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(theme);
if (file != null && uniqueGuard.add(file)) {
final VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(file);
if (jarFile != null) {
addLibrary(jarFile, true);
}
}
}
}
}
use of com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType in project intellij-plugins by JetBrains.
the class FlexDebugProcess method sendAdlStartingCommand.
private void sendAdlStartingCommand(final FlexBuildConfiguration bc, final BCBasedRunnerParameters params) throws IOException {
try {
final Sdk sdk = bc.getSdk();
LOG.assertTrue(sdk != null);
final boolean needToRemoveAirRuntimeDir;
final VirtualFile airRuntimeDirForFlexmojosSdk;
if (sdk.getSdkType() instanceof FlexmojosSdkType) {
final Pair<VirtualFile, Boolean> airRuntimeDirInfo;
airRuntimeDirInfo = FlexSdkUtils.getAirRuntimeDirInfoForFlexmojosSdk(sdk);
needToRemoveAirRuntimeDir = airRuntimeDirInfo.second;
airRuntimeDirForFlexmojosSdk = airRuntimeDirInfo.first;
} else {
needToRemoveAirRuntimeDir = false;
airRuntimeDirForFlexmojosSdk = null;
}
final String airRuntimePath = airRuntimeDirForFlexmojosSdk == null ? null : airRuntimeDirForFlexmojosSdk.getPath();
sendCommand(new StartAirAppDebuggingCommand(FlexBaseRunner.createAdlCommandLine(getSession().getProject(), params, bc, airRuntimePath), needToRemoveAirRuntimeDir ? airRuntimeDirForFlexmojosSdk : null));
} catch (CantRunException e) {
throw new IOException(e.getMessage());
}
}
use of com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType in project intellij-plugins by JetBrains.
the class Flexmojos3Configurator method ensureSdkHasRequiredAdditionalJarPaths.
private void ensureSdkHasRequiredAdditionalJarPaths(@NotNull final Sdk sdk) {
assert sdk.getSdkType() instanceof FlexmojosSdkType;
final FlexmojosSdkAdditionalData additionalData = ((FlexmojosSdkAdditionalData) sdk.getSdkAdditionalData());
assert additionalData != null;
for (MavenId dependency : myFlexmojosPlugin.getDependencies()) {
if (StringUtil.isEmpty(dependency.getArtifactId()))
continue;
for (Pattern jarNamePattern : ADDITIONAL_JAR_NAME_PATTERNS_TO_INCLUDE_IN_FLEXMOJOS_SDK_CLASSPATH) {
if (jarNamePattern.matcher(dependency.getArtifactId()).matches()) {
final String jarFilePath = getArtifactFilePath(myMavenProject, dependency, MavenConstants.TYPE_JAR);
additionalData.addFlexCompilerClasspathEntryIfNotPresentAndRemoveDifferentVersionOfThisJar(jarNamePattern, jarFilePath);
break;
}
}
}
}
use of com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType in project intellij-plugins by JetBrains.
the class DependenciesConfigurable method updateControls.
private void updateControls() {
final Sdk sdk = mySdkCombo.getSelectedJdk();
final boolean flexmojos = sdk != null && sdk.getSdkType() instanceof FlexmojosSdkType;
myTargetPlayerLabel.setVisible(myNature.isWebPlatform() && !flexmojos);
myTargetPlayerCombo.setVisible(myNature.isWebPlatform() && !flexmojos);
if (!myTargetPlayerCombo.isVisible()) {
myTargetPlayerWarning.setVisible(false);
myWarning.setVisible(false);
}
final boolean airSdk = FlexSdkUtils.isAirSdkWithoutFlex(sdk);
final boolean visible = sdk != null && !flexmojos && !myNature.isMobilePlatform() && !myNature.pureAS && !airSdk && StringUtil.compareVersionNumbers(sdk.getVersionString(), "4") >= 0;
myComponentSetLabel.setVisible(visible);
myComponentSetCombo.setVisible(visible);
myFrameworkLinkageLabel.setVisible(!myNature.pureAS && !flexmojos && !airSdk);
myFrameworkLinkageCombo.setVisible(!myNature.pureAS && !flexmojos && !airSdk);
}
Aggregations