use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class AndroidProcessChooserDialog method doOKAction.
@Override
protected void doOKAction() {
final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
final IDevice selectedDevice = getSelectedDevice();
if (selectedDevice == null) {
return;
}
mySelectedClient = getSelectedClient();
if (mySelectedClient == null) {
return;
}
myAndroidDebugger = (AndroidDebugger) myDebuggerTypeCombo.getSelectedItem();
properties.setValue(DEBUGGABLE_DEVICE_PROPERTY, getPersistableName(selectedDevice));
properties.setValue(DEBUGGABLE_PROCESS_PROPERTY, getPersistableName(mySelectedClient));
properties.setValue(SHOW_ALL_PROCESSES_PROPERTY, Boolean.toString(myShowAllProcessesCheckBox.isSelected()));
if (myAndroidDebugger != null) {
properties.setValue(DEBUGGER_ID_PROPERTY, myAndroidDebugger.getId());
}
super.doOKAction();
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class ApkStep method _commit.
@Override
public void _commit(boolean finishChosen) throws CommitStepException {
final String apkPath = myApkPathField.getText().trim();
if (apkPath.length() == 0) {
throw new CommitStepException(AndroidBundle.message("android.extract.package.specify.apk.path.error"));
}
AndroidFacet facet = myWizard.getFacet();
PropertiesComponent properties = PropertiesComponent.getInstance(myWizard.getProject());
properties.setValue(ChooseModuleStep.MODULE_PROPERTY, facet != null ? facet.getModule().getName() : "");
properties.setValue(getApkPathPropertyName(), apkPath);
File folder = new File(apkPath).getParentFile();
if (folder == null) {
throw new CommitStepException(AndroidBundle.message("android.cannot.create.file.error", apkPath));
}
try {
if (!folder.exists()) {
folder.mkdirs();
}
} catch (Exception e) {
throw new CommitStepException(e.getMessage());
}
final CompileScope compileScope = CompilerManager.getInstance(myWizard.getProject()).createModuleCompileScope(facet.getModule(), true);
AndroidCompileUtil.setReleaseBuild(compileScope);
properties.setValue(RUN_PROGUARD_PROPERTY, Boolean.toString(myProguardCheckBox.isSelected()));
if (myProguardCheckBox.isSelected()) {
final List<String> proguardOsCfgPaths = myProGuardConfigFilesPanel.getOsPaths();
if (proguardOsCfgPaths.isEmpty()) {
throw new CommitStepException(AndroidBundle.message("android.extract.package.specify.proguard.cfg.path.error"));
}
final String proguardPathsStr = mergeProguardCfgPathsToOneString(proguardOsCfgPaths);
properties.setValue(PROGUARD_CFG_PATHS_PROPERTY, proguardPathsStr);
for (String path : proguardOsCfgPaths) {
if (!new File(path).isFile()) {
throw new CommitStepException("Cannot find file " + path);
}
}
compileScope.putUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY, proguardPathsStr);
}
myWizard.setCompileScope(compileScope);
myWizard.setApkPath(apkPath);
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class ApkStep method _init.
@Override
public void _init() {
if (myInited)
return;
final AndroidFacet facet = myWizard.getFacet();
Module module = facet.getModule();
PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
String lastModule = properties.getValue(ChooseModuleStep.MODULE_PROPERTY);
String lastApkPath = properties.getValue(getApkPathPropertyName());
if (lastApkPath != null && module.getName().equals(lastModule)) {
myApkPathField.setText(FileUtil.toSystemDependentName(lastApkPath));
} else {
String contentRootPath = getContentRootPath(module);
if (contentRootPath != null) {
String defaultPath = FileUtil.toSystemDependentName(contentRootPath + "/" + module.getName() + ".apk");
myApkPathField.setText(defaultPath);
}
}
final String runProguardPropValue = properties.getValue(RUN_PROGUARD_PROPERTY);
boolean selected;
if (runProguardPropValue != null) {
selected = Boolean.parseBoolean(runProguardPropValue);
} else {
selected = facet.getProperties().RUN_PROGUARD;
}
myProguardCheckBox.setSelected(selected);
myProGuardConfigFilesPanel.setEnabled(selected);
final String proguardCfgPathsStr = properties.getValue(PROGUARD_CFG_PATHS_PROPERTY);
final String[] proguardCfgPaths = proguardCfgPathsStr != null ? parseAndCheckProguardCfgPaths(proguardCfgPathsStr) : null;
if (proguardCfgPaths != null && proguardCfgPaths.length > 0) {
myProGuardConfigFilesPanel.setOsPaths(Arrays.asList(proguardCfgPaths));
} else {
final AndroidFacetConfiguration configuration = facet.getConfiguration();
if (configuration.getState().RUN_PROGUARD) {
myProGuardConfigFilesPanel.setUrls(facet.getProperties().myProGuardCfgFiles);
} else {
final List<String> urls = new ArrayList<String>();
urls.add(AndroidCommonUtils.PROGUARD_SYSTEM_CFG_FILE_URL);
final Pair<VirtualFile, Boolean> pair = AndroidCompileUtil.getDefaultProguardConfigFile(facet);
if (pair != null) {
urls.add(pair.getFirst().getUrl());
}
myProGuardConfigFilesPanel.setUrls(urls);
}
}
myInited = true;
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class ScreenshotViewer method loadScreenshotPath.
private VirtualFile loadScreenshotPath() {
PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
String lastPath = properties.getValue(SCREENSHOT_SAVE_PATH_KEY);
if (lastPath != null) {
return LocalFileSystem.getInstance().findFileByPath(lastPath);
} else {
return myProject.getBaseDir();
}
}
use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.
the class LaunchEmulatorDialog method doOKAction.
@Override
protected void doOKAction() {
final PropertiesComponent properties = PropertiesComponent.getInstance(myFacet.getModule().getProject());
final IdDisplay selectedAvd = (IdDisplay) myAvdCombo.getComboBox().getSelectedItem();
if (selectedAvd != null) {
properties.setValue(SELECTED_AVD_PROPERTY, selectedAvd.getId());
} else {
properties.unsetValue(SELECTED_AVD_PROPERTY);
}
super.doOKAction();
}
Aggregations