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());
}
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);
}
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);
}
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() {
}
});
}
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));
}
}
}
}
Aggregations