use of com.intellij.ide.util.PropertiesComponent in project adb-idea by pbreault.
the class ModuleChooserDialogHelper method saveModuleName.
private static void saveModuleName(Project project, String moduleName) {
final PropertiesComponent properties = PropertiesComponent.getInstance(project);
properties.setValue(SELECTED_MODULE_PROPERTY, moduleName);
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class GenerateAntBuildDialog method saveSettings.
private void saveSettings() {
final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
properties.setValue(SINGLE_FILE_PROPERTY, myRbGenerateSingleFileBuild.isSelected());
properties.setValue(UI_FORM_PROPERTY, myCbEnableUIFormsCompilation.isSelected());
properties.setValue(FORCE_TARGET_JDK_PROPERTY, myCbForceTargetJdk.isSelected());
properties.setValue(BACKUP_FILES_PROPERTY, myRbBackupFiles.isSelected());
properties.setValue(INLINE_RUNTIME_CLASSPATH_PROPERTY, myCbInlineRuntimeClasspath.isSelected());
properties.setValue(GENERATE_IDEA_HOME_PROPERTY, myGenerateIdeaHomeProperty.isSelected());
properties.setValue(OUTPUT_FILE_NAME_PROPERTY, StringUtil.nullize(getOutputFileName()));
}
use of com.intellij.ide.util.PropertiesComponent 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);
}));
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class NewVectorAssetStep method saveAssetPath.
private void saveAssetPath() {
PropertiesComponent properties = PropertiesComponent.getInstance(myFacet.getModule().getProject());
File path = myBrowser.getAsset().path().get();
properties.setValue(VECTOR_ASSET_PATH_PROPERTY, path.getParent());
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class IdeSdks method setAndroidSdkPath.
/**
* Sets the path of Android Studio's Android SDK. This method should be called in a write action. It is assumed that the given path has
* been validated by {@link #isValidAndroidSdkPath(File)}. This method will fail silently if the given path is not valid.
*
* @param path the path of the Android SDK.
* @see com.intellij.openapi.application.Application#runWriteAction(Runnable)
*/
@NotNull
public List<Sdk> setAndroidSdkPath(@NotNull File path, @Nullable Sdk javaSdk, @Nullable Project currentProject) {
if (isValidAndroidSdkPath(path)) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
// given path as well in order to be able to fallback to it later if there is still no android sdk configured within the ide.
if (currentProject != null && !currentProject.isDisposed()) {
String sdkPath = toCanonicalPath(path.getAbsolutePath());
PropertiesComponent.getInstance(currentProject).setValue(ANDROID_SDK_PATH_KEY, sdkPath);
if (!currentProject.isDefault()) {
// Store default sdk path for default project as well in order to be able to re-use it for another ide projects if necessary.
PropertiesComponent component = PropertiesComponent.getInstance(ProjectManager.getInstance().getDefaultProject());
component.setValue(ANDROID_SDK_PATH_KEY, sdkPath);
}
}
// Since removing SDKs is *not* asynchronous, we force an update of the SDK Manager.
// If we don't force this update, AndroidSdks will still use the old SDK until all SDKs are properly deleted.
AndroidSdkData oldSdkData = getSdkData(path);
myAndroidSdks.setSdkData(oldSdkData);
// Set up a list of SDKs we don't need any more. At the end we'll delete them.
List<Sdk> sdksToDelete = new ArrayList<>();
File resolved = resolvePath(path);
// Parse out the new SDK. We'll need its targets to set up IntelliJ SDKs for each.
AndroidSdkData sdkData = getSdkData(resolved, true);
if (sdkData != null) {
// Iterate over all current existing IJ Android SDKs
for (Sdk sdk : myAndroidSdks.getAllAndroidSdks()) {
if (sdk.getName().startsWith(SDK_NAME_PREFIX)) {
sdksToDelete.add(sdk);
}
}
}
for (Sdk sdk : sdksToDelete) {
ProjectJdkTable.getInstance().removeJdk(sdk);
}
// If there are any API targets that we haven't created IntelliJ SDKs for yet, fill those in.
List<Sdk> sdks = createAndroidSdkPerAndroidTarget(resolved, javaSdk);
afterAndroidSdkPathUpdate(resolved);
return sdks;
}
return Collections.emptyList();
}
Aggregations