use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class FileColorsModel method load.
public void load(@NotNull Element e, boolean isProjectLevel) {
List<FileColorConfiguration> configurations = isProjectLevel ? myProjectLevelConfigurations : myApplicationLevelConfigurations;
configurations.clear();
Map<String, String> predefinedScopeNameToPropertyKey = new THashMap<>(FileColorsModel.predefinedScopeNameToPropertyKey);
for (Element child : e.getChildren(FILE_COLOR)) {
FileColorConfiguration configuration = FileColorConfiguration.load(child);
if (configuration != null) {
if (!isProjectLevel) {
predefinedScopeNameToPropertyKey.remove(configuration.getScopeName());
}
configurations.add(configuration);
}
}
if (!isProjectLevel) {
PropertiesComponent properties = PropertiesComponent.getInstance();
for (String scopeName : predefinedScopeNameToPropertyKey.keySet()) {
String colorName = properties.getValue(predefinedScopeNameToPropertyKey.get(scopeName));
if (colorName == null) {
// backward compatibility, previously it was saved incorrectly as scope name instead of specified property key
colorName = properties.getValue(scopeName);
// so, default value
if (colorName == null) {
colorName = predefinedScopeNameToColor.get(scopeName);
}
}
// empty means that value deleted
if (!StringUtil.isEmpty(colorName)) {
configurations.add(new FileColorConfiguration(scopeName, colorName));
}
}
}
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class TogglePresentationModeAction method tweakFrameFullScreen.
private static ActionCallback tweakFrameFullScreen(Project project, boolean inPresentation) {
Window window = IdeFrameImpl.getActiveFrame();
if (window instanceof IdeFrameImpl) {
IdeFrameImpl frame = (IdeFrameImpl) window;
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
if (inPresentation) {
propertiesComponent.setValue("full.screen.before.presentation.mode", String.valueOf(frame.isInFullScreen()));
return frame.toggleFullScreen(true);
} else {
if (frame.isInFullScreen()) {
final String value = propertiesComponent.getValue("full.screen.before.presentation.mode");
return frame.toggleFullScreen("true".equalsIgnoreCase(value));
}
}
}
return ActionCallback.DONE;
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class TextFieldWithStoredHistory method reset.
public void reset() {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
final String history = propertiesComponent.getValue(myPropertyName);
if (history != null) {
final String[] items = history.split("\n");
ArrayList<String> result = new ArrayList<>();
for (String item : items) {
if (item != null && item.length() > 0) {
result.add(item);
}
}
setHistory(result);
setSelectedItem("");
}
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class AllFileTemplatesConfigurable method disposeUIResources.
@Override
public void disposeUIResources() {
if (myCurrentTab != null) {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
propertiesComponent.setValue(CURRENT_TAB, myCurrentTab.getTitle(), TEMPLATES_TITLE);
final FileTemplate template = myCurrentTab.getSelectedTemplate();
if (template != null) {
propertiesComponent.setValue(SELECTED_TEMPLATE, template.getName());
}
}
if (myEditor != null) {
myEditor.disposeUIResources();
myEditor = null;
myEditorComponent = null;
}
myMainPanel = null;
if (myUIDisposable != null) {
Disposer.dispose(myUIDisposable);
myUIDisposable = null;
}
myTabbedPane = null;
myToolBar = null;
myTabs = null;
myCurrentTab = null;
myTemplatesList = null;
myCodeTemplatesList = null;
myIncludesList = null;
myOtherTemplatesList = null;
}
use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.
the class ProjectStructureConfigurable method disposeUIResources.
@Override
public void disposeUIResources() {
if (!myUiInitialized)
return;
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
propertiesComponent.setValue("project.structure.last.edited", myUiState.lastEditedConfigurable);
propertiesComponent.setValue("project.structure.proportion", String.valueOf(myUiState.proportion));
propertiesComponent.setValue("project.structure.side.proportion", String.valueOf(myUiState.sideProportion));
myUiState.proportion = mySplitter.getProportion();
saveSideProportion();
myContext.getDaemonAnalyzer().stop();
for (Configurable each : myName2Config) {
each.disposeUIResources();
}
myContext.clear();
myName2Config.clear();
myModuleConfigurator.getFacetsConfigurator().clearMaps();
myUiInitialized = false;
}
Aggregations