Search in sources :

Example 51 with PropertiesComponent

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));
            }
        }
    }
}
Also used : THashMap(gnu.trove.THashMap) Element(org.jdom.Element) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 52 with PropertiesComponent

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;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) IdeFrameImpl(com.intellij.openapi.wm.impl.IdeFrameImpl) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 53 with PropertiesComponent

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("");
    }
}
Also used : ArrayList(java.util.ArrayList) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 54 with PropertiesComponent

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;
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 55 with PropertiesComponent

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;
}
Also used : Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Aggregations

PropertiesComponent (com.intellij.ide.util.PropertiesComponent)71 File (java.io.File)9 NotNull (org.jetbrains.annotations.NotNull)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Project (com.intellij.openapi.project.Project)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)3 CommitStepException (com.intellij.ide.wizard.CommitStepException)3 Notification (com.intellij.notification.Notification)3 NotificationListener (com.intellij.notification.NotificationListener)3 JDOMException (org.jdom.JDOMException)3 Nullable (org.jetbrains.annotations.Nullable)3 SdkPaths.validateAndroidSdk (com.android.tools.idea.sdk.SdkPaths.validateAndroidSdk)2 Module (com.intellij.openapi.module.Module)2 ProjectTemplate (com.intellij.platform.ProjectTemplate)2 CollectionListModel (com.intellij.ui.CollectionListModel)2 THashMap (gnu.trove.THashMap)2 TIntArrayList (gnu.trove.TIntArrayList)2 Analytics (io.flutter.analytics.Analytics)2