use of com.intellij.openapi.projectRoots.ProjectJdkTable in project intellij-plugins by JetBrains.
the class FlexTestUtils method doSetupFlexSdk.
public static void doSetupFlexSdk(final Module module, final String flexSdkRootPath, final boolean air, final String sdkVersion) {
WriteAction.run(() -> {
final Sdk sdk = createSdk(flexSdkRootPath, sdkVersion);
if (ModuleType.get(module) == FlexModuleType.getInstance()) {
modifyBuildConfiguration(module, bc -> {
bc.setNature(new BuildConfigurationNature(air ? TargetPlatform.Desktop : TargetPlatform.Web, false, OutputType.Application));
bc.getDependencies().setSdkEntry(Factory.createSdkEntry(sdk.getName()));
});
}
Disposer.register(module, new Disposable() {
@Override
public void dispose() {
WriteAction.run(() -> {
final ProjectJdkTable projectJdkTable = ProjectJdkTable.getInstance();
projectJdkTable.removeJdk(sdk);
});
}
});
});
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project android by JetBrains.
the class AndroidSdkAdditionalData method getJavaSdk.
@Nullable
public Sdk getJavaSdk() {
final ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
if (myJavaSdk == null) {
if (myJavaSdkName != null) {
myJavaSdk = jdkTable.findJdk(myJavaSdkName);
myJavaSdkName = null;
} else {
for (Sdk jdk : jdkTable.getAllJdks()) {
if (Jdks.getInstance().isApplicableJdk(jdk)) {
myJavaSdk = jdk;
break;
}
}
}
}
return myJavaSdk;
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project intellij-community by JetBrains.
the class Sandbox method getJavaSdk.
@Nullable
public Sdk getJavaSdk() {
final ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
if (myJavaSdk == null) {
if (myJavaSdkName != null) {
myJavaSdk = jdkTable.findJdk(myJavaSdkName);
myJavaSdkName = null;
} else {
for (Sdk jdk : jdkTable.getAllJdks()) {
if (IdeaJdk.isValidInternalJdk(myCurrentJdk, jdk)) {
myJavaSdk = jdk;
break;
}
}
}
}
return myJavaSdk;
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project android by JetBrains.
the class AndroidManifestDomTest method doTestSdkVersionAttributeValueCompletion.
private void doTestSdkVersionAttributeValueCompletion() throws Throwable {
final ProjectJdkTable projectJdkTable = ProjectJdkTable.getInstance();
final Sdk sdk = ModuleRootManager.getInstance(myModule).getSdk();
ApplicationManager.getApplication().runWriteAction(() -> projectJdkTable.addJdk(sdk, getTestRootDisposable()));
doTestCompletionVariants(getTestName(true) + ".xml", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25");
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project intellij-plugins by JetBrains.
the class FlexSdkUtils method createOrGetSdk.
@Nullable
public static Sdk createOrGetSdk(final SdkType sdkType, final String path) {
// todo work with sdk modifiable model if Project Structure is open!
final VirtualFile sdkHome = path == null ? null : LocalFileSystem.getInstance().findFileByPath(path);
if (sdkHome == null)
return null;
final ProjectJdkTable projectJdkTable = ProjectJdkTable.getInstance();
for (final Sdk flexSdk : projectJdkTable.getSdksOfType(sdkType)) {
final String existingHome = flexSdk.getHomePath();
if (existingHome != null && sdkHome.getPath().equals(FileUtil.toSystemIndependentName(existingHome))) {
if (sdkType instanceof FlexmojosSdkType) {
final SdkAdditionalData data = flexSdk.getSdkAdditionalData();
if (data == null || ((FlexmojosSdkAdditionalData) data).getFlexCompilerClasspath().isEmpty()) {
sdkType.setupSdkPaths(flexSdk);
}
}
return flexSdk;
}
}
return createSdk(sdkType, sdkHome.getPath());
}
Aggregations