Search in sources :

Example 41 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.

the class NlProperties method saveStarState.

public static void saveStarState(@Nullable String propertyNamespace, @NotNull String propertyName, boolean starred) {
    String propertyNameWithPrefix = getPropertyNameWithPrefix(propertyNamespace, propertyName);
    StringBuilder builder = new StringBuilder();
    for (String starredProperty : getStarredProperties()) {
        if (!starredProperty.equals(propertyNameWithPrefix)) {
            builder.append(starredProperty);
            builder.append(";");
        }
    }
    if (starred) {
        builder.append(propertyNameWithPrefix);
        builder.append(";");
    }
    PropertiesComponent properties = PropertiesComponent.getInstance();
    properties.setValue(STARRED_PROP, builder.toString());
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 42 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project intellij-plugins by JetBrains.

the class JstdServerSettingsManager method storeApplicationSetting.

private static void storeApplicationSetting(@NotNull String key, @NotNull String value) {
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
    propertiesComponent.setValue(key, value);
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 43 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project android by JetBrains.

the class LayersManager method createContent.

@Override
protected LightToolWindow createContent(@NotNull DesignerEditorPanelFacade designer) {
    if (!(designer instanceof LayeredImageEditorPanel)) {
        return null;
    }
    LightToolWindow toolWindow = (LightToolWindow) designer.getClientProperty(getComponentName());
    if (toolWindow != null) {
        return toolWindow;
    }
    LayersPanel layersPanel = new LayersPanel();
    layersPanel.setImage(getImage(designer));
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
    // When LightToolWindowManager#getEditorMode() is public (or a constructor which lets
    // me not specify it) is available and upstreamed, replace the following with just
    // anchor = getEditorMode() :
    String value = propertiesComponent.getValue(myEditorModeKey);
    ToolWindowAnchor anchor;
    if (value == null) {
        anchor = getAnchor();
    } else {
        anchor = value.equals("ToolWindow") ? null : ToolWindowAnchor.fromText(value);
    }
    ThreeComponentsSplitter contentSplitter = designer.getContentSplitter();
    if (contentSplitter.getInnerComponent() == null) {
        // This is a fix for http://b.android.com/219047
        return null;
    }
    return new LightToolWindow(layersPanel, "Image Layers", AllIcons.Toolwindows.ToolWindowPalette, layersPanel, layersPanel, contentSplitter, anchor, this, myProject, propertiesComponent, getVisibilityKeyName(designer), 200, null);
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) ThreeComponentsSplitter(com.intellij.openapi.ui.ThreeComponentsSplitter)

Example 44 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project intellij-plugins by JetBrains.

the class MxmlPreviewToolWindowManager method initToolWindow.

private void initToolWindow() {
    toolWindowForm = new MxmlPreviewToolWindowForm();
    String toolWindowId = FlashUIDesignerBundle.message("mxml.preview.tool.window.title");
    toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(toolWindowId, false, ToolWindowAnchor.RIGHT, project, false);
    toolWindow.setIcon(PlatformIcons.UI_FORM_ICON);
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
    toolWindowVisible = propertiesComponent.getBoolean(SETTINGS_TOOL_WINDOW_VISIBLE);
    if (toolWindowVisible) {
        toolWindow.show(null);
    } else {
        toolWindow.hide(null);
    }
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(project)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (project.isDisposed() || toolWindow == null || !toolWindow.isAvailable()) {
                return;
            }
            final boolean currentVisible = toolWindow.isVisible();
            if (currentVisible == toolWindowVisible) {
                return;
            }
            toolWindowVisible = currentVisible;
            PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
            if (currentVisible) {
                propertiesComponent.setValue(SETTINGS_TOOL_WINDOW_VISIBLE, true);
                if (!lastPreviewChecked) {
                    lastPreviewChecked = true;
                    if (checkLastImage()) {
                        return;
                    }
                }
                render(true, false);
            } else {
                propertiesComponent.unsetValue(SETTINGS_TOOL_WINDOW_VISIBLE);
            }
        }
    });
    JPanel contentPanel = toolWindowForm.getContentPanel();
    ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(contentPanel, null, false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(contentPanel);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(project);
    connection.subscribe(DesignerApplicationManager.MESSAGE_TOPIC, new DocumentRenderedListener() {

        private boolean isApplicable(DocumentFactoryManager.DocumentInfo info) {
            return toolWindowVisible && toolWindowForm.getFile() != null && info.equals(DocumentFactoryManager.getInstance().getNullableInfo(toolWindowForm.getFile()));
        }

        @Override
        public void documentRendered(DocumentFactoryManager.DocumentInfo info) {
            if (isApplicable(info) && !toolWindowForm.waitingForGetDocument) {
                UIUtil.invokeLaterIfNeeded(() -> render(false, false));
            }
        }

        @Override
        public void errorOccurred() {
        }
    });
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ContentManager(com.intellij.ui.content.ContentManager) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx) Content(com.intellij.ui.content.Content) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 45 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project intellij-community by JetBrains.

the class FileColorsModel method initGlobalScopes.

private void initGlobalScopes() {
    PropertiesComponent propertyComponent = PropertiesComponent.getInstance();
    for (String scopeName : predefinedScopeNameToPropertyKey.keySet()) {
        if (findConfiguration(scopeName, false) == null) {
            String color = propertyComponent.getValue(predefinedScopeNameToPropertyKey.get(scopeName));
            if (color == null) {
                // backward compatibility, previously it was saved incorrectly as scope name instead of specified property key
                color = propertyComponent.getValue(scopeName);
                if (color == null) {
                    color = predefinedScopeNameToColor.get(scopeName);
                }
            }
            if (!color.isEmpty()) {
                final Color col = ColorUtil.fromHex(color, null);
                final String name = col == null ? null : FileColorManagerImpl.getColorName(col);
                myApplicationLevelConfigurations.add(new FileColorConfiguration(scopeName, name == null ? color : name));
            }
        }
    }
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Aggregations

PropertiesComponent (com.intellij.ide.util.PropertiesComponent)53 File (java.io.File)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 Project (com.intellij.openapi.project.Project)5 IOException (java.io.IOException)5 NotNull (org.jetbrains.annotations.NotNull)5 ArrayList (java.util.ArrayList)4 SdkPaths.validateAndroidSdk (com.android.tools.idea.sdk.SdkPaths.validateAndroidSdk)2 CommitStepException (com.intellij.ide.wizard.CommitStepException)2 Notification (com.intellij.notification.Notification)2 NotificationListener (com.intellij.notification.NotificationListener)2 TIntArrayList (gnu.trove.TIntArrayList)2 List (java.util.List)2 JDOMException (org.jdom.JDOMException)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 Nullable (org.jetbrains.annotations.Nullable)2 Variant (com.android.builder.model.Variant)1 IDevice (com.android.ddmlib.IDevice)1 GradleVersion (com.android.ide.common.repository.GradleVersion)1 IdDisplay (com.android.sdklib.repository.IdDisplay)1