use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class MavenModuleWizardStep method saveValue.
private static void saveValue(String key, String value) {
PropertiesComponent props = PropertiesComponent.getInstance();
props.setValue(key, value);
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class CreateSetupPyAction method getAttributesDefaults.
@Override
public AttributesDefaults getAttributesDefaults(DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
final AttributesDefaults defaults = new AttributesDefaults("setup.py").withFixedName(true);
if (project != null) {
defaults.add("Package_name", project.getName());
final PropertiesComponent properties = PropertiesComponent.getInstance();
defaults.add("Author", properties.getOrInit(AUTHOR_PROPERTY, SystemProperties.getUserName()));
defaults.add("Author_email", properties.getOrInit(EMAIL_PROPERTY, ""));
defaults.addPredefined("PackageList", getPackageList(dataContext));
defaults.addPredefined("PackageDirs", getPackageDirs(dataContext));
}
return defaults;
}
use of com.intellij.ide.util.PropertiesComponent in project ideavim by JetBrains.
the class VimPlugin method setupStatisticsReporter.
/**
* Reports statistics about installed IdeaVim and enabled Vim emulation.
*
* See https://github.com/go-lang-plugin-org/go-lang-idea-plugin/commit/5182ab4a1d01ad37f6786268a2fe5e908575a217
*/
private void setupStatisticsReporter(@NotNull EventFacade eventFacade) {
final Application application = ApplicationManager.getApplication();
eventFacade.addEditorFactoryListener(new EditorFactoryAdapter() {
@Override
public void editorCreated(@NotNull EditorFactoryEvent event) {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
final long lastUpdate = propertiesComponent.getOrInitLong(IDEAVIM_STATISTICS_TIMESTAMP_KEY, 0);
final boolean outOfDate = lastUpdate == 0 || System.currentTimeMillis() - lastUpdate > TimeUnit.DAYS.toMillis(1);
if (outOfDate && isEnabled()) {
application.executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
final String pluginId = IDEAVIM_PLUGIN_ID;
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
final String os = URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, CharsetToolkit.UTF8);
final String uid = UpdateChecker.getInstallationUID(PropertiesComponent.getInstance());
final String url = "https://plugins.jetbrains.com/plugins/list" + "?pluginId=" + pluginId + "&build=" + buildNumber + "&pluginVersion=" + version + "&os=" + os + "&uuid=" + uid;
PropertiesComponent.getInstance().setValue(IDEAVIM_STATISTICS_TIMESTAMP_KEY, String.valueOf(System.currentTimeMillis()));
HttpRequests.request(url).connect(new HttpRequests.RequestProcessor<Object>() {
@Override
public Object process(@NotNull HttpRequests.Request request) throws IOException {
LOG.info("Sending statistics: " + url);
try {
JDOMUtil.load(request.getInputStream());
} catch (JDOMException e) {
LOG.warn(e);
}
return null;
}
});
} catch (IOException e) {
LOG.warn(e);
}
}
});
}
}
}, application);
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class GenerateAntBuildDialog method loadSettings.
private void loadSettings() {
final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
if (properties.isValueSet(SINGLE_FILE_PROPERTY)) {
final boolean singleFile = properties.isTrueValue(SINGLE_FILE_PROPERTY);
myRbGenerateSingleFileBuild.setSelected(singleFile);
myRbGenerateMultipleFilesBuild.setSelected(!singleFile);
}
if (properties.isValueSet(UI_FORM_PROPERTY)) {
myCbEnableUIFormsCompilation.setSelected(properties.isTrueValue(UI_FORM_PROPERTY));
}
if (properties.isValueSet(FORCE_TARGET_JDK_PROPERTY)) {
myCbForceTargetJdk.setSelected(properties.isTrueValue(FORCE_TARGET_JDK_PROPERTY));
}
if (properties.isValueSet(BACKUP_FILES_PROPERTY)) {
final boolean backup = properties.isTrueValue(BACKUP_FILES_PROPERTY);
myRbBackupFiles.setSelected(backup);
myRbOverwriteFiles.setSelected(!backup);
}
if (properties.isValueSet(INLINE_RUNTIME_CLASSPATH_PROPERTY)) {
myCbInlineRuntimeClasspath.setSelected(properties.isTrueValue(INLINE_RUNTIME_CLASSPATH_PROPERTY));
}
if (properties.isValueSet(GENERATE_IDEA_HOME_PROPERTY)) {
myGenerateIdeaHomeProperty.setSelected(properties.isTrueValue(GENERATE_IDEA_HOME_PROPERTY));
}
if (properties.isValueSet(OUTPUT_FILE_NAME_PROPERTY)) {
myOutputFileNameField.setText(properties.getValue(OUTPUT_FILE_NAME_PROPERTY));
} else {
myOutputFileNameField.setText(BuildProperties.getProjectBuildFileName(myProject));
}
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class ToggleDistractionFreeModeAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
alternateCurrentDistractionFreeModeSetting();
boolean enter = isDistractionFreeModeEnabled();
if (project == null)
return;
PropertiesComponent p = PropertiesComponent.getInstance();
UISettings ui = UISettings.getInstance();
EditorSettingsExternalizable.OptionSet eo = EditorSettingsExternalizable.getInstance().getOptions();
DaemonCodeAnalyzerSettings ds = DaemonCodeAnalyzerSettings.getInstance();
String before = "BEFORE.DISTRACTION.MODE.";
String after = "AFTER.DISTRACTION.MODE.";
if (enter) {
applyAndSave(p, ui, eo, ds, before, after, false);
TogglePresentationModeAction.storeToolWindows(project);
} else {
applyAndSave(p, ui, eo, ds, after, before, true);
TogglePresentationModeAction.restoreToolWindows(project, true, false);
}
UISettings.getInstance().fireUISettingsChanged();
LafManager.getInstance().updateUI();
EditorUtil.reinitSettings();
DaemonCodeAnalyzer.getInstance(project).settingsChanged();
EditorFactory.getInstance().refreshAllEditors();
}
Aggregations