rename ambigous PER_PLATFORM to PER_OS, add javadoc

This commit is contained in:
Vladimir Krivosheev
2015-07-15 17:37:44 +02:00
parent 66074ef1d2
commit c822b5a3be
12 changed files with 35 additions and 18 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,12 +16,29 @@
package com.intellij.openapi.components;
public enum RoamingType {
/**
* Stored only locally, not shared.
*/
DISABLED,
PER_PLATFORM,
/**
* Stored per operating system (Mac OS X, Linux, FreeBSD, Unix, Windows)
*/
PER_OS,
/**
* Default, shared.
*/
PER_USER,
@Deprecated
/**
* Use {@link #PER_USER} instead
*/
GLOBAL,
PER_USER
@Deprecated
/**
* Use {@link #PER_OS} instead
*/
PER_PLATFORM,
}
@@ -25,7 +25,7 @@ import com.intellij.openapi.components.StoragePathMacros;
*/
@State(
name = "libraryTable",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/applicationLibraries.xml", roamingType = RoamingType.PER_PLATFORM)
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/applicationLibraries.xml", roamingType = RoamingType.PER_OS)
)
public class ExportableApplicationLibraryTable extends ApplicationLibraryTable {
}
@@ -495,7 +495,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta
@State(
name = "PlaybackDebugger",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/playbackDebugger.xml", roamingType = RoamingType.PER_PLATFORM)
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/playbackDebugger.xml", roamingType = RoamingType.PER_OS)
)
public static class PlaybackDebuggerState implements PersistentStateComponent<PlaybackDebuggerState> {
@Attribute
@@ -87,7 +87,7 @@ import java.util.List;
@State(
name = "LafManager",
storages = {
@Storage(file = StoragePathMacros.APP_CONFIG + "/laf.xml", roamingType = RoamingType.PER_PLATFORM),
@Storage(file = StoragePathMacros.APP_CONFIG + "/laf.xml", roamingType = RoamingType.PER_OS),
@Storage(file = StoragePathMacros.APP_CONFIG + "/options.xml", deprecated = true)
}
)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import java.util.*;
*/
@State(
name = "AbbreviationManager",
storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/abbreviations.xml", roamingType = RoamingType.PER_PLATFORM)}
storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/abbreviations.xml", roamingType = RoamingType.PER_OS)}
)
public class AbbreviationManagerImpl extends AbbreviationManager implements PersistentStateComponent<Element> {
private final Map<String, List<String>> myAbbreviation2ActionId = new THashMap<String, List<String>>();
@@ -40,7 +40,7 @@ import java.util.*;
@State(
name = "KeymapManager",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/keymap.xml", roamingType = RoamingType.PER_PLATFORM),
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/keymap.xml", roamingType = RoamingType.PER_OS),
additionalExportFile = KeymapManagerImpl.KEYMAPS_DIR_PATH
)
public class KeymapManagerImpl extends KeymapManagerEx implements PersistentStateComponent<Element>, ApplicationComponent {
@@ -35,7 +35,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
@State(
name = "PathMacrosImpl",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/path.macros.xml", roamingType = RoamingType.PER_PLATFORM)
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/path.macros.xml", roamingType = RoamingType.PER_OS)
)
public class PathMacrosImpl extends PathMacros implements PersistentStateComponent<Element> {
private static final Logger LOG = Logger.getInstance(PathMacrosImpl.class);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import com.intellij.openapi.components.*;
import com.intellij.util.xmlb.XmlSerializerUtil;
/**
* We don't use roaming type PER_PLATFORM - path macros is enough ($USER_HOME$/Dropbox for example)
* We don't use roaming type PER_OS - path macros is enough ($USER_HOME$/Dropbox for example)
*/
@State(
name = "VcsApplicationSettings",
@@ -22,7 +22,7 @@ import java.util.Map;
*/
@State(
name = "ShortcutPromoterManager",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/promoter.xml", roamingType = RoamingType.PER_PLATFORM)
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/promoter.xml", roamingType = RoamingType.PER_OS)
)
public class ShortcutPromoterManager implements ApplicationComponent, AnActionListener, PersistentStateComponent<Element> {
private final Map<String, PromoterState> myState = new LinkedHashMap<String, PromoterState>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
@State(
name = "Git.Application.Settings",
storages = {
@Storage(file = StoragePathMacros.APP_CONFIG + "/git.xml", roamingType = RoamingType.PER_PLATFORM),
@Storage(file = StoragePathMacros.APP_CONFIG + "/git.xml", roamingType = RoamingType.PER_OS),
@Storage(file = StoragePathMacros.APP_CONFIG + "/vcs.xml", deprecated = true)
}
)
@@ -26,7 +26,7 @@ import java.util.Map;
@State(
name = "HgGlobalSettings",
storages = {
@Storage(file = StoragePathMacros.APP_CONFIG + "/hg.xml", roamingType = RoamingType.PER_PLATFORM),
@Storage(file = StoragePathMacros.APP_CONFIG + "/hg.xml", roamingType = RoamingType.PER_OS),
@Storage(file = StoragePathMacros.APP_CONFIG + "/vcs.xml", deprecated = true)
}
)
@@ -6,8 +6,8 @@ import com.intellij.openapi.util.SystemInfo
val PROJECTS_DIR_NAME: String = "_projects/"
private fun getOsFolderName() = when {
SystemInfo.isWindows -> "_windows"
SystemInfo.isMac -> "_mac"
SystemInfo.isWindows -> "_windows"
SystemInfo.isLinux -> "_linux"
SystemInfo.isFreeBSD -> "_freebsd"
SystemInfo.isUnix -> "_unix"
@@ -15,7 +15,7 @@ private fun getOsFolderName() = when {
}
fun buildPath(path: String, roamingType: RoamingType, projectKey: String? = null): String {
fun String.osIfNeed() = if (roamingType == RoamingType.PER_PLATFORM) "${getOsFolderName()}/$this" else this
fun String.osIfNeed() = if (roamingType == RoamingType.PER_OS) "${getOsFolderName()}/$this" else this
return if (projectKey == null) {
(if (path.charAt(0) == '$') path else "\$ROOT_CONFIG$/$path").osIfNeed()