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 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());
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project intellij-community by JetBrains.
the class JavaTestUtil method setupTestJDK.
public static void setupTestJDK() {
ApplicationManager.getApplication().runWriteAction(() -> {
ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
Sdk jdk = jdkTable.findJdk(TEST_JDK_NAME);
if (jdk != null) {
jdkTable.removeJdk(jdk);
}
jdkTable.addJdk(getTestJdk());
});
}
use of com.intellij.openapi.projectRoots.ProjectJdkTable in project android by JetBrains.
the class AndroidTestCaseHelper method removeExistingAndroidSdks.
public static void removeExistingAndroidSdks() {
ProjectJdkTable table = ProjectJdkTable.getInstance();
invokeAndWaitIfNeeded((Runnable) () -> ApplicationManager.getApplication().runWriteAction(() -> {
for (Sdk sdk : table.getAllJdks()) {
table.removeJdk(sdk);
}
PropertiesComponent component = PropertiesComponent.getInstance(ProjectManager.getInstance().getDefaultProject());
component.setValue("android.sdk.path", null);
}));
}
Aggregations